Prevent "Where is ASObjC Runner-N?" prompt?

I’ve written an application bundle that uses Shane Stanley’s terrific ASObjC Runner, embedded in the Resources folder of the bundle as ASObjC Runner-N.app.

When I first run the script on another machine, it asks me where ASObjC Runner-N is, even though I’ve followed this procedure as specified on Shane’s site:

using terms from application "ASObjC Runner" -- needed to compile script
 property runnerPath : ""
 -- get path to bundled copy, in this case directly in the Resources folder
 set runnerPath to (path to resource "ASObjC Runner-N.app") as text
end using terms from

Is there any way to prevent that prompt from appearing? I don’t mind it for myself, but I want to distribute the script to other people who will be puzzled by this behavior.

Thanks for any help.

Try to edit the beginning this way :

using terms from application “ASObjC Runner” – needed to compile script
property runnerPath : “”
– get path to bundled copy, in this case directly in the Resources folder

set mySelf to path to me as text # ADDED
if runnerPath does not start with mySelf then set runnerPath to "" # ADDED
set runnerPath to (path to resource "ASObjC Runner-N.app") as text

This way, if the hosting machine is not the one upon which the script was used once, the property runnerPath will be reset to a nil string and I assume that all will behave flawlessly.

I wish to ask a question to Shane which will certainly read this thread.

Is it normal that Script Editor freeze when we run the applet when the embedded script is open in the Editor ?
It’s not really annoying but I was surprised when I got this behavior.

Yvan KOENIG (VALLAURIS, France) lundi 3 février 2014 19:14:23

That seems to work, Yvan. Thank you. Of course there is no way to suppress the prompt that says that ASObjC Runner-N was downloaded from the Internet, but users are familiar with that. Thank you again.

It shouldn’t happen, but I’ve had a few reports of the problem, so that’s no help. About the only thing I can suggest is that after you get runnerPath you tell the Finder or System Events to open file runnerPath. And let me know if that solves the problem.

Edit: Ah, I see Yvan has solved the problem already.

Yes, it is. When you pass a script object, it gets sent as a single Apple event. That makes it run faster, but it also makes things unresponsive for the duration.