Version 5 (modified by underwaterguy, 12 years ago) (diff)

fixed broken link

TracNav(Documentation)? This is part of the Documentation Project, please help document Colloquy if you know anything that would be relevant here for other users to know about.


  1. Compatibility with scripts written for Colloquy 2C11 and before
  2. Scripting Basics
  3. Opening The Dictionary
  4. Colloquy's AppleScript dictionary suites
  5. Caveat
  6. Posting AppleScripts on the Colloquy Documentation Pages

See also Writing PlugIns for Colloquy in the Development Docs

Compatibility with scripts written for Colloquy 2C11 and before

In order to provide enhanced scripting support, Colloquy’s AppleScript terminology has been completely re-written. Due to the extensive nature of the scripting enhancements, scripts written to work with previous versions of Colloquy are not guaranteed to be compatible with the 2D9 release. All scripts should be validated against the AppleScript dictionary in Colloquy 2D9.

Scripting Basics

The very first thing you may need to do is to send some text to a channel or 'PM'. This is achieved most simply in the following way:

tell application "Colloquy"
	tell active panel of front window
		send message "hello world"
	end tell
end tell

The 'tell target' is of enormous importance. When sending some chat text, it is important to specify, above all, the target of that message. This is because colloquy may be connected to multiple servers, via IRC or SLC, each with multiple chat rooms, and with any number of private chat sessions running. If you know that you want to send some text to the 'current' chat panel, i.e. the one that would receive whatever you typed in the frontmost window, use the syntax given here (active panel of front window). Consider that 'window 1' is a synonym for 'front window' if you would prefer to use it.

If you intend to use this form often in your scripts, keep in mind that any switching between channels, servers and private chats in the user interface will change the recipient of any scripted messages, with unpredictable results.

The target (active panel of front window) gets you a reference via the user interface which is of limited usefulness. For more sophisticated usage, for example, creating bots that can run discrete and individual 'conversations' or transactions with mulitple chat rooms or private chats at the same time, you will need to be more specific about which chat room or which private chat should receive the message, independently of which window is frontmost and which panel is active.

The following example will send a message to every chat room connected via connection 1:

tell application "Colloquy"
	tell connection 1
		repeat with cr in every chat room
			tell cr
				send message "Hi! I'm back"
			end tell
		end repeat
	end tell
end tell

...or even more simply...

tell application "Colloquy"
	tell every chat room of connection 1 to send message "Hi! I'm back"
end tell

When writing AppleScript PlugIns, the target for a message is often provided as an optional parameter to the handler. For example the callback 'process incoming chat message' sends a parameter 'in', which you can use to (for example) reply to the source of the incoming message.

Opening The Dictionary

All AppleScriptable applications provide 'dictionaries' of scripting terminology, describing the various classes of object and their relations to each other, commands and callback handlers. As with any other scriptable application, to see Colloquy's AppleScript dictionary from within Script Editor use "File" -> "Open Dictionary", then select Colloquy from the list.

If you wish to streamline this action (it can take a little time to build the list of scriptable applications), make a script to do it for you:

tell application "Script Editor" to open (path to application "Colloquy")

[applescript:// Click here to open the script in Script Editor]

Some scripts are designed to be invoked by colloquy itself (see AppleScript PlugIns), but it can also be useful to create utility scripts such as these for more general scripting (or debugging) tasks.

Such utility scripts may be usefully saved in ~/Library/Scripts/Colloquy/? where they will be available via a submenu of the script menu at all times, or in ~/Library/Scripts/Applications/Colloquy/? where they will be available via the script menu when Colloquy is the frontmost application, and hidden at other times.

Save scripts in:


(which is created automatically by Colloquy) and then make an alias to that folder, called 'Colloquy' in


so that you get the best of both worlds. When Colloquy is frontmost, all the Colloquy scripts are easily accessible at the bottom of the Script Menu, but they are still available via a submenu at all other times.

This is a general scripting tip which applies to all other scriptable applications.

Colloquy's AppleScript dictionary suites

Colloquy's AppleScript dictionary has 3 main suites:

  • The "Chat Core" suite
  • The "Chat Plug-In" suite
  • The "Colloquy" suite

The "Chat Core" suite allows for connecting/disconnecting joining rooms and sending messages.

The "Chat Plugin-In" suite specifies a number of events allowing action to be taken for most standard irc events. (See also AppleScript PlugIns)

The "Colloquy" suite allows for interaction with the application and some more irc functions.


Using IRC manually it's possible to be impolite, antisocial, aggressive, unpleasant, irritating and generally to accumulate bad karma of all kinds. Typically this will result in you getting kicked or banned from the chatroom in question. Please consider then how much broader are the horizons for causing undesirable effects when you are using a scripting language. In severe cases of network abuse people can (and are) routinely banned from entire servers.

For this reason it is strongly recommended that you open a private channel to carry out testing where possible, so that you don't disrupt the chat experience for others. If you are learning to script colloquy, and seek a tolerant atmosphere for endless iterations of your test messages, you may use the #colloquy-test channel, which even has some human beings looking at it from time to time. In a rare moment you may even find some third party to test your script for you too.

Posting AppleScripts on the Colloquy Documentation Pages

If you wish to add scripts to this or other documentation pages using Apple's handy applescript:// URL protocol, you can get a script to format your code for Wiki by [applescript:// clicking here.]