Home Page The Club Computers News Links Glossary EYAWTK
Before Amiga Background ICS OCS ECS AGA ??? PPC
U-Boot SLB Linux Amiga OS Dual Boot Motherboards Peripherals Other
Initialisation Installation OS4 Updates About OS4 File Systems Networking Printing Other
Introduction File System Workbench Preferences Commands Error Msgs Miscellaneous

AmigaOS 4.0 - About OS4 - Commands

CONTEXTMENUS Commodity
Purpose: Replaces the right mouse-button menus activated from the Workbench screen.
Format: CONTEXTMENUS [CX_PRIORITY <priority>] [QUALIFIER <button>] [CLIPBOARD] [IMMINENT] [STICKYSYSMENUS] [NOTITLE] [IGNOREFOCUS] [UNIT <n>] [DONOTWAIT]
Template: (none)
Path: SYS:Utilities/Commodities/ContextMenus
CONTEXTMENUS replaces the menus displayed when the right mouse button is pressed on the Workbench screen. By default it uses its own set of built-in menu with headings, such as System, Utilities, Preferences and Exchange, as well a number of other basic functions, based loosely on the OS4 Final configuration. However, it can be configured manually by creating a file 'ContextMenus.cfg' in the SYS:Prefs/Env-Archive directory.

ContextMenus allows to use popup menus when the user right-clicks:

  • in the WB window,
  • with the mouse pointer inside a directory window,
  • with the mouse pointer over icons.
The content of the popup menus is completely user definable. A different menu will popup, depending on where the mouse pointer is when the mouse button is pressed. Additionally, in the situation when it is over an icon, the menu will depend on the filetype of the clicked file(s). And as a filetype can be a sub-class of a parent filetype, the menu will include the content of all involved filetypes. You will be able to create a menu with one or more actions for each sub-class like:
  • filetype sensitive menus like "Edit C source" or "Display LW object"...
  • or some "global" menus that will work for all files on a given class (or even for absolutely every files) ex: "Delete", "Copy", "Delete"...
If you need a very specific menu, you can create it directly in the tooltypes of an icon.

To avoid misunderstandings, when a user clicks on the WB title bar, ContextMenus won't react, so the standard OS menus will be displayed instead of the popup ones.

The Prefs program is being worked on. The way menus are defined in this version of ContextMenus is a temporary solution. It is wise not to spend too much time on this, until the prefs program is ready. You have been warned !!! General menus: The menus are stored in the text file ENV:ContextMenus.cfg with each line following this rule: ,,, is the type of the clicked file as Deficons says it is. ex: "ascii" if Deficons says the clicked file is an ascii file. Additionnal class names have been created to handle other areas (Workbench, directory windows...). See below. is the name of the menu item as you want it to be displayed. is "CLI" for running the command through CLI, "WB" for ............................Wb, "PM_INVOKEWB" to select a menu item of the Wb is the command to execute when this menu item is selected. Tooltype menus: In addition to the common menus defined in the prefs file, it can be useful to define menus that will work only in one specific program. This is for some specific need (like an action that can work only in this particular file). To do this, you can define a menu directly into an icon tooltypes. Each tooltype line should follow this rule: ContextMenu=,, Name of the menu item in the menu "CLI", "WB" or "PM_INVOKEWB" Program to execute (with any arguments) Several lines can be added (but one item by line). Each item will be displayed in the same order they are defined. Example: this text file as an icon with such a menu. Go, click it ! Icons and other areas: Follow the rule defined above to create menus like: ASCII,Edit,CLI,ed %f when you right click an ASCII file (i.e. a file that is recognized as ASCII by DefIcons), this menu will be displayed. If you define a menu for a filetype and its children, right-clicking a children will bring the menu defined on it and all its parent. Example: if in Deficons, you have classes like ASCII HTML clicking an html file will display the menu defined for it and the menu defined for ASCII. You can create menus of several depths. Each menu start should begin and end with the same name (like with HTML tags): fileclass,>menudepth1 -> defines a new sub-menu fileclass,Dummy,CLI,dummy -> defines the item and action to do fileclass,>menudepth1 -> defines the end of the sub-menu Example with a depth 2 sub-menu: ASCII,>test1 ASCII,>test2 ASCII,Edit,CLI,ed %f ASCII,>test2 ASCII,>test1 Some additionnal objects have been defined to handle menus on other areas of the GUI: "Workbench" Menu defined in this class will be displayed when the user clicks somewhere in the Workbench window. i.e. with the mouse pointer not on: - an icon - a directory window - the WB title bar (reserved for OS menus) "Directory" Menus defined in this class will be displayed when the user clicks inside an opened directory window (its title bar included) "Drawer" Menu defined in this class will be displayed when the user clicks on a drawer icon. "Leftout" Menu defined in this class will be displayed when the user clicks on a leftout icon. "Appicon" Menu defined in this class will be displayed when the user clicks on an appicon. Special arguments: Some special arguments can be used in the command executed when a menu item is clicked. Those arguments will be replaced accordingly before execution of the command. Arguments can be used in general menus or tooltype ones and any number of them can be used at once. "%o" will be replaced by the filename of the file under the mouse pointer (even if multiple files are selected) "%O" will be replaced by the filename of all selected files Note: "O" stands for "only". "%f" will be replaced by the full name (pathname + filename) of the file under the mouse pointer (even if multiple files are selected) "%F" will be replaced by the full name of all selected files Note: "F" stands for "full". "%i" works like %o but the icon name is also processed "%I" works like %O but icon names are also processed Note: "I" stands for "icons". "%a" works like %f but the icon name is also processed "%A" works like %F but icon names are also processed Note: "A" stands for "all". Examples: Copy %i ram: -> Copy file file.info ram: rx script.rexx %o -> then retrieve the filename in your script "%d" will be replaced by the directory name where the menu item is used (i.e. the current directory). Special commands : In order to call a standard OS menu item use the command PM_INVOKEWB. Add to it, the function you would call like in an Arexx script. Example: Workbench,Execute command,PM_INVOKEWB,WORKBENCH.EXECUTE In order to do efficient and system friendly copy operations, ContextMenus uses AsyncWb to do Copy/Move/Paste/Delete. To do such operations, use the following commands in your menu definition: PM_COPY PM_CUT PM_PASTE PM_DELETE For PM_COPY and PM_CUT, the selected file names are memorized for use by a following PM_PASTE operation. The names are kept until a new PM_COPY or PM_CUT is issued. So files can be pasted more than once. Notes: - Those commands can be used in all menus (general and specific). - PM_DELETE is equivalent to PM_INVOKEWB, ICONS.DELETE ******************************************************************** User settings Syntax: PM_PRESET,SEPARATOR,bar Location: in the first lines of the prefs file in ENV: This setting defines how each menu class will be separated (if the user wants a separation). You can choose one of the following values: - NONE All menu items will be displayed one after the other. There won't be any separation between them. - SPACE A simple space will be between each class. - BAR (default) A separation bar will separate each class. Syntax: PM_PRESET,OUTPUT,CON:0/0/640/100/ContextMenus/CLOSE/WAIT/AUTO Location: in the first lines of the prefs file in ENV: When an error occurs when executing a command in a menu item, the command output will be redirected to what you define in this setting. Here, you can define a file or a console window. Example: OUTPUT="CON:0/0/640/100/Command error/CLOSE/WAIT/AUTO" The CX_PRIORITY <priority> argument sets the priority of CONTEXTMENUS in relation to all other Commodity Exchange programs. (This is the same as entering a CX_PRIORITY=<priority> Tool Type in the icon's Information window.) All the Commodity Exchange programs are set to a default priority of 0. If you specify a <priority> value higher than 0, CONTEXTMENUS will take priority over any other Commodity Exchange program, however the default for ContextMenus is -3.

The QUALIFIER <button> argument specifies the button that will invoke ContextMenus i.e. will display the popup menu. The standard qualifier is RIGHTBUTTON. If no mousebutton qualifier is specified, RIGHTBUTTON is assumed. Mousebutton qualifiers are MIDBUTTON, LEFTBUTTON, RIGHTBUTTON. Besides that, any qualifier can be used, like left alternate = LALT etc.

The CLIPBOARD option activates use of system clipboard if present. If you select some files "foo.bar", "bar.tender", "test.txt", the filenames will be expanded to full pathnames and concatenated separated by a single whitespace. The result is: "Work:foo.bar System:bar.tender Work:some/drawer/test.txt"

The IMMINENT option

The STICKYSYSMENUS option

The NOTITLE option specifies that the popup menus won't have a title.

The IGNOREFOCUS option specifies that the popup menus will be invoked if you click anywhere on the WB-Desktop. If an application window is active and you click on the WB-Desktop then popup menus will appear. If you keep this setting disabled, clicking on the WorkBench window will display the active application menu and not the popup menus.

The UNIT <n> argument specifies the unit of the system clipboard where the filenames are stored when the CLIPBOARD setting is enabled.

The DONOTWAIT option

Example 1:

3.OS4:> CONTEXTMENUS Runs ContextMenus.

Example 2:
The following is a sample configuration file:

PM_PRESET,SEPARATOR,bar
PM_PRESET,OUTPUT,CON:0/0/640/100/PowerMenus/CLOSE/WAIT/AUTO
Workbench,Execute command,PM_INVOKEWB,WORKBENCH.EXECUTE
Workbench,Open drawer,CLI,rx REXX:OpenDrawer.rexx
Workbench,Find...,WB,SYS:System/Find
Workbench,SEPARATOR
Workbench,>System
Workbench,BIOS Updater,WB,SYS:System/BIOSUpdater
Workbench,Fix Fonts,WB,SYS:System/FixFonts
Workbench,Flush Memory,CLI,c:avail flush >NIL:
Workbench,Media Toolbox,WB,SYS:System/Media Toolbox
Workbench,Mounter,WB,SYS:System/Mounter
Workbench,Type Manager,WB,SYS:System/TypeManager
Workbench,>System
Workbench,>Utilities
Workbench,Calculator,WB,SYS:Utilities/Calculator
Workbench,Clock,WB,SYS:Utilities/Clock
Workbench,Graphic Dump,WB,SYS:Utilities/GraphicDump
Workbench,Icon Edit,WB,SYS:Utilities/IconEdit
Workbench,Init Printer,WB,SYS:Utilities/InitPrinter
Workbench,Key Show,WB,SYS:Utilities/KeyShow
Workbench,MEmacs,WB,SYS:Utilities/MEmacs
Workbench,MultiView,WB,SYS:Utilities/MultiView
Workbench,NotePad,WB,SYS:Utilities/NotePad
Workbench,Partition Wizard,WB,SYS:Utilities/PartitionWizard
Workbench,Play CD,WB,SYS:Utilities/PlayCD
Workbench,Prefs Objects Editor,WB,SYS:Utilities/PrefsObjectsEditor
Workbench,Print Files,WB,SYS:Utilities/PrintFiles
Workbench,UnArc,WB,SYS:Utilities/Unarc
Workbench,USB Inspector,WB,SYS:Utilities/USBInspector
Workbench,>Utilities
Workbench,>Preferences
Workbench,AHI,WB,SYS:Prefs/AHI
Workbench,AmigaInput,WB,SYS:Prefs/AmigaInput
Workbench,ASL,WB,SYS:Prefs/ASL
Workbench,Compatibility,WB,SYS:Prefs/Compatibility
Workbench,DefIcons,WB,SYS:Prefs/DefIcons
Workbench,DOS,WB,SYS:Prefs/DOS
Workbench,Font,WB,SYS:Prefs/Font
Workbench,GUI,WB,SYS:Prefs/GUI
Workbench,Input,WB,SYS:Prefs/Input
Workbench,Internet,WB,SYS:Prefs/Internet
Workbench,Locale,WB,SYS:Prefs/Locale
Workbench,Overscan,WB,SYS:Prefs/Overscan
Workbench,Palette,WB,SYS:Prefs/Palette
Workbench,Picasso96Mode,WB,SYS:Prefs/Picasso96Mode
Workbench,Pointer,WB,SYS:Prefs/Pointer
Workbench,PopupMenu,WB,SYS:Prefs/PopupMenu
Workbench,Printer,WB,SYS:Prefs/Printer
Workbench,PrinterGFX,WB,SYS:Prefs/PrinterGFX
Workbench,PrinterPS,WB,SYS:Prefs/PrinterPS
Workbench,ScreenBlanker,WB,SYS:Prefs/ScreenBlanker
Workbench,Screenmode,WB,SYS:Prefs/Screenmode
Workbench,Screens,WB,SYS:Prefs/Screens
Workbench,Sound,WB,SYS:Prefs/Sound
Workbench,Time,WB,SYS:Prefs/Time
Workbench,UBoot,WB,SYS:Prefs/UBoot
Workbench,USB,WB,SYS:Prefs/USB
Workbench,WBPattern,WB,SYS:Prefs/WBPattern
Workbench,Workbench,WB,SYS:Prefs/Workbench
Workbench,>Preferences
Workbench,Exchange,WB,SYS:Utilities/Commodities/Exchange
Workbench,SEPARATOR
Workbench,Redraw all,PM_INVOKEWB,WORKBENCH.REDRAWALL
Workbench,Update all,PM_INVOKEWB,WORKBENCH.UPDATEALL
Workbench,SEPARATOR
Workbench,About...,PM_INVOKEWB,WORKBENCH.ABOUT
Disk,Open,PM_INVOKEWB,ICONS.OPEN
Disk,Information...,PM_INVOKEWB,ICONS.INFORMATION
Disk,SEPARATOR
Disk,Snapshot,PM_INVOKEWB,ICONS.SNAPSHOT
Disk,Unsnapshot,PM_INVOKEWB,ICONS.UNSNAPSHOT
Disk,SEPARATOR
Disk,Copy,PM_INVOKEWB,ICONS.COPY
Disk,Rename,PM_INVOKEWB,ICONS.RENAME
Disk,Format disk,PM_INVOKEWB,ICONS.FORMATDISK
Directory,New drawer...,PM_INVOKEWB,WINDOW.NEWDRAWER
Directory,New file here,WB,EditPad
Directory,NewShell here,CLI,Newshell con:0/180/640/56/Newshell/CLOSE
Directory,Paste,PM_PASTE
Directory,SEPARATOR
Directory,Open Parent,PM_INVOKEWB,WINDOW.OPENPARENT
Directory,Close drawer,PM_INVOKEWB,WINDOW.CLOSE
Directory,SEPARATOR
Directory,>Snapshot
Directory,Window,PM_INVOKEWB,WINDOW.SNAPSHOT.WINDOW
Directory,All,PM_INVOKEWB,WINDOW.SNAPSHOT.ALL
Directory,>Snapshot
Directory,>Clean up by
Directory,Columns,PM_INVOKEWB,WINDOW.CLEANUPBY.COLUMN
Directory,Name,PM_INVOKEWB,WINDOW.CLEANUPBY.NAME
Directory,Date,PM_INVOKEWB,WINDOW.CLEANUPBY.DATE
Directory,Size,PM_INVOKEWB,WINDOW.CLEANUPBY.SIZE
Directory,Type,PM_INVOKEWB,WINDOW.CLEANUPBY.TYPE
Directory,>Clean up by
Directory,>Show
Directory,Only icons,PM_INVOKEWB,WINDOW.SHOW.ONLYICONS
Directory,All files,PM_INVOKEWB,WINDOW.SHOW.ALLFILES
Directory,>Show
Directory,>View by
Directory,Icon,PM_INVOKEWB,WINDOW.VIEWBY.ICON
Directory,Name,PM_INVOKEWB,WINDOW.VIEWBY.NAME
Directory,Date,PM_INVOKEWB,WINDOW.VIEWBY.DATE
Directory,Size,PM_INVOKEWB,WINDOW.VIEWBY.SIZE
Directory,Type,PM_INVOKEWB,WINDOW.VIEWBY.TYPE
Directory,>View by
Directory,SEPARATOR
Directory,Resize to fit,PM_INVOKEWB,WINDOW.RESIZETOFIT
Directory,SEPARATOR
Directory,Update,PM_INVOKEWB,WINDOW.UPDATE
Directory,Select contents,PM_INVOKEWB,WINDOW.SELECTCONTENTS
Directory,Clear selection,PM_INVOKEWB,WINDOW.CLEARSELECTION
Directory,Find...,WB,SYS:System/Find
AppIcon,Open,PM_INVOKEWB,ICONS.OPEN
SingleIcon,Open,PM_INVOKEWB,ICONS.OPEN
SingleIcon,Information...,PM_INVOKEWB,ICONS.INFORMATION
SingleIcon,SEPARATOR
SingleIcon,Snapshot,PM_INVOKEWB,ICONS.SNAPSHOT
SingleIcon,Unsnapshot,PM_INVOKEWB,ICONS.UNSNAPSHOT
SingleIcon,Leave out,PM_INVOKEWB,ICONS.LEAVEOUT
SingleIcon,Put away,PM_INVOKEWB,ICONS.PUTAWAY
SingleIcon,SEPARATOR
SingleIcon,Duplicate,PM_INVOKEWB,ICONS.COPY
SingleIcon,Rename,PM_INVOKEWB,ICONS.RENAME
SingleIcon,Delete,PM_INVOKEWB,ICONS.DELETE
SingleIcon,SEPARATOR
SingleIcon,Edit,CLI,IconEdit %o
Multiple,Open,PM_INVOKEWB,ICONS.OPEN
Multiple,Information...,PM_INVOKEWB,ICONS.INFORMATION
Multiple,SEPARATOR
Multiple,Snapshot,PM_INVOKEWB,ICONS.SNAPSHOT
Multiple,Unsnapshot,PM_INVOKEWB,ICONS.UNSNAPSHOT
Multiple,Leave out,PM_INVOKEWB,ICONS.LEAVEOUT
Multiple,Put away,PM_INVOKEWB,ICONS.PUTAWAY
Multiple,SEPARATOR
Multiple,Copy,PM_COPY
Multiple,Cut,PM_CUT
Multiple,Duplicate,PM_INVOKEWB,ICONS.COPY
Multiple,Rename,PM_INVOKEWB,ICONS.RENAME
Multiple,Delete,PM_INVOKEWB,ICONS.DELETE
Drawer,Open,PM_INVOKEWB,ICONS.OPEN
Drawer,Information...,PM_INVOKEWB,ICONS.INFORMATION
Drawer,SEPARATOR
Drawer,Snapshot,PM_INVOKEWB,ICONS.SNAPSHOT
Drawer,Unsnapshot,PM_INVOKEWB,ICONS.UNSNAPSHOT
Drawer,Leave out,PM_INVOKEWB,ICONS.LEAVEOUT
Drawer,Put away,PM_INVOKEWB,ICONS.PUTAWAY
Drawer,SEPARATOR
Drawer,Copy,PM_COPY
Drawer,Cut,PM_CUT
Drawer,Duplicate,PM_INVOKEWB,ICONS.COPY
Drawer,Rename,PM_INVOKEWB,ICONS.RENAME
Drawer,Delete,PM_INVOKEWB,ICONS.DELETE
Project,Open,PM_INVOKEWB,ICONS.OPEN
Project,Information...,PM_INVOKEWB,ICONS.INFORMATION
Project,SEPARATOR
Project,Snapshot,PM_INVOKEWB,ICONS.SNAPSHOT
Project,Unsnapshot,PM_INVOKEWB,ICONS.UNSNAPSHOT
Project,Leave out,PM_INVOKEWB,ICONS.LEAVEOUT
Project,Put away,PM_INVOKEWB,ICONS.PUTAWAY
Project,SEPARATOR
Project,Copy,PM_COPY
Project,Cut,PM_CUT
Project,Duplicate,PM_INVOKEWB,ICONS.COPY
Project,Rename,PM_INVOKEWB,ICONS.RENAME
Project,Delete,PM_INVOKEWB,ICONS.DELETE
Project,Copy name,echo %f >ram:test.txt
Connection,Edit connection...,CLI,tmp1:os4.0/internet/dialer mode=edit %f
ASCII,Edit,CLI,ed %f
ASCII,Multiview,CLI,Multiview %f
Install,Execute,WB,installer %f
Mountlist,Mount,CLI,mount %f
Script,Execute,CLI,execute %f
Rexx,Execute,CLI,rx %f
Archive,Extract,CLI,rx REXX:ExtractArc.rexx %f
AIFF,Play,CLI,play16 OUTPUT AHI MODE 131086 %o
Tool,Version string,CLI,requestchoice >NIL: Version "`version full file %o`" Ok
Each entry consists of : Context,Title,Type,Command.

Context can be anything that is defined with DefIcons, plus some more.

Title is the String that is displayed in the context menu.

Type can be WB, CLI, PM_INVOKEWB and some internal types, like PM_PASTE, PM_COPY. If the type is WB or CLI the Command is executed like it has been doubleclicked or started in a shell.

The PM_INVOKEWB command will send the Command to the Workbench's ARexx port.

You can also define Submenus, where the Title must start with >, and the line is repeated to delimit the submenu. There is also a special Title, SEPARATOR, which you can figure out for yourself.


Return to Commands Selection

Disclaimer: Amiga Auckland have prepared the above information for the use of its members based on our experiences and as such is subject to revision at any time. Amiga Auckland cannot guarantee any of the information and cannot be held accountable for any issues that may result from using it.


Copyright 2006 Amiga Auckland Inc. All rights reserved.
Revised: December 24, 2006.