Colloquy scripting issue

Good afternoon all,
I hope you can help me out here. I’m trying to script Colloquy, more specifically, I want to find out which of my connections are currently connected.

Here’s the code I have

[code]tell application “Colloquy”
repeat with theConnection in every connection
if status of theConnection is (connected) then

		-- Do something if the connection is connected
		
	end if
end repeat

end tell[/code]
The problem is with the “if status of theConnection is (connected) then” line. As you can see the word connected is being put in brackets. I think this is because it’s type, if that is the correct term, is a constant (Script Debuger displays, in the results panel, constant (‘enum’), which I think means it’s an enumerator or it’s enumerated). When I run the above code and it hits the aforementioned line SD gives me an error: “No result was returned from some part of this expression.”

All I want to do is to find out if a connection is connected and if so do something with it.

Any advice appreciated.

Thank you Jacques. I completely forgot that it could be a conflict with another command. I’ve tried your suggestion and it does work in Script Editor and ScriptDebugger, however, I wanted to also include this in an XCode project and when adding that code to the script it does not get the status of the connection. I think I’ve worked out why though. The string being returned is: «constant ****conD» rather than connected so it’s not seeing a connected connection. I’ve modifed the if line to the following:

if (thestatus as string) = "«constant ****conD»" or (thestatus as string) = "connected" then

This seems to work quite happily. Once again thanks for your help.