Scripting Adium
Posted: Mon Mar 27, 2006 2:36 am
I'm trying to write a script which will return a html encoded link. However, it just returns the html and sends that. I looked in the dictionary and i know i should be using send (in conjunction with message, which allows HTML encoded messages to be sent). However... im not sure how to say 'send to the current chat'
can anyone help?
Current code:
Thanks
can anyone help?
Current code:
Code: Select all
on substitute(card)
set theResult to {"http://gatherer.wizards.com/gathererlookup.asp?name=" & encodept1(card) & "&x=0&y=0"}
tell application "Adium"
display dialog theResult buttons {"Cancel", "Ok"}
end tell
set theLink to "<a href='" & theResult & "'>" & card & "</a>"
tell application "Adium"
--send this message theLink
end tell
return theLink
end substitute
on encodept1(str)
set encoded to ""
repeat with i in str
set j to i as text
set encoded to {encoded & encode(j)}
end repeat
return encoded
end encodept1
on encode(chara)
if chara = " " then
return "%20"
end if
if chara = "'" then
return "%27"
end if
if chara ? " " and chara ? "'" then
return chara
end if
end encode
--testing...
substitute("fghe gfio'ijf")
--encode("fghe gfio'ijf")