New to appleScript and can't find what I need!!


I’m brand new to appleScript and I have been searching high and low for some scripts I can use for a CD Rom project. The project is a flash projector which will be PC and MAC compatible. What I need to complete the project is some appleScripts that will launch various applications from the Flash Projector file the same as a .bat file does from a pc.
I need to launch email software, the default browser to open web links and pdf files in their own application (ie adobe reader). Is there anyone out there that can let me know what scripts to use or at least point me to a location with such scripts. In theory they look like very simple scripts but I have yet to find one that works.

Any help appreciated.


Post the exact sequence of events you want to happen, in order, including files launched/opened and their locations when the CD is inserted. More details is key here.

Ok you asked for it!!!

Apps that need to be opened.

PDF files with adobe reader
web urls with default browser
email links with email software populating the subject field and email address field.

There are a number of these located at different areas within the flash movie.

So far I have managed to make the CD a hybrid so it works both on PC and the Mac with seperate autorun files opening one main swf file. So no problems there.

I’ve been given some code that would appear to work but does not.

–set the name of the file to open
property fileName : “homepage.html”
–get the path to the containing folder
set myPath to (path to me as string)
set AppleScript’s text item delimiters to “:”
set the parentFolder to ¬
((text items 1 thru -2 of myPath) & “”) as string
set AppleScript’s text item delimiters to “”
– find the flash file
set targetFile to alias (the parentFolder & fileName)
on error
–ie if there’s no file here by this name, it will quit.
return quit
end try
– open the file
tell application “Finder”
open file targetFile
end tell

This seems like it will only work for files and not for launching email software or a full url into a web browser.

The way it has been suggested to me is to use flash to decide what system it is on PC or Mac then launch either the .bat file for the PC or the appleScript file for the Mac. I have the code for this and it works fine.

With the appleScript this is the sequence of events:

For email: The CD user will click an email link which will then action the appleScript. This will launch the Macs default email software and populate it with a subject title and the email address it will be sent to. This will be specified in the appleScript file and I will produce a file for each email address.

For the PDF’s: a user will click a link to the pdf file which will action the actionScript which will launch the pdf in Adobe reader. Again as above their are several different pdf files so an appleScript file could be produced for each seperate file name.

For the urls: This will be a simple link which again actions the appleScript to launch the default web browser on the mac system.

The files for the pdf’s are all held in folders within the fscommand folder depending on what pdfs they are i.e. general (folder) products (folder) etc.

All the files for executing the apps on the PC are also held in the fscommand folder also and the appleScripts will need to be held there as well.

Hopefully you can see how it’s now set up.