Call Console App from Applescript

vettezuki

Registered
This is actually a two part question:

Part 1:
I've written a C++ "SIOUX Console App." It runs fine from within CodeWarrior, and on other systems, but when I call it from the console (bash or c-shell) the system says "permission denied." I opened permissions to 777, so it's not a permission related denied access. I'm guessing OSX is preventing any user from calling this application for some reason, but I can't seem to find out where that security option would be set if that is indeed the problem. I'd be happy to just call the application from the command line, passing in the arguments it needs. It's just a file parser. But I can't even do that at the moment.

Part 2:
A friend of mine suggested that there is a common mechanism on OSX for applications like this. Apparently it consists of a folder containing a script and the application itself. A user can the drop a file onto the folder, apparently the "folder" then passes the path to the file(s) dropped on the folder to the script, which in turn calls the actual application. Unfortunately, he didn't know precisely how to do this. If this, or something like this is possible, how does one do it?

Thanks in advance for any help.
 
If you're getting permissions denied, that IS a permissions error, not something else. Try "chmod 755 <pathToFile>" - that always works for me.

I'm not sure about #2 - that would require a special AppleScript to be written... and I don't get why you'd want to do that - you can just drag the file into Terminal and press Return. But if you do want to execute a program, use
do shell script "pathToFile"
to execute it in AppleScript
 
I think I found the problem:

I had "Application Package" selected as the Project Type in CW under Target Settings. Thus it was a folder (?), not an application, hence the permission denied when trying:

./myapp.app

It seems you have to use open ./myapp.app.

However, using this with the path to the input file as the argument then hitting return is the equivalent of doubleclicking the file. Not exactly what I was looking for :)

Anyway, the correct Project is just "Executable", then I get what I expect. A single execuatble file that can be used like:
./myapp arg1

I'd still like to make a dropbable parser, as I originally mentioned in Part 2 above. Any indications on how best to this are very welcomed, however, I need to spend a little more time with CW and basic things before I dig into this myself.
 
Back
Top