Skip to content

Commit c740fe0

Browse files
committed
Merge branch 'Dev'
2 parents 37e99c0 + 130d267 commit c740fe0

18 files changed

+522
-308
lines changed

CHANGELOG.md

Lines changed: 84 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -4,68 +4,126 @@ All notable changes to the Adobe Script Runner extension will be documented in t
44

55
## [Unreleased]
66

7-
## Released
7+
### Added
8+
9+
*
10+
11+
### Changed
12+
13+
*
14+
15+
### Fixed
16+
17+
*
18+
19+
### Removed
20+
21+
*
22+
23+
---
24+
25+
## [0.3.0] 2019-12-12
26+
27+
### Added
28+
29+
* Option to always **Execute File From Config** file defined in **Execute This** section, ignoring the one in active viewer.
30+
* Option to **Execute File From Token** `Adobe-Script-Runner "path/to/file.jsx"` in active document to execute file between the quotes.
31+
32+
### Changed
33+
34+
* Codebase rewritten from scratch.
35+
* Renamed configuration keys and titles.
36+
37+
### Removed
38+
39+
* Checkbox **Run Untitled**.
40+
41+
---
842

943
## [0.2.1] 2019-01-05
1044

11-
- Updates default Windows paths to CC2019 version.
12-
- Updates descriptions for `Run Untitled`, `Save Dirty`, and `Temp File` in extensions Settings window.
45+
### Changed
46+
47+
* Updates default Windows paths to CC2019 version.
48+
* Updates descriptions for `Run Untitled`, `Save Dirty`, and `Temp File` in extensions Settings window.
49+
50+
---
1351

1452
## [0.2.0] 2018-03-29
1553

16-
- Fixed bug when settings were not registered until app restart.
17-
- Fixed issue with HOME "~/" paths.
18-
- Changed code flow. Splits everything to modules for easier maintenance and development. Also makes it easier for other apps to adopt the functionality.
19-
- Ports functionality to [Atom.io](https://atom.io/packages/adobe-script-runner).
54+
### Fixed
55+
56+
* Fixed bug when settings were not registered until app restart.
57+
* Fixed issue with HOME "~/" paths.
58+
59+
### Changed
60+
61+
* Changed code flow. Splits everything into modules for easier maintenance and development. Also makes it easier for other apps to adopt the functionality.
62+
* Ports functionality to [Atom.io](https://atom.io/packages/adobe-script-runner).
63+
64+
---
2065

2166
## [0.1.2] 2018-03-14
2267

2368
### Added
2469

25-
- Added default keybinding `Cmd+R` ro tun `adobeScriptRunner.ae` command.
26-
- Added instructions on how to assign keybindings to commands in `README.md` file.
70+
* Default keybinding `Cmd+R` ro tun `adobeScriptRunner.ae` command.
71+
* Instructions on how to assign keybindings to commands in `README.md` file.
72+
73+
---
2774

2875
## [0.1.1] 2018-03-14
2976

3077
### Changed
3178

32-
- Changed extension icon.
79+
* Extension icon.
80+
81+
---
3382

3483
## [0.1.0] 2018-03-13
3584

3685
### Added
3786

38-
- Support to open scripts inside `Adobe InCopy`.
39-
- Support for Windows.
87+
* Support to execute scripts in `Adobe InCopy`.
88+
* Support for Windows.
89+
90+
---
4091

4192
## [0.0.3] 2018-03-12
4293

4394
### Added
4495

45-
- Support to open scripts inside `Adobe ExtendScript Toolkit`.
46-
- Looping gif to README.md file that looks fantastic.
47-
96+
* Support to open scripts inside `Adobe ExtendScript Toolkit`.
97+
* Looping gif to README.md file that looks amazing.
98+
99+
### Fixed
100+
101+
* Fixed typos in `README.md`.
102+
48103
### Changed
49104

50-
- Updated `extension.js` to use es6 syntax.
51-
- Updated info message to show app name the script has been sent to.
52-
- Renamed settings object `adobeScriptLauncher` to `adobeScriptRunner`.
53-
- Fixed typos in `README.md`.
54-
- Changed location of temp file `Snippet.js` to `~/.vscode` instead of `~/Desktop` folder.
55-
- Created `resources` folder to dump all image files there.
105+
* Updated `extension.js` to use es6 syntax.
106+
* Updated info message to show app name the script has been sent to.
107+
* Renamed settings object `adobeScriptLauncher` to `adobeScriptRunner`.
108+
* Changed location of temp file `Snippet.js` to `~/.vscode` instead of `~/Desktop` folder.
109+
* Created `resources` folder to dump all image files there.
110+
111+
---
56112

57113
## [0.0.2] 2018-03-11
58114

59115
### Added
60116

61-
- Support to run scripts inside `Adobe Illustrator`.
62-
- Support to run scripts inside `Adobe InDesign`.
117+
* Support to execute scripts in `Adobe Illustrator`.
118+
* Support to execute scripts in `Adobe InDesign`.
63119

64120
### Changed
65121

66-
- README.md and CHANGELOG.md files to reflect changes.
67-
- Refactored `scriptCommands` object.
122+
* README.md and CHANGELOG.md files to reflect changes.
123+
* Refactored `scriptCommands` object.
124+
125+
---
68126

69127
## [0.0.1] 2018-03-10
70128

71-
- Initial release
129+
* Initial release

README.md

Lines changed: 44 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Adobe Script Runner
22

3-
Script runner for Adobe applications right from VSCode. Extension also available for [Atom.io](https://atom.io/packages/adobe-script-runner).
3+
Script runner for Adobe applications right from VSCode. Extension available for [Atom.io](https://atom.io/packages/adobe-script-runner), [Sublime Text](https://github.com/rendertom/Sublime-Text-Adobe-Script-Runner) and [VSCode](https://marketplace.visualstudio.com/items?itemName=renderTom.adobe-script-runner).
44

55
![Adobe Script Runner](/resources/Adobe-Script-Runner.gif)
66

@@ -15,15 +15,15 @@ Script runner for Adobe applications right from VSCode. Extension also available
1515

1616
## Features
1717

18-
Run commands are accessible via `Command Palette`. Simply click `F1` or `Cmd+Shift+P` and start typing the name of `supported applications`. Click enter to run script inside the selected application.
18+
Run commands are accessible via `Command Palette`. Simply click `F1` or `Cmd+Shift+P` and start typing the name of `supported applications`. Click enter to run the script inside the selected application.
1919

20-
Extension will open host application first if it's not running, and then execute the script.
20+
The extension will open host application first if it's not running, and then execute the script.
2121

22-
> Tip: You don't need to have file saved inside VSCode. Extension will be able to run code from unsaved documents. Kaboom!
22+
> Tip: You don't need to have the file saved inside VSCode. The extension will be able to run code from unsaved documents.
2323
24-
Map keyboard shortcuts to execute script even faster - `Cmd+R` is bind to run script inside After Effects by default. Read how to change it in [Key bindings](#key-bindings).
24+
Map keyboard shortcuts to execute a script even faster - `Cmd+R` is bind to run a script inside After Effects by default. Read how to change it in [Key bindings](#key-bindings).
2525

26-
**Note:** Contribution to support other Adobe applications is highly encouraged.
26+
Adobe Script Runner executes script in the active viewer by default. However, when working with multi-file scripts, it is common to set a path to execute a master file, i.e `index.js`, from within a file that's in the active view. Such behavior can be modified using [Token](#token) or setting up [execute this](#execute-this) file in the settings.
2727

2828
## Installation
2929

@@ -37,20 +37,20 @@ Map keyboard shortcuts to execute script even faster - `Cmd+R` is bind to run sc
3737

3838
## In action
3939

40-
- Launch VSCode and open your own jsx file, or for testing just type `alert("Hello World")`.
41-
- Click `Cmd+R` on Mac or `Ctrl+R` on Windows or launch `Command Palette` with keyboard shortcut `F1` or `Cmd+Shift+P` and type `Adobe After Effects` and click enter.
42-
- Hopefully After Effects will fire up and run your script 🙏
40+
- Launch VSCode and open jsx file, or for testing simply type `alert("Hello World");`.
41+
- Click `Cmd+R` on Mac or `Ctrl+R` on Windows, or launch `Command Palette` with keyboard shortcut `F1` or `Cmd+Shift+P`, and type `Adobe After Effects` and click enter.
42+
- Hopefully After Effects will fire up and execute your script 🙏
4343

4444
## Key bindings
4545

46-
Keyboard shortcut `Cmd+R` is bind to `adobeScriptRunner.ae` command, which will run script inside Adobe After Effects. To change the command or assign different shortcut, do the following:
46+
Keyboard shortcut `Cmd+R` is bind to `adobeScriptRunner.ae` command, which will run a script inside Adobe After Effects. To change the command or assign a different shortcut, do the following:
4747

4848
- Open Keyboard Shortcuts editor and click on the link `keybindings.json`.
4949
- This will open the Default Keyboard Shortcuts on the left and your `keybindings.json` file where you can overwrite the default bindings on the right.
50-
- With `keybindings.json` in focus click `Cmd+K` twice to open interactive keybinding modal window (or whatever it’s called) and follow the on screen instructions. This will create a new binding entry in `keybindings.json` file.
51-
- Edit the `command` property to `adobeScriptRunner.XX`, where XX is abbreviation of the application. Check available abbreviations in `Extensions > Adobe Script Runner > Contributions` tab.
50+
- With `keybindings.json` in focus click `Cmd+K` twice to open an interactive keybinding modal window (or whatever it’s called) and follow the on-screen instructions. This will create a new binding entry in the `keybindings.json` file.
51+
- Edit the `command` property to `adobeScriptRunner.XX`, where XX is an abbreviation of the application. Check available abbreviations in `Extensions > Adobe Script Runner > Contributions` tab.
5252

53-
End result should look like this.
53+
The result should look something like this:
5454

5555
```json
5656
{
@@ -60,25 +60,48 @@ End result should look like this.
6060
},
6161
```
6262

63-
For more information about keybinding check official [Key Bindings for Visual Studio Code]( https://code.visualstudio.com/docs/getstarted/keybindings).
63+
For more information about keybinding check official [Key Bindings for Visual Studio Code](https://code.visualstudio.com/docs/getstarted/keybindings).
64+
65+
## Token
66+
67+
Use token to execute a different file, rather than the one in the viewer. Add `Adobe-script-runner "path/to/file.jsx"` at the beginning of the file in the active document to always execute the file between quotes.
68+
69+
```javascript
70+
/*
71+
Adobe-script-runner '../../index.js'
72+
Executes file between quotes rather than the one in the active viewer.
73+
*/
74+
75+
alert('Hello World'); // This line never gets executed, unless `index.js` is referencing the file in viewer.
76+
```
77+
78+
The file path gets resolved by joining the path of the file in the viewer and the file within the quotes.
79+
80+
## Execute this
81+
82+
Use this option to set-up a path to a file to execute always, ignoring the file in the viewer, globally or per-project basis. To do so, open settings (`Cmd+,` on Mac or `Ctrl+,` on Windows) and set the path to a file in **Extensions -> Adobe Script Runner -> Execute This**.
83+
84+
The file path gets resolved by joining this path and the Workspace (or Root `/`) folder.
6485

6586
## Settings
6687

6788
Click `Cmd+,` on Mac or `Ctrl+,` on Windows to modify settings. Extension exposes the following settings:
6889

69-
- `adobeScriptRunner.saveDirty`: toggle to run unsaved (dirty) files.
70-
- `adobeScriptRunner.runUntitled`: toggle to run untitled files. Define location of temporary file in `adobeScriptRunner.tempFile` setting.
71-
- `adobeScriptRunner.tempFile`: location to save temporary file. Used only when `adobeScriptRunner.runUntitled` is enabled.
90+
- `adobeScriptRunner.executeFileFromConfig`: Whether to execute file, defined in config `.vscode/settings.json` file. See more in [Execute this](#execute-this) section.
91+
- `adobeScriptRunner.executeFileFromToken`: Whether to search for `Adobe-Script-Runner "path/to/file.jsx"` token in active document, and execute file within the quotes. See more in [Token](#token) section.
92+
- `adobeScriptRunner.executeThis`: A path to a file to execute always, ignoring the file in the viewer, globally or per-project basis. See more in [Execute this](#execute-this) section.
93+
- `adobeScriptRunner.saveFileBeforeExecution`: Whether to save file before execution.
94+
- `adobeScriptRunner.temporaryFile`: Path to a temporary file where Untitled document gets saved prior to execution.
7295

7396
**For Windows users only:**
7497

75-
- `adobeScriptRunner.winEstkExe`: path to Adobe ExtendScript Toolkit executable (ExtendScript Toolkit.exe).
76-
- `adobeScriptRunner.winAfterFxExe`: path to Adobe After Effects executable (AfterFX.exe).
98+
- `adobeScriptRunner.winAfterEffectsExe`: path to Adobe After Effects executable (AfterFX.exe).
99+
- `adobeScriptRunner.winExtendscriptToolkitExe`: path to Adobe ExtendScript Toolkit executable (ExtendScript Toolkit.exe).
77100
- `adobeScriptRunner.winIllustratorExe`: path to Adobe Illustrator executable (Illustrator.exe).
78101
- `adobeScriptRunner.winPhotoshopExe`: path to Adobe Photoshop executable (Photoshop.exe).
79102

80-
Executable paths for InCopy and InDesign for Windows are not exposed because they are handled differently than the rest of the apps. Go figure Adobe ¯\\\_(ツ)\_
103+
Executable paths for InCopy and InDesign for Windows are not exposed because they are handled differently than the rest of the Adobe apps. Go figure Adobe ¯\\\_(ツ)\_
81104

82105
## Known issues
83106

84-
- Host application does not get focus on script run.
107+
- The host application does not get focus on script run.

lib/buildCommand.js

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
const cp = require('child_process');
2+
const getScriptFile = require('./getScriptFile.js');
3+
const getShellCommand = require('./getShellCommand.js');
4+
const ide = require('./ide.js');
5+
6+
/**
7+
* Builds and executes command.
8+
* @param {Object} hostApp entry from hostApps[hostApp].
9+
*/
10+
function buildCommand(hostApp) {
11+
try {
12+
getScriptFile(function(scriptFile) {
13+
getShellCommand(hostApp, scriptFile, function(command) {
14+
console.log('Running shell command:', command);
15+
cp.exec(command, (error, stdout, stderr) => {
16+
if (error) {
17+
console.error(`exec error: ${error}`);
18+
return;
19+
}
20+
21+
console.log(stdout);
22+
console.log(stderr);
23+
});
24+
ide.showInformationMessage(`Script sent to ${hostApp.appName}`);
25+
});
26+
});
27+
} catch (error) {
28+
if (typeof error !== 'undefined') {
29+
console.log(error);
30+
}
31+
}
32+
}
33+
34+
module.exports = buildCommand;

lib/config.js

Lines changed: 0 additions & 7 deletions
This file was deleted.

lib/editor.js

Lines changed: 0 additions & 29 deletions
This file was deleted.

lib/extension.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
const buildCommand = require('./static/buildCommand.js');
2-
const hostApps = require('./static/hostApps.js');
1+
const buildCommand = require('./buildCommand.js');
2+
const hostApps = require('./hostApps.js');
33
const vscode = require('vscode');
44

55
/**

0 commit comments

Comments
 (0)