So basically i created an application that has a file association for a certain type of document, so the program launches when you double click on the document. What I want to do with applescript is set up two different commands for the program, one command will run when the program is launched from its icon or from the dock, the other command will be executed when the program’s associated file is double clicked and used to launch the program. Please help if there is anyway to do this.
I’m (only) guessing that you used an ‘on open’ handler and a unique creator code (bundle ID, whatever) to associate the script app with certain documents -
on open
–blah
end open
You can use an ‘on run’ handler in the same app to get it to do something entirely else when double clicked -
on run
–not blah
end run
I’m not sure this is what you’re looking for. If not, clarify your question somewhat and I’m sure someone else will jump in.
ok ill try to make this as clear as possible, im rather new to applescript however
basically i created an applescript application using XCode, the application uses a simple applescript to run a shell script, the shell script just executes a unix executable that is on the computer, i wanted to provide file associations and an icon for the unix executable so i bundled it in the applescript application and used the properties to edit the plist.info file well anyway, when a user opens one of the associated files i wanted the applescript to pass the file’s path on as an argument when opening the unix executable. I came up with this simple code so far where the program simply launches the executable when launched, but when trying to pass the file path on you have to close the unix executable and then the executable reopens with the file path as an argument.
on open fileAlias
do shell script "cd /Users/meskue/Movies/Paraprof.app/Contents/Resources/; ./paraprof " & (quoted form of POSIX path of fileAlias)
end open
on launched theObject
do shell script "cd /Users/meskue/Movies/Paraprof.app/Contents/Resources/; ./paraprof"
quit
end launched