Guidance needed on basic AdiumScripting

An instant messenger which can connect to AIM, GTalk, Jabber, ICQ, and more.
Post Reply
miklophone
Harmless
Posts: 2
Joined: Mon Oct 09, 2006 11:25 am

Guidance needed on basic AdiumScripting

Post by miklophone »

Hi. I'm having trouble creating a working Adium script, and I'd appreciate some help. I've looked inside other Adium scripts, and adapted the code for myself. I can create a script which substitutes without paramters, but my problem is that I cannot create a working script which takes arguments. My initial aim is to create a script which allows me to run terminal commands within Adium.

I've named it Shell.AdiumScripts.

Contents->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>shell v0.1</string>
	<key>CFBundleIdentifier</key>
	<string>com.adiumx.shell.scripts</string>
	<key>CFBundleInfoDictionaryVersion</key>
	<string>0.5</string>
	<key>CFBundleName</key>
	<string>shell</string>
	<key>CFBundlePackageType</key>
	<string>AdIM</string>
	<key>Scripts</key>
	<array>
		<dict>
			<key>File</key>
			<string>shell</string>
			<key>Keyword</key>
			<string>/shell</string>
			<key>Title</key>
			<string>shell</string>
		</dict>
	</array>
	<key>Set</key>
	<string>shell</string>
</dict>
</plist>
Inside Resources, I have a script called shell.scpt. It looks like this:

Code: Select all


on substitute(theMessage)
	set theResult to do shell script theMessage
	return theResult
end substitute

When I type /shell xxx in Adium, it just echoes back the argument, and it does this whatever I put into the Applescript. I assume the plist file is faulty. Can anyone help?
User avatar
evands
Cocoaforge Admin
Posts: 3152
Joined: Thu Dec 02, 2004 10:55 pm
Location: Decatur, GA
Contact:

Post by evands »

You need to enclose your parameters in curly braces, {}, like so:

Code: Select all

/shell{xxx}
(Adium should be automatically putting /shell{arg1} on the input line if you select your script from the menu.)
The duck still burns.
--
My company: Saltatory Software. Check it out :)
User avatar
zaudragon
Growl Team
Posts: 1852
Joined: Sat Dec 04, 2004 5:05 am
Location: Kensington, CA, USA
Contact:

Re: Guidance needed on basic AdiumScripting

Post by zaudragon »

miklophone wrote:

Code: Select all

on substitute(theMessage)
	set theResult to do shell script theMessage
	return theResult
end substitute
You could make that even simpler:
miklophone wrote:

Code: Select all

on substitute(theMessage)
	return (do shell script theMessage)
end substitute
Blog | X(tras)
Communists code without classes.
miklophone
Harmless
Posts: 2
Joined: Mon Oct 09, 2006 11:25 am

Post by miklophone »

Thanks for your help. That was exactly what I needed to know. If only I'd posted here sooner... ;-)
Post Reply