Applescript Bugs - 'my status'

An instant messenger which can connect to AIM, GTalk, Jabber, ICQ, and more.
Post Reply
Demon
Harmless
Posts: 6
Joined: Wed May 04, 2005 9:01 am

Applescript Bugs - 'my status'

Post by Demon »

Bug Description: Adium incorrectly defines the current status returned by "my status" and incorrectly sets "my status message"

I realize that there is a note in the Applescript Dictionary that says the status is not completely implemented, but the behavior has changed from version .77 to .80. I used the following script with .77 to toggle my away message on and off, but it no longer works with .80:

Code: Select all

on run
	tell application "Adium"
		if my status is idle then
			set my status message to "away"
		else
			set my status to available
		end if
	end tell
end run
Currently, if Adium shows the current status as Available, "my status" returns 'away' (previously, it returned 'idle', so I assume you are 'available' for less than a second and are then considered 'idle' even if it doesn't appear that way for 10 minutes). Any status other than Available now returns 'away and idle'. In .80, the line "set my status message to..." now makes it a custom Available message, rather than an Away message, so just changing the IF statement isn't enough to fix the script.

Is it possible to change the script temporarily so that it works the way I want until the Applescript issues are fixed? If so, what do I need to change?
neologism
Harmless
Posts: 6
Joined: Tue Dec 14, 2004 12:16 am
Location: College Station, TX

Post by neologism »

Applescript is indeed acting up. As someone pointed out to me in an email,

Code: Select all

tell application "Adium"
	return my status
end tell
-- always returns "away" or "away and idle"
This means bad things happen when one tries to judge the status based on that method. It looks like there is a workaround:

Code: Select all

tell application "Adium"
    return (status of every account contains away) or (status of every account contains away and idle)
end tell
That will return true if you're away & idle or just away, and false if you're available/offline/whatever. It can be modified easily.
Demon
Harmless
Posts: 6
Joined: Wed May 04, 2005 9:01 am

Post by Demon »

neologism wrote:

Code: Select all

tell application "Adium"
	return my status
end tell
-- always returns "away" or "away and idle"
This means bad things happen when one tries to judge the status based on that method. It looks like there is a workaround:

Code: Select all

tell application "Adium"
    return (status of every account contains away) or (status of every account contains away and idle)
end tell
That will return true if you're away & idle or just away, and false if you're available/offline/whatever.
Won't that just always return true since status always returns "away" or "away and idle"? Does the behavior for 'my status' differ from the behavior for 'status' of 'account'?
Demon
Harmless
Posts: 6
Joined: Wed May 04, 2005 9:01 am

Post by Demon »

Update: I figured out a fix myself, but I'll post it in case anyone else wants it.

The behavior for 'status' of 'account' DOES differ from the behavior for 'my status'. 'status' of 'account' does function correctly, while 'my status' currently does not. To toggle the status from 'available' to 'away', you can do the following:

Code: Select all

tell application "Adium"
	if status of every account contains available then
		set my status to away
		set my status message to theMsg
	else
		set my status to available
		set my status message to ""
	end if
end tell
Note: The green/red/yellow status bubble at the top of the Contact List will be INCORRECTLY colored after you have used Applescript to change your status (it won't change colors). However, your status will in fact be set correctly - if you have your own screenname in your Contacts, you can see that your status color does change correctly there, and if you have 'Display status window when away' enabled in the Status preferences, that window will also appear and disappear properly.

Thanks for the tip, neologism.
Post Reply