i wrote an applescript app in xcode using the follwing applescript. When i compiled the app, the script didn’t run. I’d like this script to run once every 10 seconds or so. Do you know what i did wrong?
tell application "Finder"
set x to name of every process
end tell
if ("Adium" is in x) then
if ("iTunes" is in x) then
tell application "iTunes"
set playerState to player state
if playerState is playing then
set theTrack to current track
set theName to name of theTrack
set theArtist to artist of theTrack
set theStatus to "I'm listening to " & theName & " - " & theArtist as string
try
set theArt to (data of artwork 1 of theTrack)
end try
else
set theStatus to "Paused"
end if
end tell
tell application "Adium"
if my status is away and idle then
set my status message to theStatus
try
set file_name to ":tmp:artwork2avatar.pict" as string
try
do shell script "rm /tmp/artwork2avatar.pict"
end try
open for access file_name write permission 1
copy the result to file_reference
write theArt starting at 0 to file_reference as picture
close access file_reference
set theImage to open for access file file_name without write permission
set ImageData to read theImage as TIFF picture
set image of every account to ImageData
close access theImage
end try
end if
if my status is not away and idle then
try
set file_name to ":tmp:artwork2avatar.pict" as string
try
do shell script "rm /tmp/artwork2avatar.pict"
end try
open for access file_name write permission 1
copy the result to file_reference
write theArt starting at 0 to file_reference as picture
close access file_reference
set theImage to open for access file file_name without write permission
set ImageData to read theImage as TIFF picture
set image of every account to ImageData
close access theImage
end try
end if
end tell
end if
end if