On 6/1/07 at 8:07 AM, Maarten Sneep <[EMAIL PROTECTED]> wrote:
> Unfortunately I haven't found a way to
> store the application is a run time variable, so the best I came up
> with for producing script sets for both applications is to use a sed
> script on the text version of the scripts.
Have you tried something like this...
set apps to {"BBEdit", "TextWrangler"}
set p to "Run script in which app?"
set choice to (choose from list apps with prompt p)
if choice is false then
-- user clicked 'cancel'
return
end if
set appName to choice as string
using terms from application "TextWrangler"
tell application appName
-- your script goes here
end tell
end using terms from
...seems to work for me. The app name is soft-coded, but the 'using terms
from' block allows the terminology to compile using TextWrangler. The
compiled script will run in either app.
Given that TextWrangler's dictionary represents a subset of BBEdit
scripting terminology, any BBEdit-only terminology will not compile
properly. That's a good thing, if I understand you right, because you'll
be able to be sure at compile-time that the script will run in both apps.
BTW, this also works with Mailsmith, although Mailsmith contains some
terminology which is not present in BBEdit, and TextWrangler, and vice
versa, so one can not be so sure that code compiled against TextWrangler
will run. Even so, you'd mostly be doing stuff with 'text of window 1' in
all three apps.
--
Brennan Young
Someone asked Mulla Nasrudin what his house was like. In reply he brought this
man a brick, saying: 'It is just a collection of these.'
--
------------------------------------------------------------------------
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]>