Copyright (c) Hyperion Entertainment and contributors.

Difference between revisions of "AmigaOS Manual: Workbench ARexx Port"

From AmigaOS Documentation Wiki
Jump to navigation Jump to search
(Moved to the Workbench manual.)
 
(47 intermediate revisions by 3 users not shown)
Line 1: Line 1:
Workbench acts as an ARexx host under the name of "WORKBENCH". It supports a number of commands as will be described below. Note that for the ARexx interface to work, rexxsyslib.library must be installed (this library is part of a regular Workbench installation) and the RexxMast program must have been started.
 
 
= ACTIVATEWINDOW command =
 
 
; Purpose:
 
: This command will attempt to make a window the active one.
 
 
; Format:
 
: ACTIVATEWINDOW [WINDOW] <ROOT|Drawer name>
 
 
; Template:
 
: ACTIVATEWINDOW WINDOW
 
 
; Parameters:
 
: WINDOW
 
:: Either "ROOT" to activate the Workbench root window (where volume icons and AppIcons live) or the fully qualified name of a drawer window to activate. Note that the drawer window must already be open.
 
:: If no WINDOW parameter is specified, this command will try to operate on the currently active Workbench window.
 
 
; Errors:
 
: 10 - If the named window cannot be activated. The error code will be placed in the WORKBENCH.LASTERROR variable.
 
 
; Result:
 
: -
 
 
; Notes:
 
: If you choose to have a window activated that is not the root window you must make sure that the window name is given as a fully qualified path name. For example Work:" is a fully qualified name, and so is SYS:Utilities". Devs/Printers" would not be a fully qualified name. A fully qualified name always contains the name of an assignment, a volume or a device.
 
 
; Example:
 
: <syntaxhighlight>
 
/* Activate the root window. */ ADDRESS workbench
 
ACTIVATEWINDOW root
 
 
/* Activate the "Work:" partition's window. */
 
ACTIVATEWINDOW 'Work:'
 
</syntaxhighlight>
 
 
= CHANGEWINDOW command =
 
 
; Purpose:
 
: This command will attempt to change the size and the position of a window.
 
 
; Format:
 
: CHANGEWINDOW [WINDOW] <ROOT|ACTIVE|Drawer name> [[LEFTEDGE] <new left edge position>][[TOPEDGE] <new top edge position>][[WIDTH] <new window width>][[HEIGHT] <new window height>]
 
 
; Template:
 
: CHANGEWINDOW WINDOW,LEFTEDGE/N,TOPEDGE/N,WIDTH/N,HEIGHT/N
 
 
; Parameter:
 
: WINDOW
 
:: Either "ROOT" to resize/move the Workbench root window (where volume icons and AppIcons live), "ACTIVE" to change the currently active Workbench window or the fully qualified name of a drawer window to change. Note that the drawer window must already be open.
 
:: If no WINDOW parameter is specified, this command will try to operate on the currently active Workbench window.
 
 
: LEFTEDGE
 
:: New left edge window position.
 
 
: TOPEDGE
 
:: New top edge window position.
 
: WIDTH
 
:: New window width.
 
: HEIGHT
 
:: New window height.
 
 
; Errors:
 
: 10 - If the named window cannot be changed; this can also happen if you specified ACTIVE" as the window name and none of the Workbench windows is currently active. The error code will be placed in the WORBENCH.LASTERROR variable.
 
 
; Result:
 
: -
 
 
; Notes:
 
: If you choose to have a window changed that is neither the root nor the active window you must make sure that the window name is given as a fully qualified path name. For example "Work:" is a fully qualified name, and so is "SYS:Utilities". "Devs/Printers" would not be a fully qualified name. A fully qualified name always contains the name of an assignment, a volume or a device.
 
 
; Example:
 
: <syntaxhighlight>
 
/* Change the root window; move it to position 10,30. * and change its size to 200100 pixels. */
 
ADDRESS workbench
 
CHANGEWINDOW root LEFTEDGE 10 TOPEDGE 30 WIDTH 200 HEIGHT 100
 
 
/* Change the currently active window. */
 
CHANGEWINDOW active 20 40 200 100
 
</syntaxhighlight>
 
 
= DELETE command =
 
 
; Purpose:
 
: This command is for deleting files and drawers (and their contents).
 
 
; Format:
 
: DELETE [NAME] <File or drawer name> [ALL]
 
 
; Template:
 
: DELETE NAME/A,ALL/S
 
 
; Parameters:
 
: NAME
 
:: Name of the file or drawer or volume to delete.
 
 
: ALL
 
:: If the object in question is a drawer, attempt to delete the contents of the drawer as well as the drawer itself. If this option is not specified, the DELETE command will only attempt to delete the drawer itself, which may fail if the drawer is not yet empty.
 
 
; Errors:
 
: 10 - If the named file, drawer or volume could not be found or could not be deleted.
 
 
; Result:
 
: -
 
 
; Notes:
 
: The file name given must be an absolute path, such as in "RAM:Empty". A relative path, such as "/fred/barney" will not work.
 
 
; Example:
 
: <syntaxhighlight>
 
/* Delete the contents of the drawer RAM:Empty". */
 
 
ADDRESS workbench
 
DELETE 'RAM:Empty' ALL
 
</syntaxhighlight>
 
 
= FAULT command =
 
 
; Purpose:
 
: This command will return a human readable explanation corresponding to an error code.
 
 
; Format:
 
: FAULT [CODE] <Error code>
 
 
; Template:
 
: FAULT CODE/A/N
 
 
; Parameters:
 
: CODE
 
:: Error code to return a human readable explanation for.
 
 
; Errors:
 
: -
 
 
; Result:
 
: -
 
 
; Example:
 
: <syntaxhighlight>
 
/* Query the error message corresponding to error code #205. */
 
ADDRESS workbench
 
OPTIONS RESULTS
 
FAULT 205
 
SAY result
 
</syntaxhighlight>
 
 
= GETATTR command =
 
 
; Purpose:
 
: This command will retrieve information from the Workbench database, such the names of the drawers currently open and the icons currently selected.
 
 
; Format:
 
: GETATTR [OBJECT] <Object name> [NAME <Item name>][STEM <Name of stem variable>] [VAR <Variable name>]
 
 
; Template:
 
: GETATTR OBJECT/A,NAME/K,STEM/K,VAR/K
 
 
; Parameters:
 
: OBJECT
 
:: Name of the database entry to retrieve. For a list of valid entries see below.
 
 
: NAME
 
:: For some datatabase entries further information is required to identify the data to retrieve. This is when you will need to provide a name.
 
 
: STEM
 
:: If you request more than one database entry you will need to provide a variable to store the information in. For an example of its use, see below.
 
 
: VAR
 
:: If you want the queried information to be stored in a specific variable (other than the RESULT variable), this is where you provide its name.
 
 
; Attributes:
 
: You can obtain information on the following attributes:
 
: APPLICATION.VERSION
 
:: Version number of workbench.library".
 
 
:APPLICATION.SCREEN
 
:: Name of the public screen Workbench uses.
 
 
: APPLICATION.AREXX
 
:: Name of the Workbench ARexx port.
 
 
: APPLICATION.LASTERROR
 
:: Number of the last error caused by the ARexx interface.
 
 
: APPLICATION.ICONBORDER
 
:: Sizes of the icon borders, returned as four numbers separated by blank spaces, e.g. "4 3 4 3". The four numbers represent the left border width, the top border height, the right border width and the bottom border height (in exactly that order).
 
 
: APPLICATION.FONT.SCREEN.NAME
 
:: Name of the Workbench screen font.
 
 
: APPLICATION.FONT.SCREEN.WIDTH APPLICATION.FONT.SCREEN.HEIGHT
 
:: Size of a single character of the Workbench screen font. Please note that since the font in question may be proportional spaced the width information may be of little value. To measure the accurate pixel width of a text in reference to the font, use the .SIZE attribute.
 
 
: APPLICATION.FONT.SCREEN.SIZE
 
:: Size of a text, measured in pixels, in reference to the screen font. The text to measure must be provided with the NAME parameter of the GETATTR command.
 
 
: APPLICATION.FONT.ICON.NAME
 
:: Name of the Workbench icon font.
 
 
: APPLICATION.FONT.ICON.WIDTH APPLICATION.FONT.ICON.HEIGHT
 
:: Size of a single character of the Workbench icon font. Please note that since the font in question may be proportional spaced the width information may be of little value. To measure the accurate pixel width of a text in reference to the font, use the .SIZE attribute.
 
 
: APPLICATION.FONT.ICON.SIZE
 
:: Size of a text, measured in pixels, in reference to the icon font. The text to measure must be provided with the NAME parameter of the GETATTR command.
 
 
: APPLICATION.FONT.SYSTEM.NAME
 
:: Name of the system font.
 
 
: APPLICATION.FONT.SYSTEM.WIDTH
 
: APPLICATION.FONT.SYSTEM.HEIGHT
 
:: Size of a single character of the system font.
 
 
: APPLICATION.FONT.SYSTEM.SIZE
 
:: Size of a text, measured in pixels, in reference to the system font. The text to measure must be provided with the NAME parameter of the GETATTR command.
 
 
: WINDOWS.COUNT
 
:: Number of the drawer windows currently open. This can be 0.
 
 
: WINDOWS.0 .. WINDOWS.N
 
:: Names of the windows currently open.
 
 
: WINDOWS.ACTIVE
 
:: Name of the currently active Workbench window; this will be " if none of Workbench`s windows is currently active.
 
 
: KEYCOMMANDS.COUNT
 
:: Number of keyboard commands assigned. This can be 0.
 
 
: KEYCOMMANDS.0 .. KEYCOMMANDS.N
 
:: Information on all the keyboard commands assigned.
 
 
: KEYCOMMANDS.<n>.NAME
 
:: Name of the keyboard command.
 
 
: KEYCOMMANDS.<n>.KEY
 
:: The key combination assigned to this keyboard command.
 
 
: KEYCOMMANDS.<n>.COMMAND
 
:: The ARexx command assigned to this key combination.
 
 
: MENUCOMMANDS.COUNT
 
:: Number of menu commands assigned (through the MENU ADD .." command). This can be 0.
 
 
: MENUCOMMANDS.0 .. MENUCOMMANDS.N
 
:: Information on all the menu commands assigned.
 
 
: MENUCOMMANDS.<n>.NAME
 
:: Name of this menu item.
 
 
: MENUCOMMANDS.<n>.TITLE
 
:: Title of this menu item.
 
 
: MENUCOMMANDS.<n>.SHORTCUT
 
:: The keyboard shortcut assigned to this menu item.
 
 
: MENUCOMMANDS.<n>.COMMAND
 
:: The ARexx command assigned to this menu item.
 
 
: The following attributes require the name of the window to obtain information.
 
: WINDOW.LEFT
 
:: Left edge of the window.
 
 
: WINDOW.TOP
 
:: Top edge of the window.
 
 
: WINDOW.WIDTH
 
:: Width of the window.
 
 
: WINDOW.HEIGHT
 
:: Height of the window.
 
 
: WINDOW.MIN.WIDTH
 
:: Minimum width of the window.
 
 
: WINDOW.MIN.HEIGHT
 
:: Minimum height of the window.
 
 
: WINDOW.MAX.WIDTH
 
:: Maximum width of the window.
 
 
: WINDOW.MAX.HEIGHT
 
:: Maximum height of the window.
 
 
: WINDOW.VIEW.LEFT
 
:: Horizontal offset of the drawer contents; this value corresponds to the horizontal window scroller position.
 
 
: WINDOW.VIEW.TOP
 
:: Vertical offset of the drawer contents; this value corresponds to the vertical window scroller position.
 
 
: WINDOW.SCREEN.NAME
 
:: Name of the public screen the window was opened on.
 
 
: WINDOW.SCREEN.WIDTH WINDOW.SCREEN.HEIGHT
 
:: Size of the public screen the window was opened on.
 
 
: WINDOW.ICONS.ALL.COUNT
 
:: Number of the icons displayed in the window. This can be 0.
 
 
: WINDOW.ICONS.ALL.0 .. WINDOW.ICONS.ALL.N
 
:: Information on all the icons displayed in the window:
 
 
: WINDOW.ICONS.ALL.<n>.NAME
 
:: Name of the icon in question.
 
 
: WINDOW.ICONS.ALL.<n>.LEFT WINDOW.ICONS.ALL.<n>.TOP
 
:: Position of the icon in question.
 
 
: WINDOW.ICONS.ALL.<n>.WIDTH WINDOW.ICONS.ALL.<n>.HEIGHT
 
:: Size of the icon in question.
 
 
: WINDOW.ICONS.ALL.<n>.TYPE
 
:: Type of the icon; one of DISK, DRAWER, TOOL, PROJECT,GARBAGE, DEVICE, KICK or APPICON.
 
 
: WINDOW.ICONS.ALL.<n>.STATUS
 
:: Whether the icon is selected and (if the icon is a drawer-like object, such as a disk, drawer or trashcan icon) whether the corresponding drawer is currently open or closed. This attribute is returned in the form of a string, such as "SELECTED OPEN" which means that the icon is selected and the corresponding drawer is currently open. The other options include "UNSELECTED" and "CLOSED".
 
 
: WINDOW.ICONS.SELECTED.COUNT
 
:: Number of the selected icons displayed in the window. This can be 0.
 
 
: WINDOW.ICONS.SELECTED.0 .. WINDOW.ICONS.SELECTED.N
 
:: Information on all selected the icons in the window:
 
 
: WINDOW.ICONS.SELECTED.<n>.NAME
 
:: Name of the icon in question.
 
 
: WINDOW.ICONS.SELECTED.<n>.LEFT WINDOW.ICONS.SELECTED.<n>.TOP
 
:: Position of the icon in question.
 
 
: WINDOW.ICONS.SELECTED.<n>.WIDTH WINDOW.ICONS.SELECTED.<n>.HEIGHT
 
:: Size of the icon in question.
 
 
: WINDOW.ICONS.SELECTED.<n>.TYPE
 
:: Type of the icon; one of DISK, DRAWER, TOOL, PROJECT,GARBAGE, DEVICE, KICK or APPICON.
 
 
: WINDOW.ICONS.SELECTED.<n>.STATUS
 
:: Whether the icon is selected and (if the icon is a drawer-like object, such as a disk, drawer or trashcan icon) whether the corresponding drawer is currently open or closed. This attribute is returned in the form of a string, such as "SELECTED OPEN" which means that the icon is selected and the corresponding drawer is currently open. The other options include "UNSELECTED" and CLOSED". Of course, for the WINDOW.ICONS.SELECTED stem the icon status will always be reported as "SELECTED".
 
 
: WINDOW.ICONS.UNSELECTED.COUNT
 
:: Number of the unselected icons displayed in the window. This can be 0.
 
 
: WINDOW.ICONS.UNSELECTED.0 .. WINDOW.ICONS.UNSELECTED.N
 
:: Information on all selected the icons in the window:
 
 
: WINDOW.ICONS.UNSELECTED.<n>.NAME
 
:: Name of the icon in question.
 
 
: WINDOW.ICONS.UNSELECTED.<n>.LEFT WINDOW.ICONS.UNSELECTED.<n>.TOP
 
:: Position of the icon in question.
 
 
: WINDOW.ICONS.UNSELECTED.<n>.WIDTH WINDOW.ICONS.UNSELECTED.<n>.HEIGHT
 
:: Size of the icon in question.
 
 
: WINDOW.ICONS.UNSELECTED.<n>.TYPE
 
:: Type of the icon; one of DISK, DRAWER, TOOL, PROJECT, GARBAGE, DEVICE, KICK or APPICON.
 
 
: WINDOW.ICONS.UNSELECTED.<n>.STATUS
 
:: Whether the icon is selected and (if the icon is a drawer-like object, such as a disk, drawer or trashcan icon) whether the corresponding drawer is currently open or closed. This attribute is returned in the form of a string, such as "UNSELECTED OPEN" which means that the icon is selected and the corresponding drawer is currently open. The other options include "SELECTED" and CLOSED". Of course, for the WINDOW.ICONS.UNSELECTED stem the icon status will always be reported as "UNSELECTED".
 
 
; Errors:
 
: 10 - If the requester information could not be retrieved, you requested more than one database entry and did not provide a stem variable or if you provided a stem variable but did not request more than one database entry. The error code will be placed in the WORKBENCH.LASTERROR variable.
 
 
; Result:
 
: RESULT - The information retrieved from the database.
 
 
; Example:
 
: <syntaxhighlight>
 
/* Query the Workbench version. */
 
ADDRESS workbench
 
OPTIONS RESULTS
 
 
GETATTR application.version
 
SAY result
 
 
/* Query the Workbench version and store it in the * variable `version_number`. */
 
GETATTR application.version
 
VAR version_number
 
SAY version_number
 
 
/* Query the names of all currently open windows, * then print them. */
 
GETATTR windows
 
STEM window_list
 
 
DO i = 0 TO window_list.count-1
 
SAY window_list.i;
 
END;
 
 
/* Query name, position and size of the first icon * shown in the root window. */
 
GETATTR window.icons.all.0
 
NAME root
 
STEM root
 
 
SAY root.name
 
SAY root.left
 
SAY root.top
 
SAY root.width
 
SAY root.height
 
SAY root.type
 
 
/* Query the width and height of the root window. */
 
GETATTR window.width
 
NAME root
 
SAY result
 
 
GETATTR window.height
 
NAME root
 
SAY result
 
 
/* Query the length of a text (in pixels) with reference * to the icon font. */
 
GETATTR application.font.icon.size
 
NAME 'Text to measure'
 
SAY result
 
</syntaxhighlight>
 
 
= HELP command =
 
 
; Purpose:
 
: This command can be used to open the online help and to obtain information on the supported menus, commands and command parameters.
 
 
; Format:
 
: HELP [COMMAND <Command name>] [MENUS] [PROMPT]
 
 
; Template:
 
: HELP COMMAND/K,MENUS/S,PROMPT/S
 
 
; Parameters:
 
: COMMAND
 
:: Name of the command whose command template should be retrieved.
 
 
: MENUS
 
:: Specify this parameter to retrieve a list of menu items currently available.
 
 
: PROMPT
 
:: Specify this parameter to invoke the online help system.
 
 
:: If no parameter is provided, a list of supported commands will be returned.
 
 
; Errors:
 
: 10 - If the named command is not supported by the ARexx interface. The error code will be placed in the WORKBENCH.LASTERROR variable.
 
 
; Result:
 
: RESULT
 
: The command template, list of menu items or commands, as specified in the command parameters.
 
 
; Example:
 
: <syntaxhighlight>
 
/* Retrieve the list of supported commands. */
 
ADDRESS workbench
 
OPTIONS results
 
 
HELP
 
SAY result
 
 
/* Retrieve the command template of the `GETATTR` command. */
 
HELP COMMAND getattr
 
SAY result
 
 
/* Retrieve the list of available menu items. */
 
HELP MENUS
 
SAY result
 
</syntaxhighlight>
 
 
= ICON command =
 
 
; Purpose:
 
: This command is for manipulating the icons displayed in a window.
 
 
; Format:
 
: ICON [WINDOW] <Window name> <Icon name> .. <Icon name> [OPEN] [MAKEVISIBLE] [SELECT] [UNSELECT] [UP <Pixels>] [DOWN <Pixels>] [LEFT <Pixels>] [RIGHT <Pixels>] [X <Horizontal position>] [Y <Vertical position>] [ACTIVATE UP|DOWN|LEFT|RIGHT] [CYCLE PREVIOUS|NEXT] [MOVE IN|OUT]
 
 
; Template:
 
: ICON WINDOW,NAMES/M,OPEN/S,MAKEVISIBLE/S,SELECT/S,UNSELECT/S, UP/N,DOWN/N,LEFT/N,RIGHT/N,X/N,Y/N,ACTIVATE/K,CYCLE/K, MOVE/K
 
 
; Parameters:
 
: WINDOW
 
:: Name of the window whose icons should be manipulated. This can be "ROOT" to work on the Workbench root window (where volume icons and AppIcons live), "ACTIVE" to work on the currently active Workbench window or the fully qualified name of a drawer window. Note that the drawer window must already be open.
 
:: If no WINDOW parameter is specified, this command will try to operate on the currently active Workbench window.
 
 
: NAMES
 
:: Names of the icons to manipulate.
 
 
: OPEN
 
:: Specifies that the named icons should be opened.
 
 
: MAKEVISIBLE
 
:: Specifies that the named icons should be made visible. This generally works well for the first icon in a list but does not always work for a whole list.
 
 
: SELECT
 
:: Select the named icons.
 
 
: UNSELECT
 
:: Unselect the named icons.
 
 
: UP, DOWN, LEFT, RIGHT
 
:: Move the named icons by the specified number of pixels.
 
 
: X, Y
 
:: Move the named icons to the specified position.
 
 
: ACTIVATE
 
:: This command is for activating the icon closest to the currently selected icon in the window. "Activating" in this context means selecting an icon, whilst at the same time unselecting all others. Thus, the "active" icon is the only selected icon in the window.
 
 
:: You can indicate which direction the next icon to be activated should be searched for, relative to the currently active icon. "UP" searches upwards, "DOWN" searches downwards, "LEFT" searches to the left and "RIGHT" searches to the right.
 
 
: CYCLE
 
:: This command is for cycling through all icons in a window, making each one the active one in turn (for a description of what "active" means in this context, see the "ACTIVATE" description above). You must indicate in which direction you want to cycle through the icons: you can either specify "PREVIOUS" or "NEXT".
 
 
: MOVE
 
:: This command is not for moving icons but for moving through a file system hierarchy. Thus, moving "in" will open a drawer and moving "out" will open the drawer's parent directory. The "IN" parameter will cause the drawer represented by the active icon to be opened. Please note that an icon must be selected and it must be a drawer. The "OUT" parameter will open the drawer's parent directory, and it also requires that in the drawer there is an icon selected. This may sound strange, but this feature is not meant as a replacement for the "Open Parent" menu item.
 
 
; Errors:
 
: 10 - If the named window cannot be found, none of the Workbench windows are currently active and the command was set to work on the currently active Workbench window. The error code will be placed in the WORKBENCH.LASTERROR variable.
 
 
; Result:
 
: -
 
 
; Example:
 
: <syntaxhighlight>
 
/* Select the icons of the "Workbench" and "Work" volumes displayed in the root window. */
 
ADDRESS workbench
 
 
ICON WINDOW root
 
NAMES Workbench Work SELECT
 
 
/* Open the "Workbench" volume icon displayed in the root window. */
 
ICON WINDOW root
 
NAMES Workbench OPEN
 
</syntaxhighlight>
 
 
= INFO command =
 
 
; Purpose:
 
: This command is for opening the Workbench icon information requester.
 
 
; Format:
 
: INFO [NAME] <File, drawer or volume name>
 
 
; Template:
 
: INFO NAME/A
 
 
; Parameters :
 
: NAME
 
:: Name of the file, drawer or volume to open the information window for.
 
 
; Errors:
 
: 10 - If the named file, drawer or volume could not be found. The error code will be placed in the WORKBENCH.LASTERROR variable.
 
 
; Result:
 
: -
 
 
; Example:
 
: <syntaxhighlight>
 
/* Open the information window for SYS:". */
 
ADDRESS workbench
 
 
INFO NAME 'SYS:'
 
</syntaxhighlight>
 

Latest revision as of 03:05, 4 March 2019