On Jan 31, 2010, at 3:36 PM, Robert Poland wrote: On this shortened script, if the machine does not have Dreamweaver is there a better way to avoid the script hunting for a non-existant app?
I ran into that problem once with a script where the user may or may not have the application Smile. I did this ...
if frontProc is "Smile" then "tell application \"Smile\"" & return & "activate" & return & ¬ "if class of window 1 is not script window then error" & return & ¬ "save window 1" & return & "path name of window 1" & return & "end tell" try set docAlias to (run script the result) as alias on error error "Smile's frontmost window is not a script window or" & return & "Smile can't find the saved copy of the current document." & return & ¬ "Save it to a project folder and try again." -- window 1 has no associated file end try
In this case the script text was short. If you have a large set of handlers for Dreamweaver, you might write them as a loadable script file, then do something like this ...
if frontProc is "Dreamweaver" then set dwScript to load script <alias_to_script_file_for_dreamweaver> someHandler() of dwScript
But, would this protect from the "Where is application ..." dialog? It seems reasonable that it would, but I haven't tested it. |