home *** CD-ROM | disk | FTP | other *** search
- /*
-
- $VER: test-command.dopus5 1.1 (29.05.96)
-
- Example of an 'arexx module'. This program must go in the dopus5:modules
- directory, and MUST have the suffix .dopus5 to work correctly.
-
- The script is called with 2 or more parameters. The first 2 are always
- provided - the portname, and the function. For all functions other than
- 'init', the source and destination lister handles are also provided.
- Any user-supplied arguments to the function will follow.
-
- Your script must provide at least the 'init' function. This is the
- function that adds the commands to DOpus (see below). DOpus runs any
- scripts (identified by the .dopus5 suffix) it finds in the dopus5:modules
- directory automatically on startup.
-
- You can add as many commands as you like. To add commands, use the
- 'dopus command' command. The template is :
-
- dopus command <name> program <scriptname> desc <description> template <template> [source] [dest]
-
- name = the name of the command
- program = filename of the script (without .dopus5 suffix)
- desc = optional command description (for popup command list in editors)
- template = optional command template (you'll have to do parsing yourself)
- source = specify this keyword if you would like a source
- dest = specify this keyword if you would like a destination
-
- The program field is mandatory, and Opus will run the script name you provide here
- whenever this function is invoked.
-
- If you specify the source or dest keywords, Opus will lock the source/destination
- if available and pass you its lister handle automatically. Otherwise, if you want
- a source or destination you will have to use 'lister query' and get it manually.
-
- The function is called with the source and destination lister handles; if there
- is no source/dest these will be 0. Note that these are always provided, even if you don't
- specify the appropriate keywords (they will just always be 0).
-
- */
-
- parse arg portname function source dest arguments
- address value portname
- options results
-
- /* Initialise */
-
- if function='init' then do
- dopus command "Test1" program "test-command" desc "'Test command 1'" template "TEST/S" 'source dest'
- dopus command "Test2" program "test-command" desc "'Test command 2'"
- exit
- end
-
-
- /* Test function 1 */
-
- if function='Test1' then do
- str="'Source : "||source||" Dest : "||dest||" Args : "||arguments||"'"
- dopus request str "Ok"
- exit
- end
-
-
- /* Test function 2 */
-
- if function='Test2' then do
- dopus request "'Test command 2 received!'" "Ok"
- exit
- end
-