Here is a tip on how to combine User Variables with the Input-function and a couple of Snippets with Hotstrings. The solution described below was born because the simple nature (a very good thing) of the {Input:prompt} function does not allow me to define multiple choice.
Example:
This example describes how to choose between two editors (Visual Studio Code and Notepad Plus Plus) for opening a file that is selected in the file browser/manager. I use Directory Opus, but this should also work in the standard File Explorer. It is also easy to change to fit other needs/situations. The example consists of three parts.
- Defining two User Variables
- Defining the two Snippets to hold the User Variables.
- Defining the application favourite to trigger it all.
The two User Variables:- Go to Customize --> Options --> User Variables
- Create two UserVars that points to the exe files.
{vscode}=C:\Program Files\Microsoft VS Code\Code.exe
{npplus}=C:\Program Files\Notepad++\notepad++.exe
- Save
The two Snippets:
Visual Studio Code:- Add a favourite of type "Snippet" to your menu. Call it something like "VScode Snippet".
- In Basic Settings in the Content field add the UserVar pointing to the VScode exe, this one: {vscode}
- In Menu Options, click the "Change" button to the right of "Hotstring", and define a hotstring (I use the # sign and the letter V), also select "Do not wait for ending key".
Notepad++:- Add a favourite of type "Snippet" to your menu. Call it something like "NotepadPlus Snippet".
- In Basic Settings in the Content field add the UserVar pointing to the Notepad++ exe, this one: {npplus}
- In Menu Options, click the "Change" button to the right of "Hotstring", and define a hotstring (I use the # sign and the letter N), also select "Do not wait for ending key".
Save everything!
The Application favourite:- Add a favourite of type "Application" to your menu.
- In Basic Settings, in the Application field enter: {Input:SnippetKey}, in the Short name, call it MyEditors or something.
- In Menu Options, click the "Change" button to the right of "Shortcut", and define a shortcut (I use Win+z).
- In Advanced Settings, in the Parameters field, enter: "{SEL_LOC}" (including the quotation marks)
- Save
How to use:- Select a file (txt, cmd, bat or something) in your file manager, and hit Win+z
- The Input function then pops up, hit the # key and then V or N key. The Snippet function then fills the field with the path to the exe.
- Hit Enter, and the selected file opens in the editor.
Why not put the path to VScode and NPplus directly in the Snippet?
You can do that to remove the step defining the UserVar.
But I use Shared Menus on several machines, and the editors (in this example) aren't necessarily installed in the same location on all machines.
Enter the UserVars feature, User Variables are local to each machine so I can change them without the need to change anything in the shared menu.
A long read, but hopefully this tip can be useful for someone.....
Regards,
joeNOR