Jump to content

How do you run an executable located within the application?


  • Please log in to reply
1 reply to this topic

#1
Skyfluff

Skyfluff

    InsanelyMac Protégé

  • Members
  • Pip
  • 44 posts
  • Gender:Male
  • Location:Canada
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?

#2
Skyfluff

Skyfluff

    InsanelyMac Protégé

  • Members
  • Pip
  • 44 posts
  • Gender:Male
  • Location:Canada
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 :)





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

© 2014 InsanelyMac  |   News  |   Forum  |   Downloads  |   OSx86 Wiki  |   Mac Netbook  |   PHP hosting by CatN  |   Designed by Ed Gain  |   Logo by irfan  |   Privacy Policy