[req] finish this script to hide messages when away

An instant messenger which can connect to AIM, GTalk, Jabber, ICQ, and more.
Post Reply
trashrockx
Harmless
Posts: 2
Joined: Wed Apr 02, 2008 4:50 am

[req] finish this script to hide messages when away

Post by trashrockx »

So I searched on here for a way to hide messages when set to away, WITHOUT having to hide all of adium...needless to say it isn't possible yet, but I came across this script someone did (im sorry I forgot who :\ ) and it's not exactly working, but its a pretty good start.

Code: Select all

tell application "Adium"
   if my status is away or (my status is away and idle) then
      set mywindows to windows
      repeat with i from 1 to number of items in mywindows
         set awindow to item i of windows
         if (name of item i of windows as string is not "Contacts") then
            set miniaturized of item i of windows to true
         end if
      end repeat
   end if
end tell
Noone replied to him to say if the code is terrible or almost there or anything, and it was an old thread, so I'm resubmitting it for evaluation kinda, cause I would really like that functionality. Can anyone say if this is a possibility? Or just tell me it won't work and why please?
Thanks
mtimmsj
Frappa
Posts: 144
Joined: Wed Jun 08, 2005 6:55 pm
Location: Olympia, WA

Re: [req] finish this script to hide messages when away

Post by mtimmsj »

So basically you want a script that you can invoke in some way that minimizes or hides all the windows except the contact window? This request is complicated by the fact that statuses are dependent on the account. You can have multiple accounts online and have different statuses for each account.

To remove some of this complication you can simply look at the status type of the account of the active chat.

This should work:

Code: Select all

tell application "Adium"
  if status type of account of the active chat is away then
    tell chat windows to set minimized to true
  end if
end tell
trashrockx
Harmless
Posts: 2
Joined: Wed Apr 02, 2008 4:50 am

Re: [req] finish this script to hide messages when away

Post by trashrockx »

that works great! thanx...unfortunately can't hide JUST the message window b/c if you change the script to set hide true then it hides everything but this is perfect. thank you.
mtimmsj
Frappa
Posts: 144
Joined: Wed Jun 08, 2005 6:55 pm
Location: Olympia, WA

Re: [req] finish this script to hide messages when away

Post by mtimmsj »

One minor variation so that you can get even the preferences window to minimize if it's open:

Code: Select all

tell application "Adium"
  if status type of account of the active chat is away then
    repeat with oneWindow in windows
      if name of oneWindow is not "Contacts" and name of oneWindow is not "" then
        tell oneWindow to set minimized to true
      end if
    end repeat
  end if
end tell
If you forget to exclude windows with empty names, all kinds of weirdness happens. :D
Post Reply