Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

podium06

macrumors newbie
Original poster
Nov 12, 2009
8
0
hi all,
I'm new to apple script. i'm trying to write a simple script to get ichat to close a window that always open after i log in to Jabber.

so far i managed to do this line that close the window

tell application "iChat" to close window "msn.jabber.meta.net.nz"

the problem is that the window opens some time after the login is finished so if i choose to run it when login finished i get an error from ichat.

so i tried to do a loop with many variations but nothing helped.
this is the latest version i come up with (it is probably wrong in so many ways as i'm not really used for the applescript syntax)

tell application "iChat"
if (login finished for "msn.jabber.meta.net.nz") then
tell application "iChat" to close window "msn.jabber.meta.net.nz"
end if

end tell


can someone help me and point me to the right direction??

thanks in advance for your time.
 
Try playing around with this. If you were to attach a keyboard shortcut to run this script, any time the window opens, press the chosen hotkey.

tell application "iChat"
if window "msn.jabber.meta.net.nz" exists then
close window "msn.jabber.meta.net.nz"
else
beep
end if
end tell
 
thanks

thanks for your replay,
but i really want it to run automatically.
otherwise i can just click the close button of that window.

i made up this new script (which also works from applescript).
this makes me think it might be a problem with ichat running the script...
might be that you need to add a special command at the beginning....

delay 5
tell application "iChat"
if window "msn.jabber.meta.net.nz" exists then
close window "msn.jabber.meta.net.nz"
else
delay 10
end if
end tell
tell application "iChat"
if window "msn.jabber.meta.net.nz" exists then
close window "msn.jabber.meta.net.nz"
else
beep
end if
end tell
 
another thing

well i might be a different problem altogether.
i just now tried to run a scrip from apple that came with ichat and i recive the same error...

strange...
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.