Help with QuickTime Player Script wanted...

I’m trying to create a script that will play a small audio track whenever I start my Mac.

So far I’ve written this:

Doesn’t seem to work though.

Can anyone help?

Thanks!

Hi,

try this


set theFile to ((path to home folder as text) & "Hal 9000 Bits:Sounds:I'm completly operational....mov")
tell application "QuickTime Player"
	activate
	open theFile
	play document 1
end tell

Thanks so much Stefan.

A couple of questions:

Is it possble to run the script so that the sound plays but the program window doesn’t appear? Also how can I make it quit after it plays the sound? I tried putting an extra line or so in saying this, but then it just opened and quite straight away.

Thanks.

To play a single sound I recommend PlaySound, which is also scriptable

Stefan…

I’ve just cracked the quit element. the script now reads:

So I just need to know how to hide the program window. Also, I’m assuming that if I save this as an application, making it a startup item will mean that it will play whenever the computer starts. Is there a way of making it the first thing the computer does after booting?

Thanks.

You might be better off using the Play Sound application suggested earlier so that no program window or UI elements appear when the audio file plays. You could write a script like this one, save it as an application and add it to your login items:

tell application "Play Sound"
	launch
	play ((path to home folder as text) & "Hal 9000 Bits:Sounds:I'm completly operational....mov")
	quit
end tell

But you wouldn’t even need to do that much. You could simply right-click or Control-click on the .mov file, select Get Info, and set the file to Open with > Play Sound. And then add the file to your login items.

You might do a Google search for “reorder login items” without the quotes. Some of the search results seem to indicate that it’s possible, although I haven’t tried any of these methods myself.

Good luck.

Browser: Safari 525.27.1
Operating System: Mac OS X (10.4)