How to Reference Command Line Tool in AppleScript App Bundle

Hi there-
First post here, but I’ve learned a lot over the last few months by reading everything you all have to offer.

I am working on an app (just for me personally…I have no intent to distribute this except among my various computers.) The app is a basic program to go through my footage (I’m a cinematographer) and pull out stills at set intervals. After a lot of work, I’ve got it working like I need which feels great. One little detail I’d love to solve with your help though is how to include and reference the command line tools I’m using in the app bundle. I’m using three command line tools (ffMpeg, exiftool and redline) using a fairly simple do shell script command in the App Delegate. So right now it’s just a standard shell script in the AppleScript which is finding the command line tools on my computer. Is there anyway in ASObjC to include the CLIs in the app so that I don’t have to worry about separately installing each of the three tools on every computer I use?

I’ve done a little research and it seems like it maybe has something to do with the ASObjC equivalent of “path to me” but I’m pretty stumped. Thanks so much for any help!
Best,

-Harry

Look up NSBundle. If you put the tools in your app’s Resources folder, something like:

set thePath to current application's NSBundle's mainBundle()'s pathForResource:"exiftool" ofType:""

or pre-Mavericks:

set thePath to current application's NSBundle's mainBundle()'s pathForResource_ofType_("exiftool", "")

Hello.

I am curious as to whether you can distribute a bundle with command-line tools in the resources folder or not.

I guess you can code sign it and distribute it to users directly.

What’s the verdict?

Thanks.

Build a sample, and run:

spctl --verbose=4 --assess --type execute path/to/new_app

Then you can tell us :wink:

Hello.

Thanks for the one-liner!

I’ll actually, eventually start such a project by executing that very one liner after I have stuffed the bundle, and before going much further. But not before, if it happens. I was just curious. :slight_smile:

FWIW, I remembered I’ve done an app that embeds exiftool. It’s code-signed, and it seems to be fine as far as Gatekeeper is concerned.

Hello. I have to figure it out should that be a way to go. I also think there is a difference between code signing, and distribution through the Appstore. I guess the ultimate way of figuring that out, is to validate the project from within Xcode for starters. (I can’t remember TextWrangler downloading the command line tools last time.)

There is – the App store involves sandboxing, which is something different entirely (as well as code-signing).