Help for an Xtra
Posted: Mon May 09, 2005 1:57 am
I made this and I'm sure I made an obvious error somewhere, but it doesn't work...
The goal of this Xtra is to send the current iTunes playing song (zipped to make it lighter).
The goal of this Xtra is to send the current iTunes playing song (zipped to make it lighter).
Code: Select all
on substitute()
try
-- Is iTunes playing?
tell application "System Events"
set iTunes to ((application processes whose (name is equal to "iTunes")) count)
end tell
if iTunes is not greater than 0 then
display dialog "iTunes' not playing!" buttons {"Ok"} default button 1
return ""
end if
-- It IS playing, getting the track location (if any playing)
tell application "iTunes"
if the name of the current track is missing value then
display dialog "No tune playing!" buttons {"Ok"} default button 1
return ""
end if
set filepath to the location of the current track
set trackname to the name of the current track
end tell
-- Zip It!
do shell script "ditto -c -k " & filepath & " ~/Desktop" & trackname & ".zip"
set tmppath to "~/Desktop" & trackname & ".zip"
-- Ok, now we send it!
tell application "Adium"
tell active chat
set buddy to ID
end tell
send (first chat whose ID is buddy) file tmppath
end tell
end try
end substitute