script run using osascript gives /usr/bin/osascript for 'me'

I found that if I run a script saved as an application using the osascript command line utility the script runs much faster than if it is run by double clicking it. Running it from the command line will basically make it run as fast as the computer will allow whereas double clicking on a script leaves a lot of unused cpu time. The results vary on what the script is trying to do of course.

However when I run the script using osascript, the “path to me” command returns ‘/usr/bin/osascript’ as the location of the script, which is quite annoying. Is there any other way of finding out the location of the script file that is being run.

Kevin

You will run the script much faster invoking “run script alias whatever” or using osascript than running it via double-click from an applet/droplet.
About the “path to me” stuff, when you run a script from a third-party utility (script editor, script menu of some app or osascript), it returns the path to the guy who is running the script (just now “osascript”), because you are not running the script, but telling someone to do it.
Perhaps you should send your location (path to me) using another way, eg, writing a file with your location in the temp folder, or in a pref file which the “runned” script can read.
Or, more complex, osacompile your (path to me) plus osascript (path to script to run), then osascript osacompiled-script…

Cheers :wink: