Page 1 of 1

Adium Robots

Posted: Sun Oct 08, 2006 6:12 pm
by nebon
Hey friends,

Arent there any robot scripts for adium ?
Has someone out there development somekind of robot for his client, that he/she could share with us ?

I´m wondering if it is possible, I have few client´s that ask me about there specific web addresses very often, and I was wondering if there was some robot solution to this ?

Posted: Tue Oct 10, 2006 6:42 pm
by sfb
Perhaps you could try an applescript.
http://adiumxtras.com/index.php?a=search&cat_id=6
You could also make your own.

Posted: Wed Oct 11, 2006 4:02 pm
by Livio
I don't think there is any (ro)BOT available at this moment. I'm working on something, but i'm stuck because the Applescript support for Adium is not good. We are missing important stuff, despite what the Adium Applescript dictionary says about the available functions. for example you can't parse the message you receive in Applescript... this means you can't do any actions based on the message content of a chat ...


Livio

Posted: Wed Oct 11, 2006 5:08 pm
by evands
The Adium dictionary never claims to let Applescript be able to parse incoming messages.

I welcome anyone interested in improving Adium's Applescript support to become involved.

Posted: Wed Oct 11, 2006 5:40 pm
by Livio
Euuhmm ...

What about : * Adium Suite > Content > plainText message

- plainText message (Unicode text) : The message of this content, in plain text (losing all formatting and embedded information).

- HTML message (Unicode text) : The message of this content, in HTML.

---------

Also this is advertised in the dictionary, but the last 2 items don't work as expected :

tell the active chat of the first interface controller
set chatternaam to chat name
set chatid to ID
set chatdatum to date opened -> doesn't work !
set chatfoto to chat image -> doesn't work !
end tell



Livio

Posted: Wed Oct 11, 2006 8:35 pm
by evands
Livio wrote:Euuhmm ...

What about : * Adium Suite > Content > plainText message

- plainText message (Unicode text) : The message of this content, in plain text (losing all formatting and embedded information).

- HTML message (Unicode text) : The message of this content, in HTML.
That's talking about existing messages in the chat, not messages as they come in; also, it's almost certainly broken in Adium 1.0 (chats are no longer keeping track of their previous chat messages, so there's no way this information is accessible) so should be removed from the dictionary unless someone is willing to fix it. So if you're using the beta, yeah, the dictionary is lying.
Also this is advertised in the dictionary, but the last 2 items don't work as expected :

tell the active chat of the first interface controller
set chatternaam to chat name
set chatid to ID
set chatdatum to date opened -> doesn't work !
set chatfoto to chat image -> doesn't work !
end tell
I've never understood setting stuff to variables in Applescript. I find that sometimes you can use objects directly but not store them to a variable. What does 'doesn't work' mean in this context?


Livio[/quote]

Posted: Wed Oct 11, 2006 8:53 pm
by Livio
I want to put the values into variables because I use the values at a later stage to log them in a Filemaker database.

That "Doesn't work" means that this part doesn't work :-) haha
I do not get any value's returned for 'chat image' and 'date opened'.


PS : Keep up the good work :)

Livio

Posted: Wed Oct 11, 2006 9:38 pm
by evands
Livio wrote:I want to put the values into variables because I use the values at a later stage to log them in a Filemaker database.
*nod* It'd definitely be good for it to work that way. I'm just saying that I've never, in a general sense (not just in Adium), been able to consistently use applescript variables. This lack of Applescripting knowledge on my part certainly doesn't help considering that I also personally implemented most of the Applescript support in Adium -- the blind leading the blind!
That "Doesn't work" means that this part doesn't work :-) haha
I do not get any value's returned for 'chat image' and 'date opened'.
So it always returns NULL? It doesn't give an error?

Posted: Thu Oct 12, 2006 3:55 am
by zaudragon
An ugly solution is to continually poll the log file.

But you don’t need Adium for a bot; just a perl script with some extra modules can do.

Posted: Thu Oct 12, 2006 10:34 am
by digumo
evands wrote:
Livio wrote:Euuhmm ...

What about : * Adium Suite > Content > plainText message

- plainText message (Unicode text) : The message of this content, in plain text (losing all formatting and embedded information).

- HTML message (Unicode text) : The message of this content, in HTML.
That's talking about existing messages in the chat, not messages as they come in; also, it's almost certainly broken in Adium 1.0 (chats are no longer keeping track of their previous chat messages, so there's no way this information is accessible) so should be removed from the dictionary unless someone is willing to fix it. So if you're using the beta, yeah, the dictionary is lying.
Also this is advertised in the dictionary, but the last 2 items don't work as expected :

tell the active chat of the first interface controller
set chatternaam to chat name
set chatid to ID
set chatdatum to date opened -> doesn't work !
set chatfoto to chat image -> doesn't work !
end tell
I've never understood setting stuff to variables in Applescript. I find that sometimes you can use objects directly but not store them to a variable. What does 'doesn't work' mean in this context?


Livio
I feel I should chime in on this one because I'm currently toying with a small solution that requires me to use and IM client to connect with FileMaker.

I've been able to get things working using 0.89.1.

It sucks to hear that 1.0 breaks things and it would be nice to find a good solution. Granted the dictionary and AS support is pretty inferior, but here's a solution that grabs the last message from the log of the active chat window.

The problem is if other windows pop up from new inbound chat sessions. You'd have to make some type of polling solution that watched to see that either no windows were open or you have to use a really bad kludge of using

Code: Select all

set visible of window "Window Name" to false
set visible of window "Window Name" to true
to make the desired window active - in order to grab the last message.

This is the script you attach to Adium's incomming message action

Code: Select all

set db to "Database Name"
tell application "FileMaker Pro Advanced"
	do script FileMaker script named "Capture Chat Message" of database db
end tell
You simply tell FileMaker to run a ScriptMaker script (which in-turn, contains AppleScript code) - I've found that Adium does not want to respond to it's own tell statements if you use them within the script that is called by Adium (is there a way to get an Adium script to compile without the tell block? - in otherwords using the code below directly within an AppleScript called by Adium)

Anyway...

Then, within your target FileMaker database you can use this code. The tell lines for FileMaker are commented out because it's self referencing.

Code: Select all

--set db to "Database Name"
set cellname to "Field Name"
-- my code assumes the field is a global field

--tell application "FileMaker Pro Advanced"
try
	--tell database db
	set data of cell named cellname of current record to getLastMessage()
	activate
	--end tell
on error
	display dialog "Can't find cell "" & cellname & "" in this database."
end try
--end tell

on getLastMessage()
	tell application "Adium"
		activate
		set chatnick to ID of the active chat of the first interface controller
		set chatcontent to plainText message of content of active chat of the first interface controller
	end tell
	return item 1 of (chatcontent)
end getLastMessage
I hope this helps out Livo and to anyone else trying to get Adium to stumble through interaction with FileMaker.

Matt Petrowsky
Editor of ISO FileMaker Magazine
http://www.filemakermagazine.com

P.S. Since adium seems to use its own handler for outbound messages (such as on substitute()) is there a way to use the same setup for inbound messages. I know you've got the plist file for watching for the keyword. Is there a way to leverage this same system? It would be easy enough to tell users to prefix their message with a specified keyword. (e.g "sfm: 123 address", where sfm: is a watched inbound message prefix that programmatically ties to an AppleScript - of course, we still have that issue of not being able to get the lastest inbound message effectivly. :sad: )

Posted: Thu Oct 12, 2006 10:43 am
by Livio
Hi Matt,

You rule :)

I'll give your example a try.

Thanks a lot !


Livio (= Lieven from SHpartners Belgium :-) )

Posted: Thu Oct 12, 2006 11:48 am
by digumo
Hey Evands,

I just opened 1.0b11 (which updated to b14). What do you say to at least staying backwards compatible with your current stable AS implementation?

I noticed the following changes

Code: Select all

0.89.1 chat object
contains contacts, contents; contained by Adium controllers.

1.0b14 chat object
contains contacts; contained by Adium controllers.
Ok, so chat windows no longer show the log of the last X items. It would still be nice if contents remained an element of a chat. The word "contents" would then be more semantically correct since it now appears that "log" was the former element from which plainText message was accessible.

Dang, I wish I knew Objective-C and writing AppleEvents/AppleScript implementations. We could really clean up the dictionary and improve support. Alas, I have a normal work routine and little time. :sad:

If anything, it would be nice to get something in the app that allowed access to the most recent inbound message. I read the thread on the "security" issues and it seems like there is no security issue when the client is in full control of what events happen and what AppleScripts they trigger.

Oh, and one feature that would be nice is an action such as "Bring window forward" as an event for things like Message received. :grin:

Posted: Thu Oct 12, 2006 1:24 pm
by Catfish_Man
[quote="digumo"]
If anything, it would be nice to get something in the app that allowed access to the most recent inbound message.:[/quote]

This seems reasonable. Next to no memory bloat, and I think we store the last 25 messages for option-up/down anyway.


I think part of the problem (or at least my problem) is that the devs know how easy it is to write filter plugins that pipe stuff to other processes, so this AS stuff feels incredibly clunky :)

Posted: Fri Oct 13, 2006 1:18 am
by digumo
Catfish_Man wrote:I think part of the problem (or at least my problem) is that the devs know how easy it is to write filter plugins that pipe stuff to other processes, so this AS stuff feels incredibly clunky :)
You've got no argument from me about how much easier it is to mix together a little shell, perl or sed/awk combos. The trick is the combination of knowledge and comfort by the person trying to do the automation.

While you and I may be comfortable throwing together various functions in a text document, it's the "availability" of AppleScript that empowers people who don't specifically view themselves as developers. There are likely more people who are "less afraid" to open an AppleScript to modify it (because of great marketing and tools by Apple) than those who will make the connection that logic is logic regardless if your "if" condition is in Perl or AppleScript.

Plus, the common perception of AppleScript is that it helps the Macintosh in being a more "automated" platform. While you can automate pretty much anything on any platform with enough know-how, AppleScript (while not as efficient as doing things within the shell or a nice fast language) brings the automation to a wider audience. Heck, I work in FileMaker, and while it can do quite a bit, it's still a toy when compared to doing things in PHP or Perl. It's the "easy factor" that makes it such a productive tool - the same with AppleScript (and now using Automator).

If you guys wanted to have open dialog about implementation, I'd love to have a topic on suggested methods. The dictionary is pretty convoluted right now. Or, from what I hear, the original AIM client had a pretty good implemention of event based triggering of AppleScripts (although I've not used it).

Matt

P.S. While writing a shell script, using sed to strip the HTML from the log burried in a specific location (using regex) may seem easy enough, simply understanding <.*?> can be quite confusing compared to "get message -1 of frontmost chat log" where (-1 would be the most recent message of a chat window when compared to the first message - which would be 1) Heck, let's get on Skype, using OmniOutliner (and or SubEtha) and revise the terminology in the AS dictionary. :razz:

Posted: Fri Oct 13, 2006 1:40 am
by bgannin
digumo wrote:Heck, let's get on Skype
Just out of curiosity, why exactly would you need to hop on Skype, given the fact that an IM client is being discussed and likely used already?

Posted: Fri Oct 13, 2006 4:55 am
by digumo
bgannin wrote:Just out of curiosity, why exactly would you need to hop on Skype, given the fact that an IM client is being discussed and likely used already?
Touché bgannin, I think, as I'm getting older in life (which is not that old - 35), that the lost art of getting to know people (especially people smarter than yourself) in a more conventional fashion, holds more value today as we become more and more disconnected because of technology. (ok, maybe a little too touchy-feely but...)

We can know people through their zeros and ones, but I'm finding that synergy is increased when you "know" the people you work with - open source or otherwise - simply because you get to know more about who they are. Don't we all like to be known for what we know, who we are and what we like? :cool:

Or stated in another way... It's just great to get to know people in a more personal manner and since it's practially free to do so - why not?

Matt

P.S. I've added my chat IDs to my profile ;)

Posted: Fri Oct 13, 2006 5:12 am
by evands
Matt, I'm a big fan of your attitude :)