Hey Chris!

This thread „degenerates“ ;-) in one that’s more about RegEx and AppleScript 
than BBEdit - I apologize for that and do my best to finish it! :-)


> Am 11.12.2014 um 18:54 schrieb Christopher Stone <[email protected]>:
> 
> -------------------------------------------------------------------------------------------
> (?s)\A.+Expand all \| Collapse all[[:blank:]]*\r+(.+(?=\r{1,}Watch this 
> entire course)).+
> -------------------------------------------------------------------------------------------
> 
> (?s)                                ==  Allow . to match vertical whitespace.
> \A                                  ==  TOP of the text.
> .+                                  ==  Any character 1 or more.
> Expand all \| Collapse all          ==  Literal Text (pipe is a reserved 
> character and must be escaped).
> [[:blank:]]*                        ==  Horizontal whitespace 0 or more.
> \r+                                 ==  1 or more return characters.
> (                                   ==  Begin capture.
> .+                                  ==  Any character 1 or more.
> (?=\r{1,}Watch this entire course)  ==  Positive Lookahead Assertion - one or 
> more CRs then literal.
> )                                   ==  Close capture group.
> .+                                  ==  Any character 1 or more.
> 
> REPLACE with the first capture group: \1
> 
> -------------------------------------------------------------------------------------------
> \r(\d+[ms])
> -------------------------------------------------------------------------------------------
> 
> \r    ==  Return.
> (     ==  Start Capture.
> \d+   ==  Any digit one or more.
> [ms]  ==  A range of characters including ONLY 'm' and 's'.
> )     ==  End capture.
> 
> REPLACE with a space and the first capture group: ' \1' (quotes not included).
> 
> -------------------------------------------------------------------------------------------
> ^(\d)
> -------------------------------------------------------------------------------------------
> 
> ^   ==  Beginning of line.
> (   ==  Start Capture.
> \d  ==  Any digit.
> )   ==  End capture.
> 
> REPLACE with a return and the first capture group: \r\1
Now it looses (some! :-) of the magic and begins to get more readable… thanks, 
Chris!


> 4. In your script everything is local: the „main-program“ and the „routines“.
>> 
>> a) Is it possible to put handlers outside the script itself
> 
> Yes.  Script Debugger makes this trivial but it's easy enough to do with 
> regular AppleScript.
How does Script Debugger „makes this trivial“?


> b) how do you declare the global returns used in the - now global - handlers?
> 
> You mean if you put handlers in a library how do you use them?
Yes.
I expected to have some global declarations (in the main script) of the 
return-parameters of the handlers (from the library).


> Basically you create a script with handlers in it.
> 
> Then you use load script <path to script>.
> 
> So.  You might end up with something like this:
> 
> set myLib to load script alias ((path to library folder from user domain as 
> text) & "Script Libraries:z_Test.scptd:")
> set myLibraryHanderOutput to myLib's TEST_LIBRARY_HANDLER()
> 
> You can eek a little more speed out of that by making the library a property 
> (which loads on compile not run).
> 
> property myLib : load script alias ((path to library folder from user domain 
> as text) & "Script Libraries:z_Test.scptd:")
> set myLibraryHanderOutput to myLib's TEST_LIBRARY_HANDLER()
I understand.


> The pitfall is that it will not automatically update when you change the code 
> in the library.  You have to do it manually by recompiling the script
That’s not so bad…


> or provide your own mechanism for noticing that the library has changed.
Hmmm… how?


> --
> Take Care,
> Chris
Thanks again!
Vlad

-- 
This is the BBEdit Talk public discussion group. If you have a 
feature request or would like to report a problem, please email
"[email protected]" rather than posting to the group.
Follow @bbedit on Twitter: <http://www.twitter.com/bbedit>

--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].

Reply via email to