On Tuesday, August 21, 2012 5:27:06 PM UTC-3, Christopher Stone wrote:
>
> Okay. I'm glad you mentioned this, since it's very germane to the problem.
>
> This slightly modified script should fix the find-backwards problem.
>
> I assume you have the Keyboard Maestro shortcut set to 'Key Pressed' - yes?
>
No, if I use "is pressed", there is no repeating at all. In order to get
the repeating to work, I need to use "is down".
>
>
> ------------------------------------------------------------------------------------------------
> tell *application* "BBEdit"
> tell *text* of front *text window*
> if (characterOffset of selection) > 1 then
> set endMarker to (characterOffset of selection) + (length of
> selection) - 1
> set fRec to *find* "[^\\r]+" options {search mode:grep, starting at
> top:false, wrap around:false, backwards:true, case sensitive:false, match
> words:false} with extend selection
> set startmarker to characterOffset of fRec's found object
> *select* (*characters* startmarker thru endMarker)
> end if
> end tell
> end tell
>
> ------------------------------------------------------------------------------------------------
>
>
Woah. All kinds of funky stuff happening now. It *sort of* works, i.e. the
current selection no longer gets deselected when the shortcut is held down
to repeat, but there are all kinds of hiccups in the repetition, and
sometimes BBEdit gets very confused and extends the selection downwards by
a line or two, or extends upwards and then removes what's just been added
to the selection, and I also get system beeps. Very strange.
I tried inserting a small pause in KM after the execution, but that didn't
make any difference.
I also asked KM to display the results of the AppleScript script and during
the hiccups I get:
/usr/bin/osascript: couldn't save changes to script
/Users/igot/Library/Application Support/BBEdit/Scripts/Extend Up -
Grep.scpt: error -54.
Not sure what it all means. (On the positive side, there is no longer any
"flickering" of the selection as there was with earlier versions of the
script.)
I realize I am probably nit-picking at this point (the script works fine
with repeated keystrokes, only has problems when pressing and holding when
using Keyboard Maestro), but since we are trying to replicate the standard
paragraph selection of other OS X applications with the same standard
shortcuts, we might as well try to go all the way :).
I find it rather strange that the simple addition of the IF... THEN...
condition would create this new problem, but it obviously has to do with
some weird interaction between AppleScript, BBEdit and Keyboard Maestro. I
don't know that "error -54" is, but obviously this form of execution is
causing OS X to try and save something internal in the script. (Out of
curiosity, I tried saving the script as an app, and asking KM to execute
that instead, but it doesn't change anything.)
Any further thoughts?
Pierre
--
--
You received this message because you are subscribed to the
"BBEdit Talk" discussion group on Google Groups.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
<http://groups.google.com/group/bbedit?hl=en>
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>