LSOpenFSRef problems


I work in a school that has macs. Our network manager is ex pc and has very little knowledge of code. Me even less.

Could you please help a novice with workflow. I am sure this will take you less than 60 seconds.

Could you explain procedure and supply code snippet so that I can associate the opening of a text document with the opening of an application.

I know that I have to use this from reading the web but I don;t know how:


Sorry for being so think - but this is all new to me.

You can use this code:

tell application "Finder" to open alias "path:to:file.txt" using application file id ""

This should open the specified file using Apple’s TextEdit. If it’s a different application, simply guess it’s CFBundleIdentifier or CFBundleSignature (ie, “” for Safari, “com.transtex.texeditplus” for Tex-Edit Plus, etc.).
If you wish the changes being applied globally, the fast way is using Finder’s Info window, then Open-using, then choose the app from the popup, then click change-all.
And, if you wish this being done programmatically, ask again :smiley:

Hi Again

Please inform where I am going wrong

tell application “i movie hd” to open alias “/fun.txt” using application file id “”

Compiler says /fun.text not found.

Please excuse neophyte

No. You allways “tell” to the Finder to open [given file] using [specified application]. So, if you wish a .rtf file (using a POSIX path specification instead of an “alias”) using Word, it would be something as:

tell app "Finder" to open ("/fun.txt" as posix file) using application file id ""

Now what do I do with the script?


If you’re talking about Automator, I don’t know. Perhaps you could open a new thread asking specifically about Automator and this issue.

Sorry I am probably not being clear enough

I want to be able to click on an application icon and the script to run.

Sorry if this as a wild goose chase

Promise this is my only post until I start reading some books on programming

Just copy-paste the code into a Script Editor’s window (“/Applications/AppleScript/Script”), and click the green button with the rigth arrow. If you wish a double-clickable application, just save as application (from the Script Editor itself).

Not exatly what I want. But the help is appreciated

I want to open an application = say Imovie - and the script to open also in front.

Its so I can leave messages about file saving etc which the children will see when they open an application


Well, then it’s now time to explain what you really need. If I understand, you are trying to show a message (instructions or whatever) every time someone opens a given app (ie, iMovie) → ?

Yes that is exactly what I want to achieve. Sorry for my garbbled thoughts.

OK. Then, my advice would be create an app called “Launch iMovie” which both functions: show the message, launch iMovie. To launch iMovie:

launch application "iMovie HD"

To show the message, you can use the code above (that is, opening a .rtf file using a given app). Depending on the nature of the message, you can use a simple “display dialog”. Eg:

display dialog "Welcome to iMovie!" & return & return & ¬
	"Blah blah blah blah blah blah blah blah blah blah" & ¬
	"blah blah blah blah blah blah blah blah blah blah" & ¬
	"blah blah blah blah blah blah blah." & return & return & ¬
	"Click OK to continue..." with icon 1

launch application "iMovie HD"

And, depending on your coding skills, you could quickly setup a little AppleScript Studio application displaying the .rtf file (no need of using Word nor a third-party app), then launching later iMovie HD. Ie: