On Apr 6, 2007, at 18:54, Dennis J. Wilkinson, II wrote:

Is there any way to cause the same action as File > Open Selection from AppleScript?

I'm trying to write a script that will take lines of grep -n output, like:

[macintosh:~] > grep -nrie foo .
./path/to/file1.cpp:48:     foo->bar();
./path/to/file2.cpp:28:// foo

And automatically parse out the file and line number from the start of the (first) selected line and invoke File > Open Selection. Finding file and line number was pretty simple, but I've haven't yet been able to make the "open selection" part work.

I briefly tried doing UI scripting, but it seemed like my keyboard modifiers for the key I was assigning to the script were being picked up during UI scripting and getting in the way, both with menu click actions and by sending keys to the application.

It is possible to attach a script to a menu item, that does not require UI scripting. See page 278 and beyond in the BBEdit manual. I've used this to sanitize the Open selection behavior for LaTeX, and that seems to work. OTOH, that required me to create the full path based on other information I could obtain at that point. I never tried to include system libraries in such functionality.

HTMH,

Maarten

--
------------------------------------------------------------------------
Have a feature request? Not sure the software's working correctly?
If so, please send mail to <[EMAIL PROTECTED]>, not to the list.
List FAQ: <http://www.barebones.com/support/lists/bbedit_script.shtml>
List archives: <http://www.listsearch.com/bbeditscripting.lasso>
To unsubscribe, send mail to:  <[EMAIL PROTECTED]>

Reply via email to