├── ExtendScript-PS ├── ExtendScript-PS.sublime-build ├── build.bat └── run.scpt ├── LICENSE └── README.md /ExtendScript-PS/ExtendScript-PS.sublime-build: -------------------------------------------------------------------------------- 1 | { 2 | "cmd": [ 3 | "osascript '${packages}/ExtendScript-PS/run.scpt' '$file'" 4 | ], 5 | "shell": true, 6 | "windows": 7 | { 8 | "cmd": ["cd ${packages}\\ExtendScript-PS\\ && build.bat '$file'"], 9 | "encoding": "cp850" 10 | } 11 | } -------------------------------------------------------------------------------- /ExtendScript-PS/build.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | :: Renaming arguments 3 | set jsx_file=%1% 4 | 5 | :: Change this accordingly to your CS version 6 | set version='CC 2015.5' 7 | 8 | :: Adobe Photoshop folder location 64 bit versions: 9 | set ps_folder_path=c:\Program Files\Adobe\Adobe Photoshop %version% (64 Bit) 10 | 11 | :: Adobe Photoshop folder location 32 bit versions: 12 | :: set ps_folder_path=c:\Program Files (x86)\Adobe\Adobe Photoshop %version% 13 | 14 | cd "%ps_folder_path%" 15 | 16 | :: Running script in Photoshop 17 | photoshop.exe "%jsx_file%" 18 | 19 | :: Printing happy feedback in the console 20 | echo "Successfully compiled %file_name% to %full_path%\%file_name%"; -------------------------------------------------------------------------------- /ExtendScript-PS/run.scpt: -------------------------------------------------------------------------------- 1 | on run arg 2 | 3 | tell application "Adobe Photoshop CC 2015.5" 4 | do javascript file (arg's item 1) 5 | -- ALTERNATIVELY: 6 | -- do javascript file (arg's item 1) show debugger before running 7 | -- do javascript file (arg's item 1) show debugger never 8 | -- do javascript file (arg's item 1) show debugger on runtime error 9 | activate 10 | end tell 11 | 12 | end run -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2016 Davide Barranca 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # sublime-ps-extendscript 2 | 3 | Build plugin for Sublime Text. Allows to run ExtendScript code in Photoshop from within Sublime Text. 4 | 5 | ## Compatibility 6 | 7 | Sublime Text 2 and Sublime Text 3. 8 | Phototoshop CS6 -> CC 2015.5 (defaults to CC 2015.5), see below how to target your version 9 | 10 | ## Installation 11 | 12 | Copy the `ExtendScript-PS` folder in your Sublime Text Packages folder (to find it, `Sublime Text > Preferences > Browse Packages...`). 13 | 14 | ## How to run JSX in Photoshop 15 | 16 | Open a JSX file or create a new one: mind you, **it must be saved** at least once, then select `Tools > Build System > ExtendScript-PS`. 17 | 18 | To run it, then just `'Tools > Build'` or use the usual shortcuts (Command+B on Mac, Ctrl+B on Windows). 19 | 20 | ## How to target a different version of Photoshop 21 | 22 | #### Mac 23 | 24 | Locate the file `run.scpt` and change the `"Adobe Photoshop CC 2015.5"` string to match the PS version you want to use (e.g. `"Adobe Photoshop CC"`) then save. 25 | 26 | #### Windows 27 | 28 | Locate the file `build.bat` and change the `set version='CC 2015.5'` string to match the PS version you want to use (e.g. `set version='CC'`) then save. 29 | 30 | ## [Mac only] Debugging 31 | 32 | You can choose to run the debugger (ESTK) before running, never, or on runtime error. Look in the `run.scpt` file, delete the `do javascript` line and substitute with either: 33 | 34 | ```AppleScript 35 | do javascript file (arg's item 1) show debugger before running 36 | do javascript file (arg's item 1) show debugger never 37 | do javascript file (arg's item 1) show debugger on runtime error 38 | ``` 39 | 40 | ## Credits 41 | 42 | I've borrowed the idea from a package made by Sebastien Lavoie for AfterEffects (http://seblavoie.com/contact), that I've then tweaked a bit. 43 | 44 | ## License 45 | 46 | [MIT License](LICENSE) --------------------------------------------------------------------------------