aka "
How UserVars makes my QAP-life easier".
User Variables are simplicity in action, easy to define and easy to use, as Jean documents here:
Can I create custom user variables and use them in file paths or snippets?
https://www.quickaccesspopup.com/can-i-c...-snippets/
The really, really, REALLY nice thing with this feature is the "stupid" way QAP interprets UserVars.
QAP just takes the UserVar and substitutes it with the text string, no worries about double quotation marks, spaces or special characters in the UserVar definition.
That has to be handled in the Application or Parameters field of the favorite, as I prefer it, clean and simple. (More on that below).
Example - Command Line tools:
Usually when double clicking on a command line tool a window briefly opens and then closes immediately making it impossible to see what actually happens.
There are basically two ways of handling this, use QAP to call a script that calls the tool and keeps the window open, or use switches/options when calling cmd.exe.
I have enough scripts to maintain so I use the second option, the minor drawback is that you have to manually close the window.
- UserVar:
{cmdopt}=/Q /T:1E /K
- App field: cmd
- Param field: {cmdopt} (path to the tool, see below)
Example - Long paths with spaces:
I use several free tools by Sysinternals (Microsoft), and have them in a folder structure that is pretty deep, so a Uservar it is.
- UserVar:
{sysinternals}=C:\PAF\PortableApps\WSCCPortable\App\WSCC\SysInternals Suite\
(Note the space in the path).
Example - Putting it together to call psping64.exe:
PSping is a command line ping tool that does some simple measurements.
- App field: cmd
- Param field:
{cmdopt} "{sysinternals}psping64.exe" -b {Input:Enter IP or Hostname}
(Note the double quotation marks, cmd requires those when the path includes a space)
Putting it all together, the "Groups" startup sequence:
In another tip I mentioned using the Group function to remotely start a batch of virtual machines. For that I use the Sysinternals tool psexec.exe.
Here is the actual favorite to start one of them.
- App field: {sysinternals}psexec64.exe
- Param field: \\{VM1} {ScriptDir}{PWScriptStart} {VM1D0} {VMprefix}DC02 {PWrun}
In short order the parameters are: The server, where the script is located, the script to run, the location of the virtual machine, the lab group it belongs to, the name of the virtual machine and a start option.
This, App + Param, expands into a very long command line......around 160 characters, but QAP don't mind, it just executes the command.
I wonder if I can get QAP to crash with a command line that is just too long?
(Have to try that one day).
As mentioned elsewhere I use Shared Menus a lot, and on several machines.
But, UserVars are local for each machine.
So, if I do some changes I only have to change the local UserVar, and keep the Shared Menu.
Right now I have 31 UserVars in QAP.
Hopefully this gave someone some ideas on how to utilize UserVars.
Regards,
joeNOR