I’m try to build support for Growl into my App. Growl is an open-source notification system for OS X that has support for Applescript. The problem is, when I try to compile my script on a Mac without Growl installed, or run the app on a Mac without Growl installed, I get a dialog looking for “GrowlHelperApp” even though I have a handler to check for the presense of the application.
The error upon compile is “no user interaction allowed (-1713)”
I suppose that Xcode checks for the presence of Growl during the compile process.
How do I leave a “tell” statement in for an app that hasn’t been installed without triggering this behavior?
Unless you’re doing a whole lot of calls to the app, you can probably get away with running small scripts right out of your main script. The following will check for an app, by it’s file id, and run a script containing the code to execute. By placing the code in a script and using the ‘run script’ command on it, it is stored as a string until you run it, at which time it is compiled and executed. This will take care of any compilation errors when building your project, which shouldn’t be a problem since you’re checking for the app right before executing the code. If there is an error during compilation or execution of the script it will log the error, rather than display the error dialog. If the app doesn’t have a unique file id, you can also do similar things using the app’s name.
property appFileID : "XXXX" --> enter the 4-digit file id/creator code of the app here
set appName to appName()
if appName is not "" then
set someData to "Test"
try
run script "on run{appName,someData}
tell application appName
activate
display dialog someData
end tell
end" with parameters {appName, someData}
on error errmsg
log errmsg
end try
else
beep
end if
to appName()
try
tell application "Finder" to return (name of (application file id appFileID))
on error
return ""
end try
end appName
I wound up solving this by using the “using terms from” approach (an indirect call) which seemed to work just fine. There’s an excellent thread, right here on Macscripter that pointed me to the solution. So, why did I post? Well it seems the search engine on this site isn’t as good as Google. If only I’d Googled first, then I woudn’t have posted What an awesome site this is. Did I say how much I like Macscripter?