Skip to content

Commit

Permalink
Merge branch 'Dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
rendertom committed Dec 12, 2019
2 parents 37e99c0 + 130d267 commit c740fe0
Show file tree
Hide file tree
Showing 18 changed files with 522 additions and 308 deletions.
110 changes: 84 additions & 26 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,68 +4,126 @@ All notable changes to the Adobe Script Runner extension will be documented in t

## [Unreleased]

## Released
### Added

*

### Changed

*

### Fixed

*

### Removed

*

---

## [0.3.0] 2019-12-12

### Added

* Option to always **Execute File From Config** file defined in **Execute This** section, ignoring the one in active viewer.
* Option to **Execute File From Token** `Adobe-Script-Runner "path/to/file.jsx"` in active document to execute file between the quotes.

### Changed

* Codebase rewritten from scratch.
* Renamed configuration keys and titles.

### Removed

* Checkbox **Run Untitled**.

---

## [0.2.1] 2019-01-05

- Updates default Windows paths to CC2019 version.
- Updates descriptions for `Run Untitled`, `Save Dirty`, and `Temp File` in extensions Settings window.
### Changed

* Updates default Windows paths to CC2019 version.
* Updates descriptions for `Run Untitled`, `Save Dirty`, and `Temp File` in extensions Settings window.

---

## [0.2.0] 2018-03-29

- Fixed bug when settings were not registered until app restart.
- Fixed issue with HOME "~/" paths.
- Changed code flow. Splits everything to modules for easier maintenance and development. Also makes it easier for other apps to adopt the functionality.
- Ports functionality to [Atom.io](https://atom.io/packages/adobe-script-runner).
### Fixed

* Fixed bug when settings were not registered until app restart.
* Fixed issue with HOME "~/" paths.

### Changed

* Changed code flow. Splits everything into modules for easier maintenance and development. Also makes it easier for other apps to adopt the functionality.
* Ports functionality to [Atom.io](https://atom.io/packages/adobe-script-runner).

---

## [0.1.2] 2018-03-14

### Added

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

---

## [0.1.1] 2018-03-14

### Changed

- Changed extension icon.
* Extension icon.

---

## [0.1.0] 2018-03-13

### Added

- Support to open scripts inside `Adobe InCopy`.
- Support for Windows.
* Support to execute scripts in `Adobe InCopy`.
* Support for Windows.

---

## [0.0.3] 2018-03-12

### Added

- Support to open scripts inside `Adobe ExtendScript Toolkit`.
- Looping gif to README.md file that looks fantastic.

* Support to open scripts inside `Adobe ExtendScript Toolkit`.
* Looping gif to README.md file that looks amazing.

### Fixed

* Fixed typos in `README.md`.

### Changed

- Updated `extension.js` to use es6 syntax.
- Updated info message to show app name the script has been sent to.
- Renamed settings object `adobeScriptLauncher` to `adobeScriptRunner`.
- Fixed typos in `README.md`.
- Changed location of temp file `Snippet.js` to `~/.vscode` instead of `~/Desktop` folder.
- Created `resources` folder to dump all image files there.
* Updated `extension.js` to use es6 syntax.
* Updated info message to show app name the script has been sent to.
* Renamed settings object `adobeScriptLauncher` to `adobeScriptRunner`.
* Changed location of temp file `Snippet.js` to `~/.vscode` instead of `~/Desktop` folder.
* Created `resources` folder to dump all image files there.

---

## [0.0.2] 2018-03-11

### Added

- Support to run scripts inside `Adobe Illustrator`.
- Support to run scripts inside `Adobe InDesign`.
* Support to execute scripts in `Adobe Illustrator`.
* Support to execute scripts in `Adobe InDesign`.

### Changed

- README.md and CHANGELOG.md files to reflect changes.
- Refactored `scriptCommands` object.
* README.md and CHANGELOG.md files to reflect changes.
* Refactored `scriptCommands` object.

---

## [0.0.1] 2018-03-10

- Initial release
* Initial release
65 changes: 44 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Adobe Script Runner

Script runner for Adobe applications right from VSCode. Extension also available for [Atom.io](https://atom.io/packages/adobe-script-runner).
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).

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

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

## Features

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.
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.

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

> Tip: You don't need to have file saved inside VSCode. Extension will be able to run code from unsaved documents. Kaboom!
> Tip: You don't need to have the file saved inside VSCode. The extension will be able to run code from unsaved documents.
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).
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).

**Note:** Contribution to support other Adobe applications is highly encouraged.
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.

## Installation

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

## In action

- Launch VSCode and open your own jsx file, or for testing just type `alert("Hello World")`.
- 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.
- Hopefully After Effects will fire up and run your script 🙏
- Launch VSCode and open jsx file, or for testing simply type `alert("Hello World");`.
- 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.
- Hopefully After Effects will fire up and execute your script 🙏

## Key bindings

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:
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:

- Open Keyboard Shortcuts editor and click on the link `keybindings.json`.
- 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.
- 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.
- Edit the `command` property to `adobeScriptRunner.XX`, where XX is abbreviation of the application. Check available abbreviations in `Extensions > Adobe Script Runner > Contributions` tab.
- 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.
- 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.

End result should look like this.
The result should look something like this:

```json
{
Expand All @@ -60,25 +60,48 @@ End result should look like this.
},
```

For more information about keybinding check official [Key Bindings for Visual Studio Code]( https://code.visualstudio.com/docs/getstarted/keybindings).
For more information about keybinding check official [Key Bindings for Visual Studio Code](https://code.visualstudio.com/docs/getstarted/keybindings).

## Token

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.

```javascript
/*
Adobe-script-runner '../../index.js'
Executes file between quotes rather than the one in the active viewer.
*/

alert('Hello World'); // This line never gets executed, unless `index.js` is referencing the file in viewer.
```

The file path gets resolved by joining the path of the file in the viewer and the file within the quotes.

## Execute this

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**.

The file path gets resolved by joining this path and the Workspace (or Root `/`) folder.

## Settings

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

- `adobeScriptRunner.saveDirty`: toggle to run unsaved (dirty) files.
- `adobeScriptRunner.runUntitled`: toggle to run untitled files. Define location of temporary file in `adobeScriptRunner.tempFile` setting.
- `adobeScriptRunner.tempFile`: location to save temporary file. Used only when `adobeScriptRunner.runUntitled` is enabled.
- `adobeScriptRunner.executeFileFromConfig`: Whether to execute file, defined in config `.vscode/settings.json` file. See more in [Execute this](#execute-this) section.
- `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.
- `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.
- `adobeScriptRunner.saveFileBeforeExecution`: Whether to save file before execution.
- `adobeScriptRunner.temporaryFile`: Path to a temporary file where Untitled document gets saved prior to execution.

**For Windows users only:**

- `adobeScriptRunner.winEstkExe`: path to Adobe ExtendScript Toolkit executable (ExtendScript Toolkit.exe).
- `adobeScriptRunner.winAfterFxExe`: path to Adobe After Effects executable (AfterFX.exe).
- `adobeScriptRunner.winAfterEffectsExe`: path to Adobe After Effects executable (AfterFX.exe).
- `adobeScriptRunner.winExtendscriptToolkitExe`: path to Adobe ExtendScript Toolkit executable (ExtendScript Toolkit.exe).
- `adobeScriptRunner.winIllustratorExe`: path to Adobe Illustrator executable (Illustrator.exe).
- `adobeScriptRunner.winPhotoshopExe`: path to Adobe Photoshop executable (Photoshop.exe).

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 ¯\\\_(ツ)\_
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 ¯\\\_(ツ)\_

## Known issues

- Host application does not get focus on script run.
- The host application does not get focus on script run.
34 changes: 34 additions & 0 deletions lib/buildCommand.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
const cp = require('child_process');
const getScriptFile = require('./getScriptFile.js');
const getShellCommand = require('./getShellCommand.js');
const ide = require('./ide.js');

/**
* Builds and executes command.
* @param {Object} hostApp entry from hostApps[hostApp].
*/
function buildCommand(hostApp) {
try {
getScriptFile(function(scriptFile) {
getShellCommand(hostApp, scriptFile, function(command) {
console.log('Running shell command:', command);
cp.exec(command, (error, stdout, stderr) => {
if (error) {
console.error(`exec error: ${error}`);
return;
}

console.log(stdout);
console.log(stderr);
});
ide.showInformationMessage(`Script sent to ${hostApp.appName}`);
});
});
} catch (error) {
if (typeof error !== 'undefined') {
console.log(error);
}
}
}

module.exports = buildCommand;
7 changes: 0 additions & 7 deletions lib/config.js

This file was deleted.

29 changes: 0 additions & 29 deletions lib/editor.js

This file was deleted.

4 changes: 2 additions & 2 deletions lib/extension.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const buildCommand = require('./static/buildCommand.js');
const hostApps = require('./static/hostApps.js');
const buildCommand = require('./buildCommand.js');
const hostApps = require('./hostApps.js');
const vscode = require('vscode');

/**
Expand Down
Loading

0 comments on commit c740fe0

Please sign in to comment.