Opened 15 years ago

Closed 15 years ago

#42 closed Defect (Fixed)

Suggested scripting interface for consolidated 'send' command

Reported by: brennan@… Owned by: timothy
Component: Colloquy (Mac) Version: 2.0 (Mac)
Severity: Normal Keywords: AS send message to...


This does not work

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

It fails, mentioning that the 'to' parameter is missing. If you include an explicit 'to' parameter (in place of the tell) it fails with the same error

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

The following works

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

IMNSHO the 'to' parameter should be the first (unnamed/optional) parameter and the message should be a required named parameter. Applescript implementations usually treat the first (unnamed/optional) parameter as the tell target, defaulting to whatever is the current tell target if the parameter is omitted. I know the scripts should be backwards compatible, but this is just what most Applescripters will expect.

Change History (2)

comment:1 Changed 15 years ago by brennan@…

  • Summary changed from AS send message is not handling the target (to parameter) properly to Suggested scripting interface for consolidated 'send' command

I would recommend consolidating 'send message' and 'send raw command' into a single 'send' command which specifies the appropriate flags. Sending files should have a different terminology because it is such a radically different kind of operation. (transfer file?)

Here is some kind of preferred interface for the 'send' command:

send serverChannelOrUser message stringcommandortext as voice|action|raw encoded as blahblah with local echo

serverChannelOrUser is the direct parameter

message can be either a raw command or just some message text

voice|action|raw, enumerations to specify the type of 'send', defaulting to voice (not sure about that name).

encoding, can one send raw messages with specific encoding? if not this parameter might be ignored when sending raw commands, or cause a catchable error.

comment:2 Changed 15 years ago by timothy

  • Resolution set to fixed
  • Status changed from new to closed

This is fixed in changeset [2419]. The second way wont work still because the to parameter requires string types, chat room or chat user, this is an implementation restriction. That might change in the future.

Note: See TracTickets for help on using tickets.