Adium Applescript development - newb help

An instant messenger which can connect to AIM, GTalk, Jabber, ICQ, and more.
Post Reply
quis
Harmless
Posts: 5
Joined: Sat Oct 22, 2005 6:26 pm
Location: Reading, England
Contact:

Adium Applescript development - newb help

Post by quis »

Hey, I've been trying to make an applescript that will open the msn member profile of your current contact when you type /mem. Currently it works when running the script in applescript editor but nothing happens when I type /mem in Adium. I copied a working package so it looks like this:

Code: Select all

MSNProfile.Adiumscripts
|__Contents
   |__Info.plist
   |__Resources
      |__mem.scpt
Info.plist looks like this:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>CFBundleDevelopmentRegion</key>
	<string>English</string>
	<key>CFBundleGetInfoString</key>
	<string>MSN Profile</string>
	<key>CFBundleIdentifier</key>
	<string>com.adiumx.msnprofile.scripts</string>
	<key>CFBundleInfoDictionaryVersion</key>
	<string>1.0</string>
	<key>CFBundleName</key>
	<string>MSN Profile</string>
	<key>CFBundlePackageType</key>
	<string>AdIM</string>
	<key>Scripts</key>
	<array>
		<dict>
			<key>File</key>
			<string>mem</string>
			<key>Keyword</key>
			<string>/mem</string>
			<key>Title</key>
			<string>MSN Profile</string>
		</dict>
	</array>
	<key>Set</key>
	<string>MSN Profile</string>
</dict>
</plist>
And the important part of the script looks like this:

Code: Select all

on substitute()
	tell application "Adium"
		activate
		tell the active chat of the first interface controller
			set member to ID
		end tell
	end tell
	set member to make_formatted(member, "MSN.", "")
	tell me to do shell script "open http://members.msn.com/" & member
end substitute
Anyone have any ideas on how to make this work? Thanks in advance...
snarfer
Frappa
Posts: 242
Joined: Tue Jan 25, 2005 5:16 pm
Location: A small CA town
Contact:

Post by snarfer »

If you're using the latest beta, /script won't work. You should change it to %_script for users of the beta.
quis
Harmless
Posts: 5
Joined: Sat Oct 22, 2005 6:26 pm
Location: Reading, England
Contact:

Post by quis »

I'm using Adium 0.85, 2nd October. I've changed the /mem part in Info.plist to %_mem but it doesn't seem to make any difference. It would be really handy if there was a page that covered basics like these...
snarfer
Frappa
Posts: 242
Joined: Tue Jan 25, 2005 5:16 pm
Location: A small CA town
Contact:

Post by snarfer »

You can access Adium's scripting abilities through Script Editor.app, look in the file menu for "Open Dictionary...".
quis
Harmless
Posts: 5
Joined: Sat Oct 22, 2005 6:26 pm
Location: Reading, England
Contact:

Post by quis »

Like I said, the script works, I just can't call it from Adium. I suspect that this is something to do with the plist file, so are there any changes I need to make there?
snarfer
Frappa
Posts: 242
Joined: Tue Jan 25, 2005 5:16 pm
Location: A small CA town
Contact:

Post by snarfer »

Seems fine to me...
quis
Harmless
Posts: 5
Joined: Sat Oct 22, 2005 6:26 pm
Location: Reading, England
Contact:

Post by quis »

Mysteriously seems to be working now - my bad. I'll post here when it's accepted onto the xtras site, thanks a lot for your help dude.
snarfer
Frappa
Posts: 242
Joined: Tue Jan 25, 2005 5:16 pm
Location: A small CA town
Contact:

Post by snarfer »

quis wrote:Mysteriously seems to be working now - my bad. I'll post here when it's accepted onto the xtras site, thanks a lot for your help dude.
Glad I could help.
quis
Harmless
Posts: 5
Joined: Sat Oct 22, 2005 6:26 pm
Location: Reading, England
Contact:

Post by quis »

Here it is on the Adiumxtras site. I hope people find this useful, and thanks again.
User avatar
zaudragon
Growl Team
Posts: 1852
Joined: Sat Dec 04, 2004 5:05 am
Location: Kensington, CA, USA
Contact:

Post by zaudragon »

You could’ve just not used Contents or Resources at all:

Code: Select all

MSNProfile.Adiumscripts 
|__Info.plist 
|__mem.scpt
Blog | X(tras)
Communists code without classes.
Post Reply