Jean Lalonde Support Forum

Full Version: [TIP] QAP variables, system variables and Special Folders. A mop-up post
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

joeNOR

This is a "mop-up" where I have tried to collect relevant information about variables in QAP, and how to use them.

Some basic information
Can I create custom user variables and use them in file paths or snippets?
A crash course in QAP-variables
Going a little bit nuts with User Variables
Combining User Variables, Snippets and Input

QAP Placeholders
Can I insert values in favorites location, parameters or snippets using placeholders?
Placeholders are special variables used by QAP to return different kind of values. They are not fixed/static and the returned value depends on other factors, f.ex a file you have selected in your file manager.

Tip!
To return a selected file or folder I tend to use only two of the placeholders.
Code:
"{SEL_LOC}" - Returns the absolute path and name of the file selected in the file manager.
"{CUR_LOC}" - Returns the absolute path of the current ("selected") folder in the file manager.
(NOTE! Always put these placeholders in double quotes to handle spaces in file and folder names)
See also this excellent post by scottkillen on the behavior of those placeholders:
Peculiar placeholders

CMD variables aka system variables
Using Windows system variables in your favorites
Can I use system environment variables in favorite paths?

Tip!
There are several ways of listing the values of the system variables, one of them is in a CMD window.
Code:
C:\>set
(type set and hit Enter, the system variables are listed.)

You can also pipe the output to a file:
set >%TEMP%\MySystemVariables.txt
notepad %TEMP%\MySystemVariables.txt

Special folders
What are these special folders in the “My Special Folders” menu?
How do I add Windows Special Folders to my menu?
QAP has extensive support for the "Windows Special Folders" in menus.
But these Special Folders can also be used/referenced with system variables and paths, or by assigning those to a QAP variable.

Example!
Here is an example with the Windows Special Folder: "Common Administrative Tools".
The folder:
Code:
Folder Name       : Common Administrative Tools
Folder Path       : C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Administrative Tools
Environment String Path: %ALLUSERSPROFILE%\Microsoft\Windows\Start Menu\Programs\Administrative Tools
Make a QAP variable:
Code:
{admintools}=%ALLUSERSPROFILE%\Microsoft\Windows\Start Menu\Programs\Administrative Tools
Create a favorite of type Folder.
Place the QAP variable in the Folder (path) entry, and your file manager jumps to that folder.

One easy way to list Special Folders on your system is with the tool SpecialFoldersView by NirSoft.
It is portable and does not require installation, it does not need elevation to admin to run.
I've also attached a text file, SpecialFoldersVariables.txt, this is a listing from one of my systems (Windows 10 x64 21H1) using SpecialFoldersView.

I hope this will get you started with variables in QAP, they are very useful.

Regards,
joeNOR

krunkerio

Wow. These are very useful tips, I love them. thank you for sharing!  Smile