# Command modifier reference

The following is a list of the various [command modifiers](../../customize/creating_your_own_buttons/command_modifiers) supported in toolbar buttons and hotkeys.

<table><thead><tr><th>Modifier</th><th>Description</th><th></th><th></th><th></th></tr></thead><tbody><tr><td>@admin</td><td><p>The function requires administrator permissions. This modifier will result in a UAC prompt appearing (unless the Lister is already in <a href="../../file_operations/uac_and_administrator_mode">administrator mode</a>), and any external programs run by this function will be elevated.</p><p>If used by itself, this modifier affects the entire function. It can also be used to elevate a specific command rather than the entire button.</p><table><thead><tr><th></th><th></th><th></th></tr></thead><tbody><tr><td><strong>@admin</strong></td><td><em>elevate the entire function</em></td><td></td></tr><tr><td><strong>@admin:notepad.exe {f}</strong></td><td><em>only elevates Notepad</em></td><td></td></tr><tr><td><strong>@admin:no</strong></td><td><em>disable UAC prompts for any subsequent commands in this function</em></td><td></td></tr><tr><td><strong>@admin:yes</strong></td><td><em>re-enable UAC prompts for any subsequent commands</em></td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td>@async</td><td></td><td></td></tr></tbody></table><p>The command following this modifier will be run asynchronously - Opus will not wait for it to exit before running the next command in the function (or before running this command again for the next selected file).</p><p>The default behaviour is for a function that consists of a single command to run that command asynchronously for each selected file; a function that consists of multiple commands will run each command synchronously. The default behaviour can be changed with the <strong>function_default_async</strong> option on the <a href="../../preferences/preferences_categories/miscellaneous/advanced_options"><strong>Miscellaneous / Advanced</strong></a> page in Preferences, or it can be overridden on a per-command basis with this modifier.</p><table><thead><tr><th></th><th></th><th></th></tr></thead><tbody><tr><td><strong>@async:notepad.exe {f}</strong></td><td><em>runs Notepad asynchronously</em></td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td>@codepage</td><td></td><td></td></tr></tbody></table><p>Changes the code page of an <a href="../../customize/creating_your_own_buttons/ms-dos_batch_commands">MS-DOS batch command</a>. If not specified the default code page is 1252 (<a href="http://en.wikipedia.org/wiki/Windows-1252">Windows-1252</a>).</p><table><thead><tr><th></th><th></th><th></th></tr></thead><tbody><tr><td><strong>@codepage:1258</strong></td><td><em>sets the code page to Vietnamese</em></td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td>@confirm</td><td></td><td></td></tr></tbody></table><p>Displays a confirmation dialog. If the user clicks the cancel button, the function is aborted at this point.</p><p>The template for this modifier is: <strong>@confirm:</strong><em>&#x3C;message></em><strong>|</strong><em>&#x3C;positive text></em><strong>|</strong><em>&#x3C;negative text></em></p><p><em>&#x3C;message></em> is the text shown in the dialog, <em>&#x3C;positive text></em> is the text shown on the "OK" button, and <em>&#x3C;negative text></em> is the text shown on the "Cancel" button. These three strings are all optional - if not provided, default strings will be used. If you provide <em>&#x3C;positive text></em> but not <em>&#x3C;negative text></em> then the dialog will have an "OK" button but no "Cancel" button at all.</p><p>You can include line-breaks in the message text using the special code  (and if you need to include a literal  sequence in the text you must escape the <strong>\</strong> character, as in ).</p><table><thead><tr><th></th><th></th><th></th></tr></thead><tbody><tr><td><strong>@confirm:Really copy files?</strong></td><td><em>uses default text for the OK and Cancel buttons</em></td><td></td></tr><tr><td><strong>@confirm:Really proceed?|Oui!|Non!</strong></td><td><em>specifies custom text for the two buttons</em></td><td></td></tr><tr><td><strong>@confirm:All finished|Acknowledged</strong></td><td><em>custom text for the OK button; no Cancel button at all</em></td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td>@ctx</td><td></td><td></td></tr></tbody></table><p>Allows you to define a <a href="../../customize/creating_your_own_buttons/editing_the_toolbar/dynamic_buttons">dynamic button</a> using the <a href="../../evaluator">evaluator</a>. As a simple example,</p><pre><code>@ctx:=return "Go DRIVEBUTTONS";
</code></pre><p>This uses the evaluator to return a simple string; functionally this is no different to simply putting the <strong>Go DRIVEBUTTONS</strong> command on a toolbar button.</p><p>As a more complex example, the default <em>Favorites Bar</em> toolbar uses <strong>@ctx</strong> to build the displayed favorites list, by using the Evaluator to build a command line using the current localised name of the favorites bar branch:</p><pre><code>@ctx:=return "Favorites SHOWICONS USEQUALKEYS BRANCH=""" + LanguageStr("FavoritesBar") + """;
</code></pre><p>This uses the evaluator <strong>LanguageStr()</strong> function to retrieve the translated name of a known string, and constructs a command line using the <strong>Favorites</strong> command to display that branch of the favorites tree.</p></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td><strong>@admin</strong></td><td><em>elevate the entire function</em></td><td></td><td></td><td></td></tr><tr><td><strong>@admin:notepad.exe {f}</strong></td><td><em>only elevates Notepad</em></td><td></td><td></td><td></td></tr><tr><td><strong>@admin:no</strong></td><td><em>disable UAC prompts for any subsequent commands in this function</em></td><td></td><td></td><td></td></tr><tr><td><strong>@admin:yes</strong></td><td><em>re-enable UAC prompts for any subsequent commands</em></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td>@async</td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td><strong>@async:notepad.exe {f}</strong></td><td><em>runs Notepad asynchronously</em></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td>@codepage</td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td><strong>@codepage:1258</strong></td><td><em>sets the code page to Vietnamese</em></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td>@confirm</td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td><strong>@confirm:Really copy files?</strong></td><td><em>uses default text for the OK and Cancel buttons</em></td><td></td><td></td><td></td></tr><tr><td><strong>@confirm:Really proceed?|Oui!|Non!</strong></td><td><em>specifies custom text for the two buttons</em></td><td></td><td></td><td></td></tr><tr><td><strong>@confirm:All finished|Acknowledged</strong></td><td><em>custom text for the OK button; no Cancel button at all</em></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td>@ctx</td><td></td><td></td><td></td><td></td></tr><tr><td>@dirsonly</td><td><p>The function will operate only on selected folders, ignoring any files.</p><table><thead><tr><th></th><th></th><th></th></tr></thead><tbody><tr><td><strong>@dirsonly</strong></td><td><em>operate only on directories</em></td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td>@disableif</td><td></td><td></td></tr></tbody></table><p>The button will be disabled if a command clause test is false. This is similar to the conditional testing offered by the <strong>@if</strong> modifier described below.</p><table><thead><tr><th></th><th></th></tr></thead><tbody><tr><td><strong>@disableif:Set DUAL=toggle</strong></td><td>button will be disabled if the Lister is in dual-display mode</td></tr><tr><td><strong>@disableif:!Set DUAL=toggle</strong></td><td>button will be disabled if the Lister is NOT in dual-display mode</td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr></tbody></table><p>@disableifpath<br>@disableifpathr</p></td><td><p>The button will be disabled if the current source path matches the specified pattern. You can provide either an absolute path to test against, or a wildcard pattern (use <strong>@disableifpath</strong> for <a href="../wildcard_reference/pattern_matching_syntax">standard wildcards</a>, and <strong>@disableifpathr</strong> for <a href="../wildcard_reference/regular_expression_syntax">regular expressions</a>). You can also use the keyword <strong>shell</strong> to test for a hosted shell namespace extension (virtual folder).</p><table><thead><tr><th></th><th></th></tr></thead><tbody><tr><td><strong>@disableifpathr:^C:\</strong></td><td><em>disable command if source path is on the C: drive</em></td></tr><tr><td><strong>@disableifpath:!*\Work\</strong>*</td><td><em>disable unless source path is underneath a folder called <strong>Work</strong></em></td></tr></tbody></table><p>Paths may use aliases, environment variables, {apppath} codes, and so on, only when using wildcards (not regular expressions):</p><table><thead><tr><th></th><th></th><th></th></tr></thead><tbody><tr><td><strong>@disableifpath:!/desktop</strong></td><td><em>disable unless in the Desktop folder</em></td><td></td></tr><tr><td><strong>@disableifpath:!%SystemRoot%\System32</strong></td><td><em>disable unless in <strong>C:\Windows\System32</strong> (on a typical system)</em></td><td></td></tr><tr><td><strong>@disableifpath:{apppath|dopus.exe}</strong></td><td><em>disable if in the folder where Opus is installed</em></td><td></td></tr><tr><td><strong>@disableifpath:shell</strong></td><td><em>disable if in a hosted virtual folder</em></td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td>@disablenosel</td><td></td><td></td></tr></tbody></table><p>The command will be disabled when no files or folders are selected, or optionally when no files of a certain type are selected. This is done automatically for certain standard commands and the modifier lets you make your own commands behave in a similar way. This is similar to <strong>@hidenosel</strong>.</p><table><thead><tr><th></th><th></th></tr></thead><tbody><tr><td><strong>@disablenosel</strong></td><td><em>disable button when nothing is selected</em></td></tr><tr><td><strong>@disablenosel:files</strong></td><td><em>disable button when no files are selected</em></td></tr><tr><td><strong>@disablenosel:dirs</strong></td><td><em>disable button when no folders are selected</em></td></tr></tbody></table><p>For lister toolbars, you can use the <strong>minfiles</strong>, <strong>maxfiles</strong> and <strong>numfiles</strong> keywords to specify a minimum, maximum, or exact number of files which must be selected for the button to be enabled. Similarly, <strong>mindirs</strong>, <strong>maxdirs</strong> and <strong>numdirs</strong> can limit the number of selected folders.</p><table><thead><tr><th></th><th></th></tr></thead><tbody><tr><td><strong>@disablenosel:numfiles=2</strong></td><td><em>disable button unless exactly 2 files are selected</em></td></tr><tr><td><strong>@disablenosel:maxfiles=5</strong></td><td><em>disable button unless 5 files or fewer are selected</em></td></tr><tr><td><strong>@disablenosel:mindirs=3,maxdirs=5</strong></td><td><em>disable button unless 3, 4 or 5 folders are selected</em></td></tr></tbody></table><p>Using the <strong>type</strong> keyword you can configure a button to be disabled unless at least one file is selected whose name matches the supplied wildcard pattern. (It is not required that all selected files match the pattern; only one.) You can also combine this with <strong>dirs</strong> for a button that works if a folder is selected or if a file of a certain type is selected. If you use <strong>type</strong>, it must be the last thing on the line, since everything after the <strong>=</strong> will be considered part of the pattern (allowing the pattern to include things which would otherwise be confused with other keywords and parameters).</p><table><thead><tr><th></th><th></th></tr></thead><tbody><tr><td><strong>@disablenosel:type=*.jpg</strong></td><td><em>disable button when no files ending with ".jpg" are selected</em></td></tr><tr><td><strong>@disablenosel:type=old</strong></td><td><em>disable button when no files beginning with "old" are selected</em></td></tr><tr><td><strong>@disablenosel:dirs,type=*.png</strong></td><td><em>disable unless any folders, or any files ending with ".png", are selected</em></td></tr></tbody></table><p>You can also use a <strong>!</strong> character to negate the test. It must be the first thing after the <strong>:</strong>. For example,</p><table><thead><tr><th></th><th></th><th></th></tr></thead><tbody><tr><td><strong>@disablenosel:!type=*.jpg</strong></td><td><em>disable button if files ending with ".jpg" are selected</em></td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td>@enableif</td><td></td><td></td></tr></tbody></table><p>The button will be enabled if a command clause test is true. This is similar to the conditional testing offered by the <strong>@if</strong> modifier described below.</p><table><thead><tr><th></th><th></th></tr></thead><tbody><tr><td><strong>@enableif:Set DUAL=toggle</strong></td><td>button will be enabled if the Lister is in dual-display mode</td></tr><tr><td><strong>@enableif:!Set DUAL=toggle</strong></td><td>button will be enabled if the Lister is NOT in dual-display mode</td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr></tbody></table><p>@enableifpath<br>@enableifpathr</p></td><td><p>The button will be enabled if the current source path matches the specified pattern. You can provide either an absolute path to test against, or a wildcard pattern (use <strong>@enableifpath</strong> for <a href="../wildcard_reference/pattern_matching_syntax">standard wildcards</a>, and <strong>@enableifpathr</strong> for <a href="../wildcard_reference/regular_expression_syntax">regular expressions</a>). You can also use the keyword <strong>shell</strong> to test for a hosted shell namespace extension (virtual folder).</p><table><thead><tr><th></th><th></th></tr></thead><tbody><tr><td><strong>@enableifpathr:^C:\</strong></td><td><em>enable command if source path is on the C: drive</em></td></tr><tr><td><strong>@enableifpath:!*\Work\</strong>*</td><td><em>enable unless source path is underneath a folder called <strong>Work</strong></em></td></tr></tbody></table><p>Paths may use aliases, environment variables, {apppath} codes, and so on, only when using wildcards (not regular expressions):</p><table><thead><tr><th></th><th></th></tr></thead><tbody><tr><td><strong>@enableifpath:!/desktop</strong></td><td><em>enable unless in the Desktop folder</em></td></tr><tr><td><strong>@enableifpath:!%SystemRoot%\System32</strong></td><td><em>enable unless in <strong>C:\Windows\System32</strong> (on a typical system)</em></td></tr><tr><td><strong>@enableifpath:{apppath|dopus.exe}</strong></td><td><em>enable if in the folder where Opus is installed</em></td></tr><tr><td><strong>@enableifpath:shell</strong></td><td><em>enable if in a hosted virtual folder</em></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr></tbody></table><p>@eval<br>@evalalways</p></td><td><p>Runs <a href="../../evaluator">Evaluator</a> code as part of a dynamic test, and optionally as part of the command itself. Typically you would use this to set Evaluator variables which can be used on later lines in the command.</p><ul><li>Code after <code>@eval:</code> is only run when dynamically updating the button's label, visibility and enabled/disabled state. It's not run when the button is clicked.</li><li>Code after <code>@evalalways:</code> also runs when the button is clicked. This lets you set up variables which are used both when executing commands and, e.g. also when updating their labels.</li></ul><p>In this example, the <code>type</code> value is initialised once in the top line, and then referred to multiple times in the subsequent lines.</p><pre><code>@eval:type = PathType(source);
fIsFileSystem = (type == "shell" || type == "filesys")
@showif:=fIsFileSystem
@label:fIsFileSystem ? ("Open " + FilePart(DisplayName(source)) + " in Explorer") : ("Disabled (" + type + ")")
</code></pre></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td><strong>@dirsonly</strong></td><td><em>operate only on directories</em></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td>@disableif</td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td><strong>@disableif:Set DUAL=toggle</strong></td><td>button will be disabled if the Lister is in dual-display mode</td><td></td><td></td><td></td></tr><tr><td><strong>@disableif:!Set DUAL=toggle</strong></td><td>button will be disabled if the Lister is NOT in dual-display mode</td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td><strong>@disableifpathr:^C:\</strong></td><td><em>disable command if source path is on the C: drive</em></td><td></td><td></td><td></td></tr><tr><td><strong>@disableifpath:!*\Work\</strong>*</td><td><em>disable unless source path is underneath a folder called <strong>Work</strong></em></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td><strong>@disableifpath:!/desktop</strong></td><td><em>disable unless in the Desktop folder</em></td><td></td><td></td><td></td></tr><tr><td><strong>@disableifpath:!%SystemRoot%\System32</strong></td><td><em>disable unless in <strong>C:\Windows\System32</strong> (on a typical system)</em></td><td></td><td></td><td></td></tr><tr><td><strong>@disableifpath:{apppath|dopus.exe}</strong></td><td><em>disable if in the folder where Opus is installed</em></td><td></td><td></td><td></td></tr><tr><td><strong>@disableifpath:shell</strong></td><td><em>disable if in a hosted virtual folder</em></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td>@disablenosel</td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td><strong>@disablenosel</strong></td><td><em>disable button when nothing is selected</em></td><td></td><td></td><td></td></tr><tr><td><strong>@disablenosel:files</strong></td><td><em>disable button when no files are selected</em></td><td></td><td></td><td></td></tr><tr><td><strong>@disablenosel:dirs</strong></td><td><em>disable button when no folders are selected</em></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td><strong>@disablenosel:numfiles=2</strong></td><td><em>disable button unless exactly 2 files are selected</em></td><td></td><td></td><td></td></tr><tr><td><strong>@disablenosel:maxfiles=5</strong></td><td><em>disable button unless 5 files or fewer are selected</em></td><td></td><td></td><td></td></tr><tr><td><strong>@disablenosel:mindirs=3,maxdirs=5</strong></td><td><em>disable button unless 3, 4 or 5 folders are selected</em></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td><strong>@disablenosel:type=*.jpg</strong></td><td><em>disable button when no files ending with ".jpg" are selected</em></td><td></td><td></td><td></td></tr><tr><td><strong>@disablenosel:type=old</strong></td><td><em>disable button when no files beginning with "old" are selected</em></td><td></td><td></td><td></td></tr><tr><td><strong>@disablenosel:dirs,type=*.png</strong></td><td><em>disable unless any folders, or any files ending with ".png", are selected</em></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td><strong>@disablenosel:!type=*.jpg</strong></td><td><em>disable button if files ending with ".jpg" are selected</em></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td>@enableif</td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td><strong>@enableif:Set DUAL=toggle</strong></td><td>button will be enabled if the Lister is in dual-display mode</td><td></td><td></td><td></td></tr><tr><td><strong>@enableif:!Set DUAL=toggle</strong></td><td>button will be enabled if the Lister is NOT in dual-display mode</td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td><strong>@enableifpathr:^C:\</strong></td><td><em>enable command if source path is on the C: drive</em></td><td></td><td></td><td></td></tr><tr><td><strong>@enableifpath:!*\Work\</strong>*</td><td><em>enable unless source path is underneath a folder called <strong>Work</strong></em></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td><strong>@enableifpath:!/desktop</strong></td><td><em>enable unless in the Desktop folder</em></td><td></td><td></td><td></td></tr><tr><td><strong>@enableifpath:!%SystemRoot%\System32</strong></td><td><em>enable unless in <strong>C:\Windows\System32</strong> (on a typical system)</em></td><td></td><td></td><td></td></tr><tr><td><strong>@enableifpath:{apppath|dopus.exe}</strong></td><td><em>enable if in the folder where Opus is installed</em></td><td></td><td></td><td></td></tr><tr><td><strong>@enableifpath:shell</strong></td><td><em>enable if in a hosted virtual folder</em></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td>@externalonly</td><td><p>Ignores any Opus <a href="internal_commands">internal commands</a> specified in the function, and treats all commands as external. This lets you configure an MS-DOS batch function using commands like <strong>copy</strong> which would normally be overridden by the internal command set.</p><table><thead><tr><th></th><th></th><th></th></tr></thead><tbody><tr><td><strong>@externalonly</strong></td><td><em>external commands only</em></td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td>@filesfromdroponly</td><td></td><td></td></tr></tbody></table><p>Accepts files and folders only via drag-and-drop. A button with this modifier will ignore any selected files or folders in the Lister - only files dropped onto the button will be used by a command within it.</p><table><thead><tr><th></th><th></th><th></th></tr></thead><tbody><tr><td><strong>@filesfromdroponly</strong></td><td><em>accept files only via drag-and-drop</em></td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td>@filesonly</td><td></td><td></td></tr></tbody></table><p>The function will operate only on selected files, ignoring any folders.</p><table><thead><tr><th></th><th></th><th></th></tr></thead><tbody><tr><td><strong>@filesonly</strong></td><td><em>operate only on files</em></td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td>@firstfileonly</td><td></td><td></td></tr></tbody></table><p>The function will operate on only the first selected file, irrespective of how many items are selected or dropped onto the button.</p><table><thead><tr><th></th><th></th><th></th></tr></thead><tbody><tr><td><strong>@firstfileonly</strong></td><td><em>operate on only the first selected file</em></td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td>@functype</td><td></td><td></td></tr></tbody></table><p>This directive is only used within an <a href="../../customize/creating_your_own_buttons/embedded_functions">embedded function</a>. It lets you specify the type of the embedded function (if not specified, the embedded function is assumed to be a standard function - Opus or external command). For example, the following command would open a new Lister with an embedded script function that runs in the context of the new Lister:</p><pre><code>Go NEW
[
@functype:script
@script:vbscript
' script function here
]
</code></pre><table><thead><tr><th></th><th></th><th></th></tr></thead><tbody><tr><td><strong>@functype:script</strong></td><td><em>the embedded function is a script</em></td><td></td></tr><tr><td><strong>@functype:msdos</strong></td><td><em>the embedded function is an MS-DOS batch function</em></td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td>@hideblock</td><td></td><td></td></tr></tbody></table><p>The <strong>@hideblock</strong> modifier lets you use the various other modifiers to hide or show multiple buttons at once, without having to repeat the tests in each button.</p><p>Use <strong>@hideblock:begin</strong> on a button to begin the block, along with whichever other modifiers are appropriate. The buttons within the block will be hidden or shown depending on the state of the first button. For example,</p><pre><code>@hideif:!Set VIEW=Thumbnails
@hideblock:begin
</code></pre><p>This button begins a hide/show block based on the current view mode. If the current view is in thumbnails mode, the buttons will be visible - otherwise they'll be hidden.</p><p>Use <strong>@hideblock:end</strong> on another button to end the block. All buttons between the beginning and end will be hidden or shown as one. Note that the beginning and ending buttons are never shown outside of Customize mode.</p><table><thead><tr><th></th><th></th><th></th></tr></thead><tbody><tr><td><strong>@hideblock:begin</strong></td><td><em>begin a hide block</em></td><td></td></tr><tr><td><strong>@hideblock:end</strong></td><td><em>end a hide block</em></td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td>@hideif</td><td></td><td></td></tr></tbody></table><p>The button will be hidden if a command clause test is false. This is similar to the conditional testing offered by the <strong>@if</strong> modifier described below.</p><table><thead><tr><th></th><th></th></tr></thead><tbody><tr><td><strong>@hideif:Set DUAL=toggle</strong></td><td><em>button will be hidden if the Lister is in dual-display mode</em></td></tr><tr><td><strong>@hideif:!Set DUAL=toggle</strong></td><td><em>button will be hidden if the Lister is NOT in dual-display mode</em></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr></tbody></table><p>@hideifpath<br>@hideifpathr</p></td><td><p>The button will be hidden if the current source path doesn't match the specified pattern. You can provide either an absolute path to test against, or a wildcard pattern (use <strong>@hideifpath</strong> for <a href="../wildcard_reference/pattern_matching_syntax">standard wildcards</a>, and <strong>@hideifpathr</strong> for <a href="../wildcard_reference/regular_expression_syntax">regular expressions</a>).</p><table><thead><tr><th></th><th></th></tr></thead><tbody><tr><td><strong>@hideifpathr:^C:\</strong></td><td><em>hide command if source path is on the C: drive</em></td></tr><tr><td><strong>@hideifpath:!*\Work\</strong>*</td><td><em>hide unless source path is underneath a folder called <strong>Work</strong></em></td></tr></tbody></table><p>Paths may use aliases, environment variables, {apppath} codes, and so on, only when using wildcards (not regular expressions):</p><table><thead><tr><th></th><th></th><th></th></tr></thead><tbody><tr><td><strong>@hideifpath:!/desktop</strong></td><td><em>hide unless in the Desktop folder</em></td><td></td></tr><tr><td><strong>@hideifpath:!%SystemRoot%\System32</strong></td><td><em>hide unless in <strong>C:\Windows\System32</strong> (on a typical system)</em></td><td></td></tr><tr><td><strong>@hideifpath:{apppath|dopus.exe}</strong></td><td><em>hide if in the folder where Opus is installed</em></td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td>@hidenosel</td><td></td><td></td></tr></tbody></table><p>The button will be hidden when no files or folders are selected, or optionally when no files of a certain type are selected. This is similar to <strong>@disablenosel</strong>.</p><table><thead><tr><th></th><th></th></tr></thead><tbody><tr><td><strong>@hidenosel</strong></td><td><em>hide button when nothing is selected</em></td></tr><tr><td><strong>@hidenosel:files</strong></td><td><em>hide button when no files are selected</em></td></tr><tr><td><strong>@hidenosel:dirs</strong></td><td><em>hide button when no folders are selected</em></td></tr></tbody></table><p>For lister toolbars, you can use the <strong>minfiles</strong>, <strong>maxfiles</strong> and <strong>numfiles</strong> keywords to specify a minimum, maximum, or exact number of files which must be selected for the button to be visible. Similarly, <strong>mindirs</strong>, <strong>maxdirs</strong> and <strong>numdirs</strong> can limit the number of selected folders.</p><table><thead><tr><th></th><th></th></tr></thead><tbody><tr><td><strong>@hidenosel:numfiles=2</strong></td><td><em>hide button unless exactly 2 files are selected</em></td></tr><tr><td><strong>@hidenosel:maxfiles=5</strong></td><td><em>hide button unless 5 files or fewer are selected</em></td></tr><tr><td><strong>@hidenosel:mindirs=3,maxdirs=5</strong></td><td><em>hide button unless 3, 4 or 5 folders are selected</em></td></tr></tbody></table><p>Using the <strong>type</strong> keyword you can configure a button to be hidden unless at least one file is selected whose name matches the supplied wildcard pattern. (It is not required that all selected files to match the pattern; only one.) You can also combine this with <strong>dirs</strong> for a button that is visible if a folder is selected or if a file of a certain type is selected. If you use <strong>type</strong>, it must be the last thing on the line, since everything after the <strong>=</strong> will be considered part of the pattern (allowing the pattern to include things which would otherwise be confused with other keywords and parameters).</p><table><thead><tr><th></th><th></th></tr></thead><tbody><tr><td><strong>@hidenosel:type=*.jpg</strong></td><td><em>hide button when no files ending with ".jpg" are selected</em></td></tr><tr><td><strong>@hidenosel:type=old</strong></td><td><em>hide button when no files beginning with "old" are selected</em></td></tr><tr><td><strong>@hidenosel:dirs,type=*.png</strong></td><td><em>hide unless any folders, or any files ending with ".png", are selected</em></td></tr></tbody></table><p>You can also use a <strong>!</strong> character to negate the test. It must be the first thing after the <strong>:</strong>. For example,</p><table><thead><tr><th></th><th></th></tr></thead><tbody><tr><td><strong>@hidenosel:!type=*.jpg</strong></td><td><em>hide button if files ending with ".jpg" are selected</em></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr></tbody></table><p>@icon<br>@icon!<br>@iconp</p></td><td><p>The <strong>@icon</strong> directive lets you create buttons that dynamically change their icon based on the test of a command clause, typically via the <strong>Set</strong> command (similar to <strong>@if</strong> and <strong>@ifset</strong>). The default <em>View Mode Cycle</em> button uses this to change its icon to reflect the current view mode.</p><pre><code>Set VIEW=Cycle
@icon:largeicons,Set VIEW=LargeIcons
@icon:smallicons,Set VIEW=SmallIcons
@icon:listmode,Set VIEW=List
@icon:powermode,Set VIEW=Power
@icon:thumbnails,Set VIEW=Thumbnails
@icon:tile,Set VIEW=Tiles
@icon:detailsmode,Set VIEW=Details
</code></pre><p>Each <strong>@icon</strong> directive in the button specifies the icon to use, and the command directive to test for. For example, if <strong>Set VIEW=LargeIcons</strong> tests as true, the icon called <strong>largeicons</strong> will be displayed on the button. If none of the <strong>@icon</strong> tests match then the icon set in the button itself will be used as the default image.</p><p>In the special case of a three-button button, <strong>@iconp:</strong> and <strong>@icon!:</strong> directives can also be used in any of the child buttons to change the icon of the parent. <strong>@iconp:</strong> used in one of the child buttons will set the icon of the parent (but do nothing to the child button). <strong>icon!:</strong> used in one of the child buttons will set the icon of the parent as well as of that child button.</p><p>If you are testing based on the <strong>Set</strong> command, the command name is technically optional and can be ommitted. For example, <strong>VIEW=LargeIcons</strong> on its own is the same as <strong>Set VIEW=LargeIcons</strong>. This ability is there to avoid breaking old buttons and, with new buttons, we recommend you include the command name in all cases to avoid problems in the future.</p><p>In the command editor, you can <strong>Ctrl</strong>+click the <strong>@icon:</strong> string to select the icon directly.</p><p><strong>@icon</strong> can use the <strong>RECYCLEBINEMPTY</strong> argument to test if the recycle bin is empty or not. For example,</p><pre><code>@icon:c:\icons\empty.png,RECYCLEBINEMPTY
</code></pre><p>Toolbar buttons that use <strong>@icon</strong> with <strong>RECYCLEBINEMPTY</strong> will refresh themselves automatically when the recycle bin state changes (this lets you have a button whose icon reflects the state of the recycle bin).</p></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td><strong>@externalonly</strong></td><td><em>external commands only</em></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td>@filesfromdroponly</td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td><strong>@filesfromdroponly</strong></td><td><em>accept files only via drag-and-drop</em></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td>@filesonly</td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td><strong>@filesonly</strong></td><td><em>operate only on files</em></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td>@firstfileonly</td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td><strong>@firstfileonly</strong></td><td><em>operate on only the first selected file</em></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td>@functype</td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td><strong>@functype:script</strong></td><td><em>the embedded function is a script</em></td><td></td><td></td><td></td></tr><tr><td><strong>@functype:msdos</strong></td><td><em>the embedded function is an MS-DOS batch function</em></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td>@hideblock</td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td><strong>@hideblock:begin</strong></td><td><em>begin a hide block</em></td><td></td><td></td><td></td></tr><tr><td><strong>@hideblock:end</strong></td><td><em>end a hide block</em></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td>@hideif</td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td><strong>@hideif:Set DUAL=toggle</strong></td><td><em>button will be hidden if the Lister is in dual-display mode</em></td><td></td><td></td><td></td></tr><tr><td><strong>@hideif:!Set DUAL=toggle</strong></td><td><em>button will be hidden if the Lister is NOT in dual-display mode</em></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td><strong>@hideifpathr:^C:\</strong></td><td><em>hide command if source path is on the C: drive</em></td><td></td><td></td><td></td></tr><tr><td><strong>@hideifpath:!*\Work\</strong>*</td><td><em>hide unless source path is underneath a folder called <strong>Work</strong></em></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td><strong>@hideifpath:!/desktop</strong></td><td><em>hide unless in the Desktop folder</em></td><td></td><td></td><td></td></tr><tr><td><strong>@hideifpath:!%SystemRoot%\System32</strong></td><td><em>hide unless in <strong>C:\Windows\System32</strong> (on a typical system)</em></td><td></td><td></td><td></td></tr><tr><td><strong>@hideifpath:{apppath|dopus.exe}</strong></td><td><em>hide if in the folder where Opus is installed</em></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td>@hidenosel</td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td><strong>@hidenosel</strong></td><td><em>hide button when nothing is selected</em></td><td></td><td></td><td></td></tr><tr><td><strong>@hidenosel:files</strong></td><td><em>hide button when no files are selected</em></td><td></td><td></td><td></td></tr><tr><td><strong>@hidenosel:dirs</strong></td><td><em>hide button when no folders are selected</em></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td><strong>@hidenosel:numfiles=2</strong></td><td><em>hide button unless exactly 2 files are selected</em></td><td></td><td></td><td></td></tr><tr><td><strong>@hidenosel:maxfiles=5</strong></td><td><em>hide button unless 5 files or fewer are selected</em></td><td></td><td></td><td></td></tr><tr><td><strong>@hidenosel:mindirs=3,maxdirs=5</strong></td><td><em>hide button unless 3, 4 or 5 folders are selected</em></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td><strong>@hidenosel:type=*.jpg</strong></td><td><em>hide button when no files ending with ".jpg" are selected</em></td><td></td><td></td><td></td></tr><tr><td><strong>@hidenosel:type=old</strong></td><td><em>hide button when no files beginning with "old" are selected</em></td><td></td><td></td><td></td></tr><tr><td><strong>@hidenosel:dirs,type=*.png</strong></td><td><em>hide unless any folders, or any files ending with ".png", are selected</em></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td><strong>@hidenosel:!type=*.jpg</strong></td><td><em>hide button if files ending with ".jpg" are selected</em></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td>@if<br>@ifset</td><td><p>Allows simple conditional behaviour based on tests for various commands.</p><p><strong>@if</strong> is a general test which works with any command, and <strong>@ifset</strong> is a specific test which only works with the <a href="internal_commands/set"><strong>Set</strong></a> command conditions. For example, <strong>@ifset:DUAL=on</strong> is equivalent to <strong>@if:Set DUAL=on</strong>.<br>The test <strong>@if</strong> actually performs is to evaluate whether a toolbar button with the specified command would appear highlighted or not. For example, if the Lister is in dual-display mode, a button with <strong>Set DUAL=toggle</strong> as the command would appear highlighted. Therefore, the <strong>@if:Set DUAL=toggle</strong> modifier would evaluate to true.</p><p>You can also evaluate whether a toolbar button would be enabled or not, using <strong>@if:enabled</strong>. For example, <a href="../../basic_concepts/the_lister/dual_display/navigation_lock">Navigation Lock</a> is only enabled when a Lister is in dual-display mode. Therefore, the modifier <strong>@if:enabled Set NAVLOCK=Toggle</strong> would evaluate to true when the Lister was in dual-display mode.</p><p>You can also test if a variable has been set by the <strong>@set</strong> directive. Additionally, a button on the <a href="../../basic_concepts/the_lister/toolbars/the_default_toolbars/file_display_toolbar">File Display toolbar</a> can test if it's tied to the left or right file display.</p><p>For example, you could configure a button to read a folder into the right file display in a dual-display Lister, or into the current file display otherwise.</p><pre><code>@if:Set DUAL=on             // if DUAL mode is on
Set FOCUS=right             // give focus to the right file display
Go /mypictures OPENINRIGHT  // read directory into that file display
@if:else                    // otherwise
Go /mypictures              // read directory into current file display
@if:common                  // common commands (always executed)
Set VIEW=thumbnails         // set view to thumbnails mode
</code></pre><p>As another example, <strong>@ifset</strong> can use the <strong>RECYCLEBINEMPTY</strong> argument to test if the recycle bin is empty or not:</p><pre><code>@ifset:RECYCLEBINEMPTY
@confirm The recycle bin is empty!
@ifset:else
Delete EMPTYRECYCLE
</code></pre><p>Conditional testing can also be used on buttons in the <a href="../../additional_functionality/viewing_images">standalone viewer</a>. The following function will toggle the display between 100% zoom and <em>Grow To Page</em> modes, by using <strong>@if</strong> to test the current zoom mode:</p><pre><code>@if:Show VIEWERCMD=zoom,reset
Show VIEWERCMD=zoom,grow
@if:else
Show VIEWERCMD=zoom,reset
</code></pre><p>The possible forms of this modifier are:</p><table><thead><tr><th></th><th></th></tr></thead><tbody><tr><td><strong>@if:&#x3C;command line></strong></td><td><em>test if a specific command condition is true</em></td></tr><tr><td><strong>@ifset:</strong><em>&#x3C;Set command argument></em></td><td><em>test for a specific Set command condition</em></td></tr><tr><td><strong>@if:enabled</strong> <em>&#x3C;command></em></td><td><em>test if a command button would be enabled (rather than highlighted)</em></td></tr><tr><td><strong>@if:$foo</strong></td><td><em>test if a variable called "foo" has been set</em></td></tr><tr><td><strong>@if:$glob:bar</strong></td><td><em>test if a global variable called "bar" has been set</em></td></tr><tr><td><strong>@if:SIDE=left</strong></td><td><em>test if the toolbar is tied to the left file display</em></td></tr><tr><td><strong>@if:SIDE=right</strong></td><td><em>test if the toolbar is tied to the right file display</em></td></tr><tr><td><strong>@if:&#x26;&#x26;ARG&#x26;&#x26;=value</strong></td><td><em>test if a</em> <a href="../../customize/creating_your_own_buttons/user-defined_commands"><em>User-defined command</em></a> <em>argument matches a given value</em></td></tr><tr><td><strong>@if:&#x26;&#x26;ARG&#x26;&#x26;!=value</strong></td><td><em>test if a</em> <a href="../../customize/creating_your_own_buttons/user-defined_commands"><em>User-defined command</em></a><em>argument doesn't match a given value</em></td></tr><tr><td><strong>@if:else</strong></td><td><em>an "else" clause that is executed if nothing else matches</em></td></tr><tr><td><strong>@if:common</strong></td><td><em>common instructions that are always executed</em></td></tr></tbody></table><p>You can negate the condition by prefixing it with a <strong>!</strong> character. For example, all four of these are equivalent:</p><pre><code>@if:!Set DUAL=on
@if:Set DUAL=off
@ifset:!DUAL=on
@ifset:DUAL=off
</code></pre></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td><strong>@if:&#x3C;command line></strong></td><td><em>test if a specific command condition is true</em></td><td></td><td></td><td></td></tr><tr><td><strong>@ifset:</strong><em>&#x3C;Set command argument></em></td><td><em>test for a specific Set command condition</em></td><td></td><td></td><td></td></tr><tr><td><strong>@if:enabled</strong> <em>&#x3C;command></em></td><td><em>test if a command button would be enabled (rather than highlighted)</em></td><td></td><td></td><td></td></tr><tr><td><strong>@if:$foo</strong></td><td><em>test if a variable called "foo" has been set</em></td><td></td><td></td><td></td></tr><tr><td><strong>@if:$glob:bar</strong></td><td><em>test if a global variable called "bar" has been set</em></td><td></td><td></td><td></td></tr><tr><td><strong>@if:SIDE=left</strong></td><td><em>test if the toolbar is tied to the left file display</em></td><td></td><td></td><td></td></tr><tr><td><strong>@if:SIDE=right</strong></td><td><em>test if the toolbar is tied to the right file display</em></td><td></td><td></td><td></td></tr><tr><td><strong>@if:&#x26;&#x26;ARG&#x26;&#x26;=value</strong></td><td><em>test if a</em> <a href="../../customize/creating_your_own_buttons/user-defined_commands"><em>User-defined command</em></a> <em>argument matches a given value</em></td><td></td><td></td><td></td></tr><tr><td><strong>@if:&#x26;&#x26;ARG&#x26;&#x26;!=value</strong></td><td><em>test if a</em> <a href="../../customize/creating_your_own_buttons/user-defined_commands"><em>User-defined command</em></a><em>argument doesn't match a given value</em></td><td></td><td></td><td></td></tr><tr><td><strong>@if:else</strong></td><td><em>an "else" clause that is executed if nothing else matches</em></td><td></td><td></td><td></td></tr><tr><td><strong>@if:common</strong></td><td><em>common instructions that are always executed</em></td><td></td><td></td><td></td></tr><tr><td>@ifexists</td><td><p>Allows simple conditional behaviour based on whether the specified drive or path exists. The final component of a path can contain <a href="../wildcard_reference/pattern_matching_syntax">standard wildcards</a> if the <strong>wild:</strong> prefix is used.</p><table><thead><tr><th></th><th></th><th></th></tr></thead><tbody><tr><td><strong>@ifexists:</strong></td><td><em>&#x3C;drive or path> - test if drive or path exists</em></td><td></td></tr><tr><td><strong>@ifexists:wild:</strong></td><td><em>&#x3C;drive or path> - test if drive or path exists. Allows wildcards in the final path component</em></td><td></td></tr><tr><td><strong>@ifexists:!</strong></td><td><em>&#x3C;drive or path> - test if drive or path does not exist</em></td><td></td></tr><tr><td><strong>@ifexists:else</strong></td><td><em>an "else" clause that is executed if the path doesn't exist</em></td><td></td></tr><tr><td><strong>@ifexists:common</strong></td><td><em>common instructions that are always executed</em></td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td>@ifsel</td><td></td><td></td></tr></tbody></table><p>Lets a function do different things depending on file or folder selection. The available tests are the same as for the <strong>@disablenosel</strong> modifier (documented above).</p><p>For example,</p><pre><code>@ifsel:numfiles=2
&#x3C;run program that accepts exactly two files>
@ifsel:else
&#x3C;show an error message>
</code></pre></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td><strong>@ifexists:</strong></td><td><em>&#x3C;drive or path> - test if drive or path exists</em></td><td></td><td></td><td></td></tr><tr><td><strong>@ifexists:wild:</strong></td><td><em>&#x3C;drive or path> - test if drive or path exists. Allows wildcards in the final path component</em></td><td></td><td></td><td></td></tr><tr><td><strong>@ifexists:!</strong></td><td><em>&#x3C;drive or path> - test if drive or path does not exist</em></td><td></td><td></td><td></td></tr><tr><td><strong>@ifexists:else</strong></td><td><em>an "else" clause that is executed if the path doesn't exist</em></td><td></td><td></td><td></td></tr><tr><td><strong>@ifexists:common</strong></td><td><em>common instructions that are always executed</em></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td>@ifsel</td><td></td><td></td><td></td><td></td></tr><tr><td>@ifpath<br>@ifpathr</td><td><p>Allows simple conditional behaviour based on the current source path. You can provide either an absolute path to test against, or a wildcard pattern (use <strong>@ifpath</strong> for <a href="../wildcard_reference/pattern_matching_syntax">standard wildcards</a>, and <strong>@ifpathr</strong> for <a href="../wildcard_reference/regular_expression_syntax">regular expressions</a>).</p><p>For example, you could use this to open different programs when double-clicking on an image file, depending on where the file is stored. If the following command was added to the <em>Left double-click</em> <a href="../../file_types/filetype_editor/events">event</a> for the <strong>Images</strong> <a href="../../file_types/file_type_groups">file type group</a>, pictures located on the network will be opened in the Opus viewer when they are double-clicked, whereas files located on a local drive would open in Photoshop.</p><pre><code>@ifpath:\\*                      // if path begins with \\
Show                             // invoke the Opus viewer
@ifpath:else                     // otherwise...
Photoshop.exe {f}                // open in Photoshop (the full path would generally need
                                 // to be specified - this is just an example)
</code></pre><p>The possible forms of this modifier are:</p><table><thead><tr><th></th><th></th></tr></thead><tbody><tr><td><strong>@ifpath:</strong><em>&#x3C;path or wildcard></em></td><td><em>test for a path (using standard pattern matching)</em></td></tr><tr><td><strong>@ifpathr:</strong><em>&#x3C;regular expression></em></td><td><em>test for a path (using regular expressions)</em></td></tr><tr><td><strong>@ifpath:else</strong></td><td><em>an "else" clause that is executed if nothing else matches</em></td></tr><tr><td><strong>@ifpath:common</strong></td><td><em>common instructions that are always executed</em></td></tr></tbody></table><p>You can negate the condition by prefixing it with a <strong>!</strong> character.</p><p>Examples:</p><table><thead><tr><th></th><th></th><th></th></tr></thead><tbody><tr><td><strong>@ifpath:C:\Program Files</strong></td><td><em>Tests you are in C:\Program Files</em></td><td></td></tr><tr><td><strong>@ifpath:!C:\Program Files</strong></td><td><em>Tests you are anywhere but C:\Program Files</em></td><td></td></tr><tr><td><strong>@ifpath:C:\Program Files\</strong>*</td><td><em>Tests you're in a folder below C:\Program Files (does not include Program Files itself)</em></td><td></td></tr><tr><td><strong>@ifpath:!C:\Program Files\</strong>*</td><td><em>Tests you are not in a folder below C:\Program Files</em></td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td>@ifrunning</td><td></td><td></td></tr></tbody></table><p>Allows simple conditional behaviour based on whether a specified process is currently running. You can use wildcards or (by prefixing the pattern with <strong>regex:</strong>) regular expressions.</p><table><thead><tr><th></th><th></th><th></th></tr></thead><tbody><tr><td><strong>@ifrunning:notepad.exe</strong></td><td><em>test if Notepad is running</em></td><td></td></tr><tr><td><strong>@ifrunning:!note</strong>*</td><td><em>test if a process starting with "note" is not running</em></td><td></td></tr><tr><td><strong>@ifrunning:else</strong></td><td><em>an "else" clause that is executed if the process doesn't exist</em></td><td></td></tr><tr><td><strong>@ifrunning:common</strong></td><td><em>common instructions that are always executed</em></td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td>@keydown</td><td></td><td></td></tr></tbody></table><p>Allows simple conditional behaviour based on whether various qualifier keys are held down when the function is run.</p><p>The qualifiers to test for are specified using one or more keywords (<strong>shift</strong>, <strong>ctrl</strong> and <strong>alt</strong>) which represent the Shift, Ctrl and Alt keys. For example, you could configure a button to select all files, then copy, move or create shortcuts to them, depending on which keys were held down.</p><pre><code>Select ALL              // select all items (always executed)
@keydown:none           // if no qualifiers are down
Copy                    // copy files to destination
@keydown:shift          // else if shift key is down
Copy MOVE               // move files to destination
@keydown:ctrlshift      // else if both control and shift keys are down
Copy MAKELINK           // make shortcuts in destination
</code></pre><p>The possible forms of this modifier are:</p><table><thead><tr><th></th><th></th><th></th></tr></thead><tbody><tr><td><strong>@keydown:</strong><em>&#x3C;qualifiers></em></td><td><em>test for a qualifier key or combination of keys</em></td><td></td></tr><tr><td><strong>@keydown:!</strong><em>&#x3C;qualifiers></em></td><td><em>test for a qualifier key or combination of keys NOT being down</em></td><td></td></tr><tr><td><strong>@keydown:any</strong></td><td>// tests if <strong>any</strong> qualifier keys are held down*| |<strong>@keydown:none</strong>|<em>instructions that are executed if no qualifiers are held down</em>| |<strong>@keydown:common</strong>|*common instructions that are always executed//</td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td>@label</td><td></td><td></td></tr></tbody></table><p>TOBEDONE</p><p>If something modifies variables, or other factors that affect dynamic labels, it should notify Opus so labels and toolbar layouts can be updated. Commands should use <strong>@toggle:update</strong> (see below) and scripts can use <a href="../scripting_reference/scripting_objects/command">Command.UpdateToggle</a> to do this.</p></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td><strong>@ifpath:</strong><em>&#x3C;path or wildcard></em></td><td><em>test for a path (using standard pattern matching)</em></td><td></td><td></td><td></td></tr><tr><td><strong>@ifpathr:</strong><em>&#x3C;regular expression></em></td><td><em>test for a path (using regular expressions)</em></td><td></td><td></td><td></td></tr><tr><td><strong>@ifpath:else</strong></td><td><em>an "else" clause that is executed if nothing else matches</em></td><td></td><td></td><td></td></tr><tr><td><strong>@ifpath:common</strong></td><td><em>common instructions that are always executed</em></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td><strong>@ifpath:C:\Program Files</strong></td><td><em>Tests you are in C:\Program Files</em></td><td></td><td></td><td></td></tr><tr><td><strong>@ifpath:!C:\Program Files</strong></td><td><em>Tests you are anywhere but C:\Program Files</em></td><td></td><td></td><td></td></tr><tr><td><strong>@ifpath:C:\Program Files\</strong>*</td><td><em>Tests you're in a folder below C:\Program Files (does not include Program Files itself)</em></td><td></td><td></td><td></td></tr><tr><td><strong>@ifpath:!C:\Program Files\</strong>*</td><td><em>Tests you are not in a folder below C:\Program Files</em></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td>@ifrunning</td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td><strong>@ifrunning:notepad.exe</strong></td><td><em>test if Notepad is running</em></td><td></td><td></td><td></td></tr><tr><td><strong>@ifrunning:!note</strong>*</td><td><em>test if a process starting with "note" is not running</em></td><td></td><td></td><td></td></tr><tr><td><strong>@ifrunning:else</strong></td><td><em>an "else" clause that is executed if the process doesn't exist</em></td><td></td><td></td><td></td></tr><tr><td><strong>@ifrunning:common</strong></td><td><em>common instructions that are always executed</em></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td>@keydown</td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td><strong>@keydown:</strong><em>&#x3C;qualifiers></em></td><td><em>test for a qualifier key or combination of keys</em></td><td></td><td></td><td></td></tr><tr><td><strong>@keydown:!</strong><em>&#x3C;qualifiers></em></td><td><em>test for a qualifier key or combination of keys NOT being down</em></td><td></td><td></td><td></td></tr><tr><td><strong>@keydown:any</strong></td><td>// tests if <strong>any</strong> qualifier keys are held down*| |<strong>@keydown:none</strong>|<em>instructions that are executed if no qualifiers are held down</em>| |<strong>@keydown:common</strong>|*common instructions that are always executed//</td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td>@label</td><td></td><td></td><td></td><td></td></tr><tr><td>@leavedoswindowopen</td><td><p>The console window opened for an <a href="../../customize/creating_your_own_buttons/ms-dos_batch_commands">MS-DOS batch function</a> will remain open when the function has completed. Without this modifier the window will close when the function finishes, which may make it hard to read the output of any command-line programs.<br>Leaving the DOS window opens relies on passing a particular argument (<strong>/K</strong>) to the system command interpreter, <strong>cmd.exe</strong>. If you have modified the default command processor on your system by setting the <strong>%ComSpec%</strong> environment variable, Opus will not pass <strong>/K</strong> as there is no way for it to know if this argument would be understood by the new command processor. Instead, you can set the <strong>%ComSpecLeaveOpenArg%</strong> environment variable, and this will be used instead of <strong>%ComSpec%</strong> whenever <strong>@leavedoswindowopen</strong> is used.</p><table><thead><tr><th></th><th></th><th></th></tr></thead><tbody><tr><td><strong>@leavedoswindowopen</strong></td><td><em>leave DOS prompt open when function finishes</em></td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td>@logusage</td><td></td><td></td></tr></tbody></table><p>Instructs Windows to log usage of programs or documents opened by this function. Typically this means any files used will be added to the recent documents list, and any programs that are launched are added to the recent applications list.</p><table><thead><tr><th></th><th></th><th></th></tr></thead><tbody><tr><td><strong>@logusage</strong></td><td><em>log usage of files and applications</em></td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td>@nocall</td><td></td><td></td></tr></tbody></table><p>An <a href="../../customize/creating_your_own_buttons/ms-dos_batch_commands">MS-DOS batch function</a> function that invokes an external <strong>.bat</strong> file will run it directly, rather than using <em><strong>call</strong></em> semantics. This means that control will not return to the parent function once the external <strong>.bat</strong> file has finished. The default behaviour is to use the DOS <strong>call</strong> instruction which returns control to the parent function at the end.</p><table><thead><tr><th></th><th></th><th></th></tr></thead><tbody><tr><td><strong>@nocall:</strong><em>&#x3C;batch file></em></td><td><em>invoke external batch file, do not return control to this function</em></td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td>@nodeselect</td><td></td><td></td></tr></tbody></table><p>Files and folders will remain selected at the end of the function. This lets you override the <strong>Deselect files used in functions</strong> option on the <a href="../../preferences/preferences_categories/file_operations/options"><strong>File Operations / Options</strong></a> page in Preferences, on a per-function basis.</p><table><thead><tr><th></th><th></th><th></th></tr></thead><tbody><tr><td><strong>@nodeselect</strong></td><td><em>do not deselect items used by this function</em></td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td>@noexpandenv</td><td></td><td></td></tr></tbody></table><p>Prevent the expansion of any environment variables in the function. Normally environment variables like <strong>%USERPROFILE%</strong> are expanded during the function parsing phase - this modifier causes variable names to be left intact.</p><table><thead><tr><th></th><th></th><th></th></tr></thead><tbody><tr><td><strong>@noexpandenv</strong></td><td><em>do not expand environment variables</em></td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td>@nofilenamequoting</td><td></td><td></td></tr></tbody></table><p>Disables the automatic quoting that Opus performs when <a href="external_control_codes">external codes</a> like <strong>{filepath}</strong> are used to pass the name of a file that contains spaces. By default Opus will wrap names with embedded spaces in quotes, but occasionally you may want to disable this - some external programs may not need or understand quotes on their command line, and you may also want to provide explicit quotes in a function in case the automatic quoting gets confused by complicated command structures.</p><table><thead><tr><th></th><th></th><th></th></tr></thead><tbody><tr><td><strong>@nofilenamequoting</strong></td><td><em>do not automatically quote file names and paths</em></td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td>@nolocalizefiles</td><td></td><td></td></tr></tbody></table><p>Prevents Opus from automatically downloading or extracting non-filesystem files when passing their paths to external programs. For example, you may want to use <strong>{filepath}</strong> to pass the <strong>ftp://</strong> path of a file on a remote FTP server to an external program. By default Opus will download the file to a temporary file, and pass the name of the temporary file to the program - with this modifier, Opus will instead pass the original file path.</p><table><thead><tr><th></th><th></th><th></th></tr></thead><tbody><tr><td><strong>@nolocalizefiles</strong></td><td><em>do not automatically localize (download) remote files</em></td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td>@noprogress</td><td></td><td></td></tr></tbody></table><p>Disables the automatic display of a progress indicator for this function. You should use this with care as without a progress indicator there is no way to abort the command or monitor its progress. Normally only script functions should use this when they want to provide and control their own progress indicator.</p><table><thead><tr><th></th><th></th><th></th></tr></thead><tbody><tr><td><strong>@noprogress</strong></td><td><em>do not display an automatic progress dialog for this function</em></td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td>@norunbatch</td><td></td><td></td></tr></tbody></table><p>When an <a href="../../customize/creating_your_own_buttons/ms-dos_batch_commands">MS-DOS batch function</a> combines internal and external commands, the default behaviour is for Opus to split the function at every internal command, and execute all the external commands that came before it. For example, imagine the following (rather pointless) function:</p><pre><code>echo one
Help ABOUT
echo two
@leavedoswindowopen
</code></pre><p>The default behaviour of this function would be to open a DOS window and print the string "one", then display the Opus <strong>About</strong> dialog, and then open another DOS window and print the string "two". If, however, the function were changed as follows:</p><pre><code>@norunbatch
echo one
Help ABOUT
echo two
@leavedoswindowopen
</code></pre><p>The new behaviour would be to first display the <strong>About</strong> dialog, and then open a single DOS window and print both the strings "one" and "two". The <strong>@norunbatch</strong> modifier causes all Opus internal commands to be executed first, followed by all external commands.</p><table><thead><tr><th></th><th></th><th></th></tr></thead><tbody><tr><td><strong>@norunbatch</strong></td><td><em>do not split batch functions because of internal commands</em></td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td>@output</td><td></td><td></td></tr></tbody></table><p>Outputs all text on the rest of the line to the Script Log. Useful for debugging. The output can also be viewed in the Command Editor when its *Run With Logging* mode is on.</p><table><thead><tr><th></th><th></th><th></th><th></th></tr></thead><tbody><tr><td><strong>@output</strong> <em>&#x3C;message></em></td><td><em>sends &#x3C;message> to the Script Log</em></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td></tr><tr><td>@perfile</td><td></td><td></td><td></td></tr></tbody></table><p>Allows a block of commands to be run once per file. Normally, functions containing multiple command lines run each command separately for all selected files.</p><p>For example,</p><pre><code>echo 1 {file}
echo 2 {file}
</code></pre><p>With two files, "Apple.txt" and "Banana.txt" selected, this would output:</p><pre><code>1 Apple.txt
1 Banana.txt
2 Apple.txt
2 Banana.txt
</code></pre><p>Using <strong>@perfile</strong> around these commands like so:</p><pre><code>@perfile:begin
echo 1 {file}
echo 2 {file}
@perfile:end
</code></pre><p>This would output:</p><pre><code>1 Apple.txt
2 Apple.txt
1 Banana.txt
2 Banana.txt
</code></pre><p>Use <strong>@perfile:begin</strong> to mark the beginning of the per-file block and <strong>@perfile:end</strong> to mark the end.</p></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td><strong>@leavedoswindowopen</strong></td><td><em>leave DOS prompt open when function finishes</em></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td>@logusage</td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td><strong>@logusage</strong></td><td><em>log usage of files and applications</em></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td>@nocall</td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td><strong>@nocall:</strong><em>&#x3C;batch file></em></td><td><em>invoke external batch file, do not return control to this function</em></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td>@nodeselect</td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td><strong>@nodeselect</strong></td><td><em>do not deselect items used by this function</em></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td>@noexpandenv</td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td><strong>@noexpandenv</strong></td><td><em>do not expand environment variables</em></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td>@nofilenamequoting</td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td><strong>@nofilenamequoting</strong></td><td><em>do not automatically quote file names and paths</em></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td>@nolocalizefiles</td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td><strong>@nolocalizefiles</strong></td><td><em>do not automatically localize (download) remote files</em></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td>@noprogress</td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td><strong>@noprogress</strong></td><td><em>do not display an automatic progress dialog for this function</em></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td>@norunbatch</td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td><strong>@norunbatch</strong></td><td><em>do not split batch functions because of internal commands</em></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td>@output</td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td><strong>@output</strong> <em>&#x3C;message></em></td><td><em>sends &#x3C;message> to the Script Log</em></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td>@perfile</td><td></td><td></td><td></td><td></td></tr><tr><td>@resolvelinks</td><td><p>Shortcuts or links passed to commands in this function will be resolved to their targets. Without this modifier, a selected <strong>.lnk</strong> file would be passed as-is.</p><table><thead><tr><th></th><th></th><th></th></tr></thead><tbody><tr><td><strong>@resolvelinks</strong></td><td><em>resolve shortcut targets when passing filenames to commands</em></td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td>@runbatch</td><td></td><td></td></tr></tbody></table><p>Force the execution of an MS-DOS batch function at a certain point. The default behaviour is for such functions to be executed at the very end of the function - using this modifier you can force a break in the function at any line. For example:</p><pre><code>echo one
@runbatch
echo two
@leavedoswindowopen
</code></pre><p>This will cause two separate DOS windows to open, one displaying the text "one" and the other displaying "two". Without the <strong>@runbatch</strong> directive, the two commands would have been executed in the one window.</p><table><thead><tr><th></th><th></th><th></th></tr></thead><tbody><tr><td><strong>@runbatch</strong></td><td><em>force a DOS batch function to execute at a certain point</em></td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td>@runmode</td><td></td><td></td></tr></tbody></table><p>Modifies the "run" state of external programs launched by the function - that is, how its main window should appear. This is equivalent to the <strong>Run</strong> drop-down on the <a href="../../customize/creating_your_own_buttons/command_editor/simple_command_editor">simple command editor</a>. Not all programs will support this setting, so you will need to use trial and error to some extent. You should only set the mode to <strong>hide</strong> if you are sure of what you are doing - it is most useful for hiding the otherwise brief flash of a DOS window when running a DOS program.</p><table><thead><tr><th></th><th></th><th></th></tr></thead><tbody><tr><td><strong>@runmode:min</strong></td><td><em>minimize the program's main window</em></td><td></td></tr><tr><td><strong>@runmode:max</strong></td><td><em>maximize the program's main window</em></td><td></td></tr><tr><td><strong>@runmode:hide</strong></td><td><em>hide the program's main window</em></td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td>@runonce</td><td></td><td></td></tr></tbody></table><p>Forces the command following the modifier to only be run once per function, instead of once per file.</p><table><thead><tr><th></th><th></th><th></th></tr></thead><tbody><tr><td><strong>@runonce:</strong><em>&#x3C;command></em></td><td><em>the specified command will only be run once</em></td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td>@script</td><td></td><td></td></tr></tbody></table><p>Specifies the scripting language used for a script. This is mainly used for <a href="../../customize/creating_your_own_buttons/embedding_rename_scripts">embedded rename scripts</a>, because otherwise the script language is selected via a drop-down at the top of the script editor. The <strong>@script</strong> modifier must be followed by a keyword that specifies the scripting language (or in the case of <a href="../../scripting/script_add-ins">script add-ins</a>, the file extension of the add-in itself specifies the language).</p><p>For example,</p><pre><code>Rename PATTERN * TO *
@script:vbscript
Function ....
</code></pre><table><thead><tr><th></th><th></th><th></th></tr></thead><tbody><tr><td><strong>@script:</strong><em>&#x3C;language></em></td><td><em>specifies scripting language for Rename command</em></td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td>@set</td><td></td><td></td></tr></tbody></table><p>Sets the value of a named variable that can be used by the remainder of the commands in the function. You can pass the value of a variable to internal and external commands using the <strong>{$}</strong> <a href="external_control_codes/codes_for_clipboard_and_variables">control code</a>. Variables are most useful in the situation where the value is defined by a <strong>{dlgstring}</strong> code. For example,</p><pre><code>@set dir={dlgstring|Enter new folder name to copy files to}
CreateFolder ".\{$dir}"
Copy TO ".\{$dir}"
</code></pre><p>Normally, variables do not persist from one invocation of the function to another, and you can not refer to variables set in one function from another. However this can be accomplished by prefixing the variable name with a special scope marker that determines which scope the variable will live in.</p><table><thead><tr><th></th><th></th></tr></thead><tbody><tr><td><strong>src:</strong><em>&#x3C;name></em></td><td><em>variable will be scoped to the source folder tab</em></td></tr><tr><td><strong>dst:</strong><em>&#x3C;name></em></td><td><em>variable will be scoped to the destination folder tab</em></td></tr><tr><td><strong>left:</strong><em>&#x3C;name></em></td><td><em>variable will be scoped to the left folder tab</em></td></tr><tr><td><strong>right:</strong><em>&#x3C;name></em></td><td><em>variable will be scoped to the right folder tab</em></td></tr><tr><td><strong>tab:</strong><em>&#x3C;name></em></td><td><em>variable will be scoped to the active folder tab (see below)</em></td></tr><tr><td><strong>lst:</strong><em>&#x3C;name></em></td><td><em>variable will be scoped to the Lister (the whole window)</em></td></tr><tr><td><strong>glob:</strong><em>&#x3C;name></em></td><td><em>variable will be scoped globally</em></td></tr></tbody></table><p>The <strong>src:</strong> and <strong>tab:</strong> scopes usually point to the same folder tab within commands. (The <strong>tab:</strong> scope was introduced so that <a href="../status_bar_codes/other_codes">status bar codes which use variables</a> can refer to the side that the status bar is on, without worrying if it is the source, destination, left or right. It is supported in commands for consistency.)</p><p>You can also mark variables to be saved on disk - their values will be remembered from one Opus session to the next. To accomplish this, simply add an exclamation mark (!) to the scope marker. For example,</p><table><thead><tr><th></th><th></th></tr></thead><tbody><tr><td><strong>glob!:</strong><em>&#x3C;name></em></td><td><em>refers to a variable with global scope that will be saved on disk.</em></td></tr><tr><td><strong>@set</strong> <em>&#x3C;name></em><strong>=</strong><em>&#x3C;value></em></td><td><em>sets the named variable to the specified value</em></td></tr><tr><td><strong>@set</strong> <em>&#x3C;name></em></td><td><em>deletes the named variable</em></td></tr></tbody></table><p>If you have buttons or status bar codes which react to variable changes, you may need to run the special <strong>@toggle:update</strong> command to make them update their appearances after making changes to variables. See the <strong>@toggle</strong> documentation, below.</p></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td><strong>@resolvelinks</strong></td><td><em>resolve shortcut targets when passing filenames to commands</em></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td>@runbatch</td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td><strong>@runbatch</strong></td><td><em>force a DOS batch function to execute at a certain point</em></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td>@runmode</td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td><strong>@runmode:min</strong></td><td><em>minimize the program's main window</em></td><td></td><td></td><td></td></tr><tr><td><strong>@runmode:max</strong></td><td><em>maximize the program's main window</em></td><td></td><td></td><td></td></tr><tr><td><strong>@runmode:hide</strong></td><td><em>hide the program's main window</em></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td>@runonce</td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td><strong>@runonce:</strong><em>&#x3C;command></em></td><td><em>the specified command will only be run once</em></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td>@script</td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td><strong>@script:</strong><em>&#x3C;language></em></td><td><em>specifies scripting language for Rename command</em></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td>@set</td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td><strong>src:</strong><em>&#x3C;name></em></td><td><em>variable will be scoped to the source folder tab</em></td><td></td><td></td><td></td></tr><tr><td><strong>dst:</strong><em>&#x3C;name></em></td><td><em>variable will be scoped to the destination folder tab</em></td><td></td><td></td><td></td></tr><tr><td><strong>left:</strong><em>&#x3C;name></em></td><td><em>variable will be scoped to the left folder tab</em></td><td></td><td></td><td></td></tr><tr><td><strong>right:</strong><em>&#x3C;name></em></td><td><em>variable will be scoped to the right folder tab</em></td><td></td><td></td><td></td></tr><tr><td><strong>tab:</strong><em>&#x3C;name></em></td><td><em>variable will be scoped to the active folder tab (see below)</em></td><td></td><td></td><td></td></tr><tr><td><strong>lst:</strong><em>&#x3C;name></em></td><td><em>variable will be scoped to the Lister (the whole window)</em></td><td></td><td></td><td></td></tr><tr><td><strong>glob:</strong><em>&#x3C;name></em></td><td><em>variable will be scoped globally</em></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td><strong>glob!:</strong><em>&#x3C;name></em></td><td><em>refers to a variable with global scope that will be saved on disk.</em></td><td></td><td></td><td></td></tr><tr><td><strong>@set</strong> <em>&#x3C;name></em><strong>=</strong><em>&#x3C;value></em></td><td><em>sets the named variable to the specified value</em></td><td></td><td></td><td></td></tr><tr><td><strong>@set</strong> <em>&#x3C;name></em></td><td><em>deletes the named variable</em></td><td></td><td></td><td></td></tr><tr><td>@showif</td><td><p>The button will be shown if a command clause test is false. This is similar to the conditional testing offered by the <strong>@if</strong> modifier.</p><table><thead><tr><th></th><th></th><th></th></tr></thead><tbody><tr><td><strong>@showif:Set DUAL=toggle</strong></td><td><em>button will be shown if the Lister is in dual-display mode</em></td><td></td></tr><tr><td><strong>@showif:!Set DUAL=toggle</strong></td><td><em>button will be shown if the Lister is NOT in dual-display mode</em></td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td>@sendkey</td><td></td><td></td></tr></tbody></table><p>Sends the specified keystroke to the system. The key will be routed to whichever window currently has focus. For example, <code>@sendkey:win+v</code> sends the Win+V key to the system, which opens the Windows clipboard viewer.</p><p>Supported qualifier keys are <code>shift</code>, <code>ctrl</code>, <code>alt</code> and <code>win</code>.</p><p>As well as letters and numbers, the following named keys are also supported: <code>backspace</code>, <code>capslock</code>, <code>delete</code>, <code>down</code>, <code>end</code>, <code>enter</code>, <code>escape</code>, <code>home</code>, <code>insert</code>, <code>left</code>, <code>numlock</code>, <code>pagedown</code>, <code>pageup</code>, <code>pause</code>, <code>printscr</code>, <code>right</code>, <code>scrlock</code>, <code>space</code>, <code>tab</code>, <code>up</code>.</p></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td><strong>@showif:Set DUAL=toggle</strong></td><td><em>button will be shown if the Lister is in dual-display mode</em></td><td></td><td></td><td></td></tr><tr><td><strong>@showif:!Set DUAL=toggle</strong></td><td><em>button will be shown if the Lister is NOT in dual-display mode</em></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td>@sendkey</td><td></td><td></td><td></td><td></td></tr><tr><td>@showifpath<br>@showifpathr</td><td><p>The button will be shown if the current source path doesn't match the specified pattern. You can provide either an absolute path to test against, or a wildcard pattern (use <strong>@showifpath</strong> for <a href="../wildcard_reference/pattern_matching_syntax">standard wildcards</a>, and <strong>@showifpathr</strong> for <a href="../wildcard_reference/regular_expression_syntax">regular expressions</a>).</p><table><thead><tr><th></th><th></th></tr></thead><tbody><tr><td><strong>@showifpathr:^C:\</strong></td><td><em>show command if source path is on the C: drive</em></td></tr><tr><td><strong>@showifpath:!*\Work\</strong>*</td><td><em>show unless source path is underneath a folder called <strong>Work</strong></em></td></tr></tbody></table><p>Paths may use aliases, environment variables, {apppath} codes, and so on, only when using wildcards (not regular expressions):</p><table><thead><tr><th></th><th></th><th></th></tr></thead><tbody><tr><td><strong>@showifpath:!/desktop</strong></td><td><em>show unless in the Desktop folder</em></td><td></td></tr><tr><td><strong>@showifpath:!%SystemRoot%\System32</strong></td><td><em>show unless in <strong>C:\Windows\System32</strong> (on a typical system)</em></td><td></td></tr><tr><td><strong>@showifpath:{apppath|dopus.exe}</strong></td><td><em>show if in the folder where Opus is installed</em></td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td>@sync</td><td></td><td></td></tr></tbody></table><p>The command following this modifier will be run synchronously - Opus will wait for it to exit before running the next command in the function (or before running this command again for the next selected file).</p><p>The default behaviour is for a function that consists of a single command to run that command asynchronously for each selected file; a function that consists of multiple commands will run each command synchronously. The default behaviour can be changed with the <strong>function_default_async</strong> option on the <a href="../../preferences/preferences_categories/miscellaneous/advanced_options"><strong>Miscellaneous / Advanced</strong></a> page in Preferences, or it can be overridden on a per-command basis with this modifier.</p><table><thead><tr><th></th><th></th><th></th></tr></thead><tbody><tr><td><strong>@sync:notepad.exe {f}</strong></td><td><em>runs Notepad synchronously</em></td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td>@toggle</td><td></td><td></td></tr></tbody></table><p>For buttons that indicate or change state (e.g. <strong>Set VIEW=details</strong>), this modifier lets you change when the button appears highlighted.</p><p>Depending on where the button is displayed, the highlight may appear as a checkmark (e.g. in a text-only menu), or as the icon or label background being drawn in a different color or style (similar to when the button is pushed).</p><p>Taking the <strong>Set VIEW=details</strong> command as an example, ordinarily the button would appear highlighted when the file display was in details mode, and not highlighted when it was in any other mode. The <strong>@toggle</strong> modifier can change this:</p><table><thead><tr><th></th><th></th></tr></thead><tbody><tr><td><strong>@toggle:invert</strong></td><td><em>inverts the usual highlight state of the toolbar button</em></td></tr><tr><td><strong>@toggle:disable</strong></td><td><em>prevents the button from ever appearing highlighted</em></td></tr></tbody></table><p>The @<strong>toggle</strong> modifier can also control when a button appears highlighted by testing a command, similar to the way <strong>@if</strong> and <strong>@ifset</strong> test commands to decide what to run**.** You can use this to highlight a button based on a command which is different to, or in addition to, the commands which the button actually runs.</p><p>For example, this button with no <strong>@toggle</strong> line will switch you to <em>Details</em> mode when clicked, and will appear highlighted when you are in <em>Details</em> mode as well:</p><pre><code>Set VIEW=Details
</code></pre><p>When <strong>@toggle</strong> is not given, the highlighting (if any) is based on the first command in the button.</p><p>Using <strong>@toggle</strong> you can do things like run one <strong>Set</strong> command while testing for another. As a simple, somewhat contrived example, the button below switches to <em>Details</em> mode when clicked but appears highlighted when in <em>Power</em> mode:</p><pre><code>Set VIEW=Details
@toggle:if Set VIEW=Power
</code></pre><p>You can make the <strong>@toggle</strong> test in addition to the first command, rather than instead of it, by putting an "&#x26;" character after the "if":</p><pre><code>Set VIEW=Details
Set COLUMNSADD=thumbnail(0,96)
@toggle:if&#x26;Set COLUMNSTOGGLE=thumbnail
</code></pre><p>Without the <strong>@toggle</strong> line, the button above would be highlighted when the view mode was <em>Details</em> (due to the command) and the highlight would not be affected by the <em>Thumbnail</em> column (highlighting does not consider the second command). With the <strong>@toggle</strong> line added, the button will only be highlighted if the view mode is set to <em>Details</em> and the <em>Thumbnail</em> column is present.<br>You can omit the "Set" command name from the <strong>@toggle</strong> line; it will assume you mean the <strong>Set</strong> command if no name is specified. However, this allowance is to avoid breaking old buttons and we recommend you always specify the command when making new ones.</p><p>You can test for multiple commands at once by separating them with semi-colons. For example, you could leave out the ampersand and still test for both <em>Details</em> mode and the <em>Thumbnail</em> column using the following directive (and this will work regardless of any other commands in the button, or even as the only line in the button):</p><pre><code>@toggle:if Set VIEW=Details;Set COLUMNSTOGGLE=thumbnail
</code></pre><p>You can also negate the result of a test with the exclamation mark in front of the <strong>Set</strong> clause. For example, to make the button appear checked in any mode other than Details:</p><pre><code>@toggle:if !Set VIEW=Details
</code></pre><p>The <strong>@toggle</strong> directive can also test for the existence of a variable (one set via the <strong>@set</strong> directive). For this to work, the directive must be the very first line of the button, and the variable you are testing must have tab, Lister or global scope. You can use this to create your own custom toggle buttons that keep track of their state using scoped variables. For example:</p><pre><code>@toggle:if $glob:TestVar
@if:$glob:TestVar
@set glob:TestVar
@if:else
@set glob:TestVar=on
</code></pre><p>This button tests for the existence of a global variable called <em>TestVar</em>. If the variable exists, the button will appear highlighted. Clicking the button evaluates the <strong>@ifset:</strong> directives and will reverse the state of the variable: if the variable is set, it will be deleted; otherwise, it will be set. The end result is a button that performs no function except to toggle a variable and its visible state each time it is clicked. (This can be useful if the variable controls other things, such as the behaviors of other commands or scripts, or the visibility of <a href="../status_bar_codes/other_codes">status bar elements</a>.)</p><p>A button that begins with <strong>@toggle:if</strong> in this way will automatically update its appearance (to reflect a change in the state of the variable) whenever <strong>@set</strong> is used within it. If you use <strong>@set</strong> in a separate button or hotkey to change the variable, you need to force an update of the toggle button's appearance using the special command <strong>@toggle:update</strong>.</p><p>For example, if you have one button which highlights based on a variable but does not change that variable:</p><pre><code>@toggle:if $glob:TestVar
</code></pre><p>And if you have another button which changes that variable but does not highlight based on it, then you will need to add the <strong>@toggle:update</strong> line to ensure the first button's highlight is updated when you click the second button:</p><pre><code>@if:$glob:TestVar
@set glob:TestVar
@if:else
@set glob:TestVar=on
@if:common
@toggle:update
</code></pre><p>The <strong>@toggle:update</strong> command will also force all <strong>status bars</strong> to refresh, in case they are <a href="../status_bar_codes/other_codes">using variables</a> to display or hide information.</p><p>You can also use <strong>@toggle:update</strong> to ensure buttons with dynamic labels (via <strong>@label</strong>, above) are updated after changing variables or other details the label depends on. This also ensures toolbar layouts are adjusted if the label widths change.</p></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td><strong>@showifpathr:^C:\</strong></td><td><em>show command if source path is on the C: drive</em></td><td></td><td></td><td></td></tr><tr><td><strong>@showifpath:!*\Work\</strong>*</td><td><em>show unless source path is underneath a folder called <strong>Work</strong></em></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td><strong>@showifpath:!/desktop</strong></td><td><em>show unless in the Desktop folder</em></td><td></td><td></td><td></td></tr><tr><td><strong>@showifpath:!%SystemRoot%\System32</strong></td><td><em>show unless in <strong>C:\Windows\System32</strong> (on a typical system)</em></td><td></td><td></td><td></td></tr><tr><td><strong>@showifpath:{apppath|dopus.exe}</strong></td><td><em>show if in the folder where Opus is installed</em></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td>@sync</td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td><strong>@sync:notepad.exe {f}</strong></td><td><em>runs Notepad synchronously</em></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td>@toggle</td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td><strong>@toggle:invert</strong></td><td><em>inverts the usual highlight state of the toolbar button</em></td><td></td><td></td><td></td></tr><tr><td><strong>@toggle:disable</strong></td><td><em>prevents the button from ever appearing highlighted</em></td><td></td><td></td><td></td></tr><tr><td>@useactivelister</td><td><p>The function will operate on the active Lister rather than the current source Lister. Normally these will be the same thing, but this could be useful for a hotkey that you want to have operate on whatever Lister window is currently active, without having to make sure that Lister is set to source first.</p><table><thead><tr><th></th><th></th></tr></thead><tbody><tr><td><strong>@useactivelister</strong></td><td><em>use active Lister instead of source lister</em></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr></tbody></table></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td><strong>@useactivelister</strong></td><td><em>use active Lister instead of source lister</em></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr></tbody></table>
