Re: How to reliably target a helper app that's inside a bundle?
Re: How to reliably target a helper app that's inside a bundle?
- Subject: Re: How to reliably target a helper app that's inside a bundle?
- From: Luther Fuller <email@hidden>
- Date: Mon, 19 Oct 2009 17:26:48 -0500
On Oct 19, 2009, at 4:10 PM, Nathan Vander Wilt wrote: My main application bundles an AppleScript script and scriptable helper application.
These get bundled in the Resources folder of my main app's bundle like so:
MainApp |-Resources |-HelperApp |-script
My MainApp calls the script to do some work, and the script uses the HelperApp to offload some work that was much more efficiently done in Cocoa. The problem is that the script can't find the HelperApp when it is deployed inside of the Resources folder of MainApp.
I could get the path of my HelperApp by either passing it as an argument to the script, or using "path to me". (Is the latter reliable? I know in many contexts relying on the executable path is strongly discouraged.)
I use this, for example, to get resources. Haven't had any problems.
set selfRef to (path to me) tell application "Finder" (folder menuFolderName of folder "Menu" of folder "Resources" of folder "Contents" of selfRef) -- internal empty folder with icon set menuFolder to the result as alias
I also have helper applications in the main application's /Contents/Resources/ folder. They are used to call special handler's within the main application. I use this in the helper application ...
on run tell application "Finder" to set hostAppl to (container of container of container of (path to me)) as text ignoring application responses try launch application hostAppl tell application hostAppl to handlerName()
But with either of those solutions I would need to implement this by replacing all occurrences of: tell "HelperApp" -- instructions end tell
with: global theHelperApp set theHelperApp to application path "..."
tell theHelperApp using terms from "HelperApp" -- instructions end using terms end tell
My worry with doing this is that this still won't help osacompile find "HelperApp" during script compilation. How can I be sure that my script will always compile to the most current HelperApp's scripting definition? Is there a better way to approach this?
I compile all my stuff with this ... Freeware. I wrote it just so I could compile complicated application bundles.
|
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden