Jump to content

How do you run an executable located within the application?


2 posts in this topic

Recommended Posts

Alrighty. So I have my main application. It works fine, no problems there. However, I have an application that runs in shell with arguments. It's actually a graphics test utility that Apple provides. To run it, you can drag it into terminal and add your arguments after the path.

 

I decided to create an executable with my desired arguments already built in, so I now have my main application executable, as well as the secondary executable (this file is called, "Vertex"). I want to assign a button in the interface builder to launch the executable. That's all I want to do, but for the life of me I can't figure this out.

 

I'm pretty new to xcode so you'll have to bear with me. It's an applescript application and I'm assuming I can't launch this file through Applescript alone. However, I do need it to run from the application's resource directory regardless of where the user installs the application.

 

Any thoughts?

Link to comment
Share on other sites

I figured it out, in case anyone is curious.

 

on clicked theObject
display dialog "Are you SURE?  This test could have a seriously adverse affect on your computer, and may render it unusable while it is running." buttons ["Cancel", "Continue"] with icon "what"
tell application "Finder" to set myFolder to (container of (path to me)) as string
do shell script "echo " & quoted form of POSIX path of myFolder
do shell script quoted form of POSIX path of myFolder & "myappname.app/Contents/Resources/vertex"
end clicked

 

I then added my arguments after vertex and it worked perfectly :)

Link to comment
Share on other sites

 Share

×
×
  • Create New...