Hi, so i'm sure you're all sick of these type of requests. I am trying to make an applescript for adium to promote something to everyone in my contact list. But before you judge horribly, I want it to only message each person once! Almost as if i were to msg them myself! So i've made this script (as i'm a real newbie in applescript) but it doesn't work: Can anyone see the errors? :/
tell application "Adium"
activate
tell application "Adium"
set the_file to "/Users/craaig/windzo.txt"
-- opens the txt file and reads off the list of windows already messaged
set foo to (open for access (POSIX file the_file))
set oldwindows_txt to (read foo for (get eof foo))
set oldwindows to every paragraph of oldwindows_txt
close access foo
-- compares the list from the file and the current open windows
-- if anyone new appears, it puts it into an array.
set currentwindows to id of every chat
repeat with x from 1 to count of items of currentwindows
set n to item x of currentwindows
if n is not in oldwindows then set end of peoples to n
end repeat
set loopbacktofile_list to oldwindows & peoples
set loopbacktofile to (loopbacktofile_list) as text
open for access the_file with write permission
set eof of the_file to 0
write (loopbacktofile) to the_file starting at eof
close access the_file
-- sending messages
repeat with x from 1 to count of items of peoples
set n to item x of peoples
send (first chat whose id is (n)) message ("test" as Unicode text)
end repeat
end tell
end tell
Any help would be greatly appreciated!!
tell application "Adium"
activate
tell application "Adium"
set the_file to "/Users/craaig/windzo.txt"
-- opens the txt file and reads off the list of windows already messaged
set foo to (open for access (POSIX file the_file))
set oldwindows_txt to (read foo for (get eof foo))
set oldwindows to every paragraph of oldwindows_txt
close access foo
-- compares the list from the file and the current open windows
-- if anyone new appears, it puts it into an array.
set currentwindows to id of every chat
repeat with x from 1 to count of items of currentwindows
set n to item x of currentwindows
if n is not in oldwindows then set end of peoples to n
end repeat
set loopbacktofile_list to oldwindows & peoples
set loopbacktofile to (loopbacktofile_list) as text
open for access the_file with write permission
set eof of the_file to 0
write (loopbacktofile) to the_file starting at eof
close access the_file
-- sending messages
repeat with x from 1 to count of items of peoples
set n to item x of peoples
send (first chat whose id is (n)) message ("test" as Unicode text)
end repeat
end tell
end tell
Any help would be greatly appreciated!!