On 7-Jun-2007, at 12:52, [EMAIL PROTECTED] wrote:
On 2007-06-07, at 15:20.0, Brennan wrote:
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.

This version runs in BBEdit if available, otherwise TextWrangler:

tell application "Finder"
        if exists file "BBEdit.app" in (path to applications folder) then
                set theTextEditor to "BBEdit"

This assumes you keep your BBEdit app in /Applications/. I don't, and I suspect a lot of other people don't.

For example, BBEdit, since it is licensed to ME is in ~/Applications/ and Textwrangler is in /Applications/3rd Party/ with all the other generic third party applications.

else if exists file "TextWrangler.app" in (path to applications folder) then
                set theTextEditor to "TextWrangler"
        else
                set theTextEditor to (choose application)
        end if

Either way, you are probably better off doing something like this:

property MyEditor : ""

tell application "System Events"
        if exists file "BBEdit.app" in (path to applications folder) then
                set DefaultChoice to "BBEdit"
else if exists file "TextWrangler.app" in (path to applications folder) then
                set DefaultChoice to "TextWrangler"
        else
                set MyEditor to (choose application)
        end if
        if not (MyEditor) then
                set MyEditor to DefaultChoice
        end if
end tell

er.. something like that.

--
Hey, how come Andrew gets to get up? If he gets up, we'll all get up, it'll be anarchy.


--
------------------------------------------------------------------------
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