|
1 | 1 | --- |
2 | 2 | titleTemplate: :title — PopClip Developer |
3 | 3 | --- |
| 4 | + |
4 | 5 | # Script variables |
5 | 6 |
|
6 | | -When calling a script from a PopClip extension, the script receives a set of variables that describe the context in which the action was triggered. These variables are available in JavaScript, Shell Script, and AppleScript actions. |
| 7 | +When calling a script from a PopClip extension, the script receives a set of |
| 8 | +variables that describe the context in which the action was triggered. These |
| 9 | +variables are available in JavaScript, Shell Script, and AppleScript actions. |
7 | 10 |
|
8 | 11 | ## JavaScript variables |
9 | 12 |
|
10 | | -In JavaScript, you access variables in the `popclip` global object. See [JavaScript environment](https://www.popclip.app/dev/js-environment). |
| 13 | +In JavaScript, you access variables as properties under the `popclip` global. |
| 14 | +See: |
| 15 | + |
| 16 | +- [`popclip.input`](https://pilotmoon.github.io/popclip-types/interfaces/Input.html) |
| 17 | + (e.g. `popclip.input.text`) |
| 18 | +- [`popclip.context`](https://pilotmoon.github.io/popclip-types/interfaces/Context.html) |
| 19 | + (e.g. `popclip.context.browserUrl`) |
| 20 | +- [`popclip.options`](https://pilotmoon.github.io/popclip-types/interfaces/Options.html) |
| 21 | +- [`popclip.modifiers`](https://pilotmoon.github.io/popclip-types/interfaces/Modifiers.html) |
| 22 | + |
| 23 | +See also [JavaScript environment](https://www.popclip.app/dev/js-environment). |
11 | 24 |
|
12 | 25 | ## Shell Script and AppleScript variables |
13 | 26 |
|
14 | | -All values are provided as strings. Where no value is available, it will be set to an empty string. |
| 27 | +All values are provided as strings. Where no value is available, it will be set |
| 28 | +to an empty string. |
15 | 29 |
|
16 | | -Within a shell script, PopClip sets script variables named like this: `POPCLIP_TEXT`, |
17 | | -`POPCLIP_BROWSER_TITLE`, `POPCLIP_OPTION_FOO`, etc. |
| 30 | +Within a shell script, PopClip sets script variables named like this: |
| 31 | +`POPCLIP_TEXT`, `POPCLIP_BROWSER_TITLE`, `POPCLIP_OPTION_FOO`, etc. |
18 | 32 |
|
19 | | -Within an AppleScript, PopClip pre-processes the script to replace placeholders with strings. Placeholders look like this: `{popclip text}`, |
| 33 | +Within an AppleScript, PopClip pre-processes the script to replace placeholders |
| 34 | +with strings. Placeholders look like this: `{popclip text}`, |
20 | 35 | `{popclip browser title}`, `{popclip option foo}`, etc. |
21 | 36 |
|
22 | 37 | ### Available variables |
|
0 commit comments