new guy needs help

I am trying to learn come pretty basic stuff about programing and scripts. I need to know very basic functions. Right now I want to have a script that will open iTunes and start playing it automatically at a specified location. I also wanted to find a script that would automatically open ichat and connect with a specific user though isight. Can anyone give me some basic commands. Thanks for any help.

sebonedoc,

When you open Script Editor you can get the dictionaries for various programs by going to File>>Open Dictionary… . You then navigate to the program you want, such as iTunes, and it will open that app’s dictionary which has commands and elements that can be used by AppleScript. The basic code for opening iTunes would be:

tell application "iTunes"
	activate
	-- other operations here. The two dashes indicate that this line is a comment.
end tell

Unfortunately I don’t script iTunes or iChat so someone else will have to help with the specifics but there is a command in the iTunes dictionary

so what you want is probably possible. This should get you started.

Other dictionaries that are important are the “Finder” and “Script Editor” itself. Make sure you check these out.

PreTech

Thanks. I figured out how to open it and het it to play from the begining. It would be nice to make it open in another specific spot, rahe then just he begning. Here is what I have:

tell application "iTunes"
	activate
end tell
tell application "iTunes"
	play
end tell

bonedoc, I’m sure exactly what you’re trying to do, but you can try something like this:

tell application "iTunes"
	activate
	
	play
	set player position to 30 -- time in seconds from beginning of track
end tell

Be sure to check out “Standard Additions” too.

I was actually wanting to start on a specific album, not 30 seconds into the song. Do you know how to do that? Thanks for the help!

I’ll assume you’re talking about the [main] Library playlist, because you didn’t specify anything else.

tell application "iTunes"
	activate
	play (first track of library playlist 1 whose enabled is true and album is "Your Album Name")
end tell

I know that is simple, but it is so cool! One weird thing…When I do this for a movie I have in iTunes, it only plays the sound, with no pic. It there a way to show the video too. Or is there a way to just access this through QuickTime Player?
Thanks again!

Video works fine for me. (iTunes 6.0.1, Mac OS 10.4.3)

Well, this is how you can start playing any song of a playlist

play track “anger below” of playlist “library”

but, how do you play an artist? If i use this, it doesnt work

play artist “garth brooks” of playlist library

“Play” will accept either a track or a playlist. Arist is a property of a track.

Can you just change the script I mentioned earlier?

tell application "iTunes"
	activate
	play (first track of library playlist 1 whose enabled is true and artist is "Garth Brooks")
end tell

Worked great! Thanks!