Jump to content
Welcome to InsanelyMac Forum

Register now to gain access to all of our features. Once registered and logged in, you will be able to contribute to this site by submitting your own content or replying to existing content. You'll be able to customize your profile, receive reputation points as a reward for submitting content, while also communicating with other members via your own private inbox, plus much more! This message will be removed once you have signed in.

  • Announcements

    • Allan

      Forum Rules   04/13/2018

      Hello folks! As some things are being fixed, we'll keep you updated. Per hour the Forum Rules don't have a dedicated "Tab", so here is the place that we have our Rules back. New Users Lounge > [READ] - InsanelyMac Forum Rules - The InsanelyMac Staff Team. 
Skyfluff

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?

Share this post


Link to post
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 :)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


  • Recently Browsing   0 members

    No registered users viewing this page.

×