Did you try it with a song playing in iTunes? The current song needs to have iTunes running and a song currently selected. I currently have a very similar script under construction that works for the data you are calling, but I have not got the section of my script that deals with inserting the artwork going. The script I supplied you works perfectly in that application. Do you have your fields set as NSTextFields? Are they set editable in the options? Did you try running the script in AS outside XCode?
Here is a copy of the similar script I am doing. Perhaps you can spot an error in yours. Ignore the artwork bits of the script.
on clicked theObject
if name of theObject is "Button" then
using terms from application "iTunes"
tell application "iTunes"
if exists (database ID of current track) then
set cur_song to the name of the current track as string
set cur_artist to the artist of the current track as string
--if exists then
--set artworkData to artwork of the current track
--end if
else
set cur_song to ""
set cur_artist to "No song currently playing."
end if
end tell
end using terms from
set the contents of text field "title" of window "tunecommand" to cur_song
set the contents of text field "artist" of window "tunecommand" to cur_artist
--set the contents of image "artworkData" of window "tunecommand" to artworkData Ignore the next section
else
using terms from application "iTunes"
tell application "iTunes"
if exists (database ID of current track) then
set artworkData to artwork of the current track
else
set artworkData to ""
end if
end tell
end using terms from
end if
end clicked
On 29/09/2006, at 8:50 AM, Emory Dunn wrote:
Well, that did not work. Script Editor is just not getting the fact that they whole script is correct, its just being fussy about something.
On Sep 28, 2006, at 8:06 AM, Peter Baxter wrote:
Hi Emory.
Your script is OK, but should read
on clicked theObject
using terms from application "iTunes"
tell application "iTunes"
if exists (database ID of current track) then
set cur_song to the name of the current track as string
set cur_artist to the artist of the current track as string
else
set cur_song to ""
set cur_artist to "No song currently playing."
end if
end tell
end using terms from
--delete tell window "tunecommand"
set the contents of text field "title" of window "tunecommand" to cur_song
set the contents of text field "artist" of window "tunecommand" to cur_artist
--delete end tell
end clicked
On 28/09/2006, at 3:17 PM, Emory Dunn wrote:
I am new to Applscript studio and am writing a basic iTunes controller. I have got most of it working but I can not set the track name and artist info. I have looked at several places for help- the XCode documentation and other websites and as far as I can tell am doing everything correctly but whenever I try and save the .scpt file it says A “ can't go after this identifier. the script I have written is as follows: the problem areas in red.
using terms from application "iTunes"
tell application "iTunes"
if exists (database ID of current track) then
set cur_song to the name of the current track
set cur_artist to the artist of the current track
else
set cur_song to ""
set cur_artist to "No song currently playing."
end if
end tell
end using terms from
tell window "tunecommand"
set the contents of text field "title" to cur_song
set the contents of text field "artist" to cur_artist
end tell
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Help/Unsubscribe/Update your Subscription: