ok… can anyone help me here… ??
I am trying to accomplish the following:
one part of the script is examining HTML in textEdit, and searching for composer,artist,title,and album information for mp3s on the web.
It is gathering this information and then trying to access Itunes and reassign the mp3 tages to the corresponding data…
I cant seem to see how I am supposed to accomplish this when I have two repeat statements belonging to two seperate applications…
So what can I do to make this work??
thanks
-patrick
set mickeymouse to false
set donaldduck to false
set speaknmath to 0
set artistname to {}
set titlename to {}
set composername to {}
set albumname to {}
set trackmodlist to {}
tell application "iTunes"
if selection is not {} then
set sel to a reference to selection
set number_of_tracks to count items of sel
repeat with aTrack in sel
tell application "TextEdit"
activate
set allcharacters to every paragraph of document 1
log allcharacters
repeat with x in allcharacters
if x contains "<td>" and x contains "</td>" and x does not contain "<td></td>" then
set theCharacters to characters of x
log theCharacters
repeat with tmpChar in theCharacters
set tmpcharstr to (tmpChar as string)
if tmpcharstr = ">" and not donaldduck then
log tmpWord
set tmpcharstr to ""
set donaldduck to true
else if tmpcharstr = "<" and donaldduck then
set donaldduck to false
set mickeymouse to true
end if
if mickeymouse then
set tmpWord to tmpWord & return
set mickeymouse to false
end if
if donaldduck then
set tmpWord to tmpWord & tmpcharstr
end if
end repeat
if speaknmath = 0 then
if tmpWord ? "" then
set the end of artistname to tmpWord
tell application "iTunes"
set artist of aTrack to tmpWord
log "artistname " & tmpWord
-- display dialog "artistname " & tmpWord & " speaknmath: " & speaknmath
end tell
end if
end if
if speaknmath = 1 then
if tmpWord ? "" then
set the end of titlename to tmpWord
tell application "iTunes"
set name of aTrack to tmpWord
end tell
log "titlename " & tmpWord
-- display dialog "titlename " & tmpWord & " speaknmath: " & speaknmath
end if
end if
if speaknmath = 2 then
if tmpWord ? "" then
set the end of composername to tmpWord
tell application "iTunes"
set composer of aTrack to tmpWord
end tell
log "composername " & tmpWord
-- display dialog "composername " & tmpWord & " speaknmath: " & speaknmath
end if
end if
if speaknmath = 3 then
if tmpWord ? "" then
set the end of albumname to tmpWord
tell application "iTunes"
set album of aTrack to tmpWord
end tell
log "albumname " & tmpWord
-- display dialog "albumname " & tmpWord & " speaknmath: " & speaknmath
end if
end if
if speaknmath < 3 then
set speaknmath to speaknmath + 1
log "math increased " & speaknmath
else
set speaknmath to 0
end if
end if
set tmpWord to ""
end repeat
end tell
set name of aTrack to album_field
set album of aTrack to album_field
set composer of aTrack to composer_field
end repeat
end if
end tell
end repeat
end if
end tell