<jaw drops> Wow, this helps SO much! I'm redoing a bunch of scripts for my
daily workflow, and pulling text out of BBEdit is the core of everything.
I've been relying on moving the cursor around and copying using Keyboard
Maestro, but I'm just starting to overhaul these with faster and more
predictable AppleScript actions. I've got one simple one done, and it is
mind-blowingly better. Now I have to work on the harder ones. This will
help a ton.
I might pick your brain when I get to doing some time arithmetic with
varying number of time entry lines!
THANK YOU!
On Monday, August 14, 2023 at 7:59:45 AM UTC-7 jj wrote:
> Hi Eric,
>
> Here is an example of how to get the values captured by a regex.
>
> *tell* *application* "BBEdit"
>
> *set* vDocument *to* *first* *text document* *of* *first* *window*
>
> *set* vTimeRegex *to* "(?:[01][0-9]|2[0-3]):[0-5][0-9]"
>
> *set* vRegex *to* "^(" & vTimeRegex & ")-(" & vTimeRegex &
> ")\\h+([A-Z]{3})"
>
> *set* vOptions *to* {search mode:*grep*, starting at top:*true*, wrap
> around:*false*, returning results:*true*}
>
> *set* vResult *to* *find* vRegex searching in vDocument options vOptions
>
> *if* vResult's found *then*
>
> *repeat* *with* vMatch *in* found matches *of* vResult
>
> *log* vMatch
>
> *set* vOptions *to* {search mode:*grep*, starting at top:*true*, wrap
> around:*false*, returning results:*false*}
>
> *set* vTag *to* *characters* (vMatch's start_offset) *thru* (vMatch's
> end_offset) *of* vDocument
>
> *set* vTagMatch *to* *find* vRegex searching in vTag options vOptions
>
> *if* vTagMatch's found *then*
>
> *set* vStartTime *to* *grep substitution* of "\\1"
>
> *set* vEndTime *to* *grep substitution* of "\\2"
>
> *set* vClientCode *to* *grep substitution* of "\\3"
>
> *log* {vStartTime:vStartTime, vEndTime:vEndTime, vClientCode:vClientCode}
>
> *end* *if*
>
> *end* *repeat*
>
> *end* *if*
>
> *end* *tell*
>
> HTH,
>
> Jean Jourdain
> On Monday, August 14, 2023 at 8:23:11 AM UTC+2 Rick Gordon wrote:
>
>> I haven't worked with Keyboard Maestro, but what about *found text of
>> TicketTimeEntryBegin*?
>>
>> On August 13, 2023 at 11:20:24 PM [-0700], E2o wrote in an email
>> entitled "Using AppleScript to find and set an AS variable collects TMI
>> (too
>> much information)":
>> > found text:08:30
>>
>> ___________________________________________
>> RICK GORDON
>> EMERALD VALLEY GRAPHICS AND CONSULTING
>> ___________________________________________
>> WWW: http://www.shelterpub.com
>>
>
--
This is the BBEdit Talk public discussion group. If you have a feature request
or need technical support, please email "[email protected]" rather than
posting here. Follow @bbedit on Twitter: <https://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 view this discussion on the web visit
https://groups.google.com/d/msgid/bbedit/968fa181-7970-4eda-92ca-3a3c60c81a38n%40googlegroups.com.