Script to launch a hidden app on a CD

Hi,

I have searched long and hard for solution to this so I hope you can help.
This is my first attempt at apple script so I’m not sure if what I am trying to do is possible.

I am building a CD that has a number of hidden files on it, including mPlayer/Flash applications.
I have compiled a small script then saved it as an application. The user then double clicks this script to launch one of the hidden applications (hidden using Toast’s “Invisible” option) on the CD.

It works perfectly on the computer on which it was written (PowerPC/10.4) but fails to run on my other Mac (PowerPC/10.3)
where I get the following message:

An error of type -10814 has occurred.

I have tried various methods including calling the application name (which failed on the originating Mac once the CD was burnt), the application creator code and the bundle identifier. I settled on the latter.

Here is the code that I am currently using:


tell application "Finder" to open application file id "com.screentime.mProjector.mPlayer-995483581"

I have also tried this:


tell application "Finder" to set appName to name of application file id "com.screentime.mProjector.mPlayer-995483581" as string
launch application appName

What am I missing?

Model: Dual 1.25 G4 PowerPC
AppleScript: Editor 2.1.2 (81) / Script 1.10.7
Browser: Camino 1.6.1
Operating System: Mac OS X (10.4)

Try using the full path:

tell application "Finder" to set appName to posix file "/path/to/com.screentime.mProjector.mPlayer-995483581" as alias
launch application appName

It’s from Launch Services; the translation is “no application claims this file.” You’d get it in response to a request to open a file in its default application. Try using the default application to open the file instead of the Finder. The code is translated to -10814 No application in the Launch Services database matches the input criteria. Make sure that through viewing the info for the file, it has the correct default program listed to open it. Can’t seem to find much on this error except that the devs have a few posts relating to the error being a database issue within the older OS.

Many thanks for the replies but I couldn’t get either option to work.

Cwtnospam,
When using the full path option the script changes when compiled. Then when I run it I get the following error message:

Can’t make file “:Volumes:MCC:com.screentime.mProjector.mPlayer-995483581” of application “Finder” into type alias.

Sobox,
The item I’m trying to launch is a self contained application (mPlayer app) that runs an interactive animation so there is no need for any application to be associated with it. So in that context the statement “No application claims this file” would be correct.

Could 10.3 be incorrectly identifying this as a simple file instead of an app or is it my coding?
Another question that now worries me is, is all this compatible with 10.5!!!?


Model: Dual 1.25 G4 PowerPC
AppleScript: Editor 2.1.2 (81) / Script 1.10.7
Browser: Camino 1.6.1
Operating System: Mac OS X (10.4)

Hi,

try to use the shell


do shell script "/usr/bin/open -a /Volumes/MCC/com.screentime.mProjector.mPlayer-995483581"

Stefan,

It worked like a charm!

Had to go back to using the .app name instead of the bundle identifier but that’s no problem when using the full path in the code.

Thanks again for all the suggestions - now if only I could get it to autorun, PC style! :wink:

Rozza


Model: Dual 1.25 G4 PowerPC
AppleScript: Editor 2.1.2 (81) / Script 1.10.7
Browser: Camino 1.6.1
Operating System: Mac OS X (10.4)

Got worms?
That’s a big security issue.