You can insert values from placeholders in Snippets content and in favorite’s Location, Parameters, Launch with and Start In fields (for all types of favorites supporting these options). When inserted in your favorites, placeholders can be replaced with text based on:
See also:
How can I use placeholders in favorites location, parameters, snippet text, etc.?
Debugging placeholders and user variables
Placeholders in favorites name
Clipboard
You can use the Windows Clipboard to insert variable pieces of text in your snippets or in various paths in favorites dialog box. When you launch your favorite, QAP automatically replaces the placeholder “{Clipboard}” (without the quotes) with the current text in the Windows Clipboard.
For example, in the following Snippet example, the Clipboard’s content will be inserted in the second line between the arrows. If the Clipboard contains an image or binary data, nothing is inserted.
In this second example, the content of the clipboard is sent as parameter. The content of the Parameters zone is expanded in the preview zone named Current parameters with expanded placeholders at the bottom of the dialog box. It shows what would be the parameter sent to the application with the current Clipboard’s content.
The example above is a working example for browsers applications Chrome, Firefox and Internet Explorer. This parameter will automatically launch your browser to search for the text contained in your Windows Clipboard. Make sure you include the quotes correctly to include all word in the search. If you want to search for an exact expression, add surrounding quotes like this: "? \"{Clipboard}\""
(these browsers consider the backslash “\” as an escape character for quotes inside the parameter).
If you use the browser Microsoft Edge, simply enter in the Parameters zone {Clipboard}
(no quotes) for a normal search or "{Clipboard}"
(with quotes) to search for an expression.
Text selected
Starting with QAP v11.6.3, you can use the placeholder {SelectedText} that will be replaced with the text selected in the active window. This can also be selected contents in other formats than plain text, for example cells in a spreadsheet, as long as a text-only version of this content is copied to the Clipboard by the active application. This cannot be an image.
See the Clipboard section above for similar example of usage of the {SelectedText} placeholder.
Note: Some applications may not react as expected when QAP tries to copy the selected text. If the copy does not succeed, the placeholder is simply deleted.
Using the placeholder {Input:prompt}
you can enter a different content at each launch of a snippet or favorite.
The prompt inside the parameter will be displayed as a prompt in the input box, In the example below, QAP will open the folder c:\clients\ABC123
.
The content entered by the user can be re-used in the same favorite thanks to a temporary user variable named based on the prompt of the Input placeholder. For example, in a Snippet with a placeholder {Input:Enter Client ID}
, a temporary user variable named {Enter client ID}
would allow to paste the ID of the client again later in the same snippet.
Using the placeholder {Menu:prompt}
you can select a different item from a menu each time you launch a snippet or a favorite. The basic syntax for this placeholder is: {Menu:text1|text2|text3}. In this example, the text from the menu label (text1, text2, etc.) will be inserted in your favorite.
If you have long or multiline menu items, each item can be preceded with a shorter label using the tilde (~) as separator. For example: {Menu:label1~long or multiline text|label2~another item|…}. For better readability in the Edit favorite dialog box, the labels can include line breaks and tabs that will not be displayed in the menu.
Finally, you can make the first menu item bold to look like a title by starting the menu with an empty item with only a label. For example: {Menu:Title~|item label 1~item content 1|…}, as in this example:
Artist: {Menu:
Artists ~|
LD ~Leonardo DiCaprio|
TC ~Tom Cruise|
AS ~Arnold Schwarzenegger}.
Current date or time
The placeholder {Now:format}
inserts in favorite’s location or in a snippet the date or time at the moment the favorite is launched. The date and/or time is inserted following the syntax described in the AHK FormatTime command, for example:
- {Now:yyyy-MM-dd} -> 2022-03-13
- {Now:dddd hh:mm} -> Sunday 14:06
- {Now:MMMM d, yyyy h:mm tt} -> March 13, 2022 4:30 PM
In addition to the AHK format the format {Now:ld}
allows to insert the last day of the current month. You can combine this with other {Now:...}
placeholders to form a complete date, for example:
- {Now:ld} -> 28, 29, 30 or 31 depending on the current month
- {Now:MMMM} {Now:ld}, {Now:yyyy} -> February 28, 2022
These placeholders can be inserted in locations, for example:
C:\reports\{Now:yyyyMM}
for the folder of the current month (as in C:\reports\202203)
or in Snippets, for example:
Report sent on {Now:MMMM d, yyyy} at {Now:hh:mm tt}
Add UTC at the end of the format string to insert Universal Coordinated Time, for example: Report sent at {Now:h:mm UTC} UTC
Date and time calculation
You can also insert future or past dates and time using calculation with the following syntax:
{Now[sign][value pairs]:[format]}
- where
[sign]
is either +
(plus) or -
(minus);
[value pairs]
is one or more pairs of:
- a number (integer);
- a time unit identified by one of the letters
smhdMy
(case sensitive) for seconds, minutes, hours, days, Months or years;
- and
[format]
is the date or time format as described above.
For example (supposing we are March, 13, 2022 at 4h30 PM):
- {Now+1d:yyyy-MM-dd} (tomorrow)-> 2022-03-14
- {Now-1y6M:yyyy-MM-dd} (1.5 year ago) -> 2020-09-13
- {Now+3h30m:h:mm tt} (in 3.5 hour from now) -> 8:00 PM (or else, depending on regional settings)
- {Now-1M:yyyy-MM}-{Now-1M:ld} (last day of previous month) -> 2022-02-28
- {Now-30d:yyyy-MM-dd} (30 days ago) -> 2022-02-11
- {Now+1M10d:yyyy-MM-dd} (in 1 month and 10 days) -> 2022-04-23
- {Now-7h35m:HH:mm} time 7 hours and 35 minutes ago, in 24-hour format -> 08:55
Random text or number
The {RandomText:...} and {RandomNumber:...} are replaced by a random piece of text or number (integer or floating number) each time you launch a snippet or favorite.
- {RandomText:text1|text2|text3} is replaced with one of the three pieces of text (for example, {RandomText:Today|Tomorrow|One of these days})
- {RandomNumber:x|y} is replaced with an integer number between integers x and y (for example, {RandomNumber:5|10})
- {RandomNumber:x|y|n} is replaced with a floating point number between x and y with n decimals (for example, {RandomNumber:0.5|1.49|2}
GUID (Globally Unique ID)
The placeholder {GUID} placeholder is replaced with a different Globally Unique ID of 32 hex digits (128-bit) each time you use a favorite.
Placeholders in favorites name
Some placeholders can be inserted in favorites name. The most obvious usage is to insert a date in your menu. {NOW:…} will be replaced the date and time when the menu is built (or refreshed).
These placeholders can also be used if whenever someone finds a usage for this:
- {LOC}, {NAME}, etc. the favorite’s own location
- {SETTINGS_LOC}, {SETTINGS_NAME}, etc. the location of your Quick Access Popup settings file;
- {Clipboard}: content of the Clipboard when the menu is built
- {Input:prompt} and {Menu:prompt}: prompting user each time the menu is refreshed
- {RandomText:…} and {RandomNumber:…}, {GUID}: different at each refresh.
The other placeholders {CUR_…}, {SEL_…} and {ActiveWindow} are not applicable in the case of favorites names and will be replaced by an empty string. In all cases, if the resulting name is not unique, the suffix “[!]” will be added to the duplicate.