running a shell script with options (arguments)

in the resources folder of my main app package, i have another app and a command file for that app. i need to run the command file with the app. There’s 2 ways to do this by hand. 1- Double click the comand file (in the finder) and the app launches and runs the command file. 2-in terminal, type the following:

/path/to/app (space) /path/to/commandFile.

I’ve tried both from my AS Studio app. neither works. Here’s the details:
1- (from the finder) using the code:

tell application "Finder"
		open file (((path to me) as string) & commandScriptPath)
end tell

this works on about half of my machines, the other half say ‘cannot find application to open file’

2-using several variations of POSIX path and ‘quoted form of’ with “do shell script” i get the error “cannot find file /path/to/app”. the problem lies in the spaces in my program name AND the space needed to tell the executable where the command file lives. i’m running several perl scripts from my resources folder in other locations of my program (and they work perfectly with “do shell script”), but this is the only on i have to pass an argument to the app.

Can any of you provide assistance here? I don’t mind using any method to do this, but i’m stuck.


If you’ve copied the application and the command file so that when the project is built, they are added to the project’s Resources folder, this should work:


[This script was automatically tagged for color coded syntax by Convert Script to Markup Code]

that got it. thanks!