Downloading JavaScript Files

Many legacy ExtendScript-based scripts are offered in .js or .jsx or even .jsxbin formats. 

Simply download these files ready for installation (in some cases they may need to be decompressed from a .zip format archive).

Update for Photoshop 23.5: New UXP-based scripts using the .psjs extension are now supported!


Saving JavaScript Source Code

Quickstart:

  1. Copy the code text to the clipboard
  2. Open a new blank file in a plain-text editor (not in a word processor)
  3. Paste the code in
  4. Save as a plain text format file – .txt
  5. Rename the saved file extension from .txt to .jsx
  6. Install or browse to the .jsx file to run (see below)
Some JavaScripts are offered as “raw code”, rather than saved into a ready-to-use file. This is often the case with scripts found on the Adobe User Forums, GitHub, SourceForge etc. Simply select the content clearly marked as code and copy/paste the text into a plain text document, saving the file with a .jsx filename extension (or .psjs for a UXP-based script). Ensure that a double extension is not incorrectly added, such as .jsx.txt

Text Editor Applications: Only paste the source code into plain text editors, not rich text or word processing apps. Common free or commercial plain text editors suitable for code saving include –

Cross-platform: Atom, Sublime TextMS Visual Studio Code + Adobe ExtendScript Debugger

Mac: Apple TextEdit (ensure that the Format menu is set to Plain Text mode, not Rich Text mode), BBEdit

Windows: MS Notepad, Adobe ExtendScript Toolkit (32-bit only), Notepad++

Also, ensure that single or double straight marks " do not become curly “.

Adobe Bridge JavaScript Source Code from Adobe User Forums (old forum format)


Adobe Bridge JavaScript source code from GitHub – use the “Raw” button and then save the following page as .jsx


Saving & Compiling AppleScript Source Code using Apple Script Editor.app


AppleScript code must be compiled using the icon indicated (or using the Script > Compile menu)


Although AppleScript source code is plain text, unlike JavaScript it must be “compiled” before it can be used. To avoid unexpected issues, only use Apple Script Editor for AppleScript code, not JavaScript code. Further information at the Apple Developer site:

https://developer.apple.com/library/content/documentation/LanguagesUtilities/Conceptual/MacAutomationScriptingGuide/CreateaScript.html

https://developer.apple.com/library/content/documentation/AppleScript/Conceptual/AppleScriptX/Concepts/work_with_as.html#//apple_ref/doc/uid/TP40001568-1152365


Adobe Photoshop Script Installation Location

Scripts are installed in the /Presets/Scripts folder

Mac OS Example:
  • /Applications⁩/Adobe Photoshop CC 2019⁩/Presets⁩/Scripts
  • /Applications/Adobe Photoshop 2021/Presets/Scripts

(If this path does not match your version, it should be a simple enough process to find the correct folder using this guide)

Win OS Example:
  • C:\Program Files\Adobe\Adobe Photoshop CC 2018\Presets\Scripts
  • C:\Program Files\Adobe\Adobe Photoshop 2021\Presets\Scripts

(If this path does not match your version, it should be a simple enough process to find the correct folder using this guide)

NOTE: If running, Adobe Photoshop must be quit and restarted for newly added scripts to become accessible.

Alternatively, select File > Scripts > Browse and navigate to the script file. Scripts recorded into an Action via the Browse command will record the entire absolute path to the script, often making them unsuitable for use on multiple computers. Installed scripts will only record the script name into an Action, which is the better option for Actions that will be installed on multiple computers.

Further information at the Adobe site:
https://helpx.adobe.com/photoshop/using/scripting.html


Adobe Bridge Script Installation Location

A quick way to locate the Startup Scripts folder:

  1. Open Adobe Bridge, then open Bridge’s preferences dialog
  2. Under Startup Scripts, click the "Reveal My Startup Scripts" button
  3. Copy/Paste or drag-n-drop your .jsx script files into the Startup Scripts folder/directory
  4. Quit and restart Bridge and answer "Yes" to enable the script.

Mac OS Example:

  • /Users/username/Library/Application Support/Adobe/Bridge CC 2018/Startup Scripts

Win OS Example:

  • C:\Users\username\AppData\Roaming\Adobe\Bridge 2021\Startup Scripts

(Replace "username" with your operating system user account name. If this path does not match your version, it should be a simple enough process to find the correct folder using this guide)

Further information at the Adobe site:
https://helpx.adobe.com/bridge/using/adobe-bridge-workspace.html#enable_startup_scripts

NOTE: If running, Adobe Bridge must be quit and restarted for newly added scripts to become accessible.


Adobe InDesign Script Installation Location

A quick way to locate the Scripts Panel folder:

  1. Right-click (Windows) or Control-click (Mac OS) a script in the Scripts panel
  2. Choose Reveal In Explorer (Windows) or Reveal In Finder (Mac OS)

Mac OS Example:

  • /Users/username/Library/Preferences/Adobe InDesign/Version 13.0/en_GB/Scripts/Scripts Panel

(Replace "username" with your operating system user account name. If this path does not match your version, it should be a simple enough process to find the correct folder using this guide)

Further information at the Adobe site:
https://helpx.adobe.com/indesign/using/scripting.html

NOTE: If running, Adobe InDesign will load newly added scripts without having to quit and restart the application. Scripts can be sorted and stored into operating system sub-folders, which will be reflected in the script panel interface.


Adobe Illustrator Script Installation Location

Scripts are installed in the /Presets/Scripts folder

Mac OS Example:

  • /Applications/Adobe Illustrator CC 2018/Presets/Scripts

(If this path does not match your version, it should be a simple enough process to find the correct folder using this guide)

Win OS Example:

  • C:\Program Files\Adobe\Adobe Illustrator CC 2018\Presets\Scripts

(If this path does not match your version, it should be a simple enough process to find the correct folder using this guide)

NOTE: If running, Adobe Illustrator must be quit and restarted for newly added scripts to become accessible.

Alternatively, select File > Scripts > Other Script and navigate to the script file.

Further information at the Adobe site:
https://helpx.adobe.com/au/illustrator/using/automation-scripts.html


2021 Update: If you are having problems finding where the Photoshop scripts folder is located, the following Photoshop JavaScript code will find and open it for you:



P.S. William Campbell has videos on how to install scripts here:

0

Add a comment

  1. For Adobe Photoshop users, the topic of batch processing variable image content to a square 1:1 aspect ratio comes up frequently. Different processing steps may be required to achieve a specific outcome, which can generally be achieved with an action without requiring custom scripting.

    Case 1: Resizing to a common target pixel size

    In the case where all images are required to be a common size (i.e. 1000 pixels for the canvas width and height), one can record an Action with the following steps:

    1. Create a new Action Set. Add a new Action. Start recording the action. Use the File > Automate > Fit Image... command and enter 1000 for both the pixel width and height. Stop recording the action. This will resize the longest edge, whether that is the width or the height. The shorter edge will be proportionally resized to a smaller value. The next step will resize the canvas to square.
    2. To record a 1000 px square canvas resize, you will first need to set or prime the document for recording so that the longest edge isn't 1000 px. This step is critical. Create a temporary dummy document larger than 1000 px on each edge to use when recording this step.
    3. Press record and use Image > Canvas Size... and enter 1000 px for both the width and the height. The default anchor point for the resize is set to the centre, however, this can be changed as required. Keep in mind that source content may or may not contain transparency, or possibly a flattened background colour which may need to be set via the "canvas extension colour" menu. For variable background extension, one may need to use Content Aware Fill. Stop recording. Double-check that both the width and height values have been recorded. The recorded action step for canvas size should now have both a width of 1000 px and a height of 1000 px, creating a square canvas for portrait or landscape images.

     

    Case 2: Crop transparent images to content and resize to a common target pixel size

    Images such as product/catalogue may need to be cropped to the pixel content, removing any transparent pixels before resizing.

      1. Load the layer's transparency channel as a selection by the Select > Load Selection... menu. You may wish to expand the selection to "pad" the image before cropping.
      2. Use the Image > Crop command to crop to the selection.
      3. Then use the steps previously mentioned in Case 1 to size using Fit Image and Canvas Size.

    Case 3: Resizing transparent images to a variable target pixel size based on the longest edge

    In the case where the target resize is based on the longest edge for each image being processed, one may need to get creative when recording the Action to create a variable-sized square canvas.

    1. Load the layer's transparency channel as a selection by the Select > Load Selection... menu. You may wish to expand the selection to "pad" the image before cropping.
    2. Image > Crop
    3. Select > Deselect
    4. Duplicate the image layer
    5. Edit > Transform > Rotate 90°
    6. Image > Reveal All
    7. Delete the duplicated rotated layer

    NOTE: This method can also be adapted for flattened images without transparency.

    Finally, the Action would be run via the File > Automate > Batch... command to process multiple images.


    0

    Add a comment



  2. Although Pantone nominated "PANTONE 17-3938 Very Peri" as the Colour of the Year for 2022, for Adobe Creative Cloud subscribers, the Pantone Colour of the Year was unofficially Black.

    Late in 2021 it was widely reported in the graphics media that due to licensing changes with Pantone, Adobe would no longer be including many historical Pantone Color Book files (.acb) or Pantone Color Swatch Files (.aco) in future versions of Photoshop, Illustrator and InDesign.

    There were press releases from both Adobe and Pantone, however, there were more questions generated than answers from these corporate communications that contained more public relations damage control wording than useful information. 

    The alternative offered by Pantone to the established Adobe Color Book file format is for users to install the Pantone Connect extension for Adobe Creative Cloud applications from the Adobe Exchange website. Many users found this "alternative" to be lacking in both usage and functionality. As of December 2022, the 1.0.8 version has an average rating of 1.3 out of 5 stars.

    After months of speculation on what this would actually mean for end users, Photoshop updates released in August, September, and October 2022 rendered spot channels referencing unavailable Pantone Color Book files as black with the following message:


    In the November 2022 update, Adobe changed how legacy spot channels that were referencing unavailable Pantone Color Book files were opened. An updated prompt appeared, however, the legacy colour preview of the existing spot colour was now honoured and no longer changed to black, despite the referenced .acb file no longer being available. 

    My speculation is that there is now a hard-coded colour lookup table within Photoshop to maintain the appearance of spot colours referencing the missing colour book library files. End users obviously can't access this colour reference, however, at least legacy files are no longer initially rendered using black. Unfortunately, this isn't the case for Illustrator or InDesign.


    The spot channel now retains the original name and colour swatch:


    If the colour swatch is edited, Photoshop now defaults to another available colour library, such as "ANPA Color", where the default selection may be a very different lightness or hue to the original Pantone library. Note: Both the spot channel name and colour swatch will be changed from the original.


    You can find answers to commonly asked questions about Pantone Color books in the following Adobe HelpX Knowledge Base article:


    As of writing, Adobe advise:
    • Photoshop files previously created using Pantone Color books will not disrupt Photoshop versions released in or after November 2022. Colors will render and function as expected.
    • New Photoshop files created after the November 2022 release will require a Pantone Connect license to access some of the Pantone Color books. Users can still access Pantone + CMYK Coated, Pantone + CMYK Uncoated, and Pantone + Metallic Coated after the November 2022 release.
    • Photoshop files that are opened in Illustrator and use spot channels will render Gray/Black when colors from the parent Color books are no longer available.
    • Photoshop files that are opened in InDesign and use spot channels will render Gray/Black if colors from the parent Color books are no longer available.

    So, what are the solutions?

    If you have made it this far, you may be wondering what solutions are available.

    Option 1: Pantone Connect Premium Subscription
    The official solution recommended by Pantone and Adobe is taking out a Pantone Connect Premium Subscription for individual users or multi-seat enterprise users. Pantone currently offer a 7-day free trial for Premium monthly and yearly subscriptions for individual users.

    Option 2: Manually Install Missing Legacy Color Book Files
    For obvious reasons, this solution is not endorsed or mentioned by Adobe or suggested by Pantone. Many end users on web forums have elected to make backup copies of their legacy Color Book .acb files and install them in later versions of Photoshop or other Adobe software:


    Despite the unknown and questionable legalities of this solution, there is a practical disadvantage to this "status quo" approach. Linking a spot colour definition to a legacy colour book file retains the reliance on having the colour book file available in other applications.

    My "radical" suggestion is to break the long-standing practice/reliance on using colour book files altogether, and use device-independent Lab Color Picker values to define the spot colour!

    Option 3: Define Spot Colours Using Lab Color Picker Values 
    In the packaging industry, spot colours referencing brand names have long been used in Adobe and other software such as proofing RIPs. For example, a corporate red could be named "Adobe Red Coated". Such brand colours may have been specified using device-dependent RGB or CMYK picker values, or better yet, using device-independent Lab picker values. 

    It is therefore possible to keep the original Pantone name/number for reference and simply change the swatch colour library/book link to a similar Lab picker colour value to break the reference to the original colour book. One can also use legacy Pantone swatch files to redefine a Color Book spot channel into Lab picker values.


    The disadvantage to this approach is that the alternative composite colour appearance of the spot colour is no longer based on a "master digital value". The same Pantone colour created by two different users could have different colour values. This has long been the case for the printed Pantone colour swatch fan guides, where the same Pantone colour may have very different colour appearances between two printed guides due to accepted tolerance variations and inconsistencies in the printing process.

    The advantage to this approach is that once a spot colour in Photoshop (or Illustrator or InDesign) is defined using Lab picker values, any version of Photoshop or other Adobe software will honour the Lab colour values used to define the alternative on-screen/composite print appearance of the spot colour. This is applicable to both Spot Color Channels and Duotone Mode Spot Colour Inks.

    0

    Add a comment

  3. For many Photoshop users, Actions are a relatively easy and accessible form of automation. Although easy to create, Actions have numerous limitations. 

    Scripts can extend Actions, making up for their limitations. Users who are comfortable with Actions can use a "snippet" of script code in their Action to achieve a result that would otherwise be impossible. 

    The goal is to enable Photoshop users comfortable with Actions to leverage the power of scripting – without requiring the knowledge to write scripts themselves.

    I intend to create and maintain a repository of code snippets designed to perform a specific Action step that is not otherwise achievable. The average Photoshop user doesn't need to know how to write script code – they only need to run the script while recording it as an Action step.

    As an end user, do you need help or have a feature request for a step that is not possible using an action step? Post in the comments section with your idea/request. As an Adobe Community Expert programme member, you can also contact me via the Adobe Support Community

    As a script developer, would you like to share code or help contribute snippets? I encourage like-minded script creators to share their code snippets, which I'll add into the repo. Although script length doesn't matter, the intent is to keep the scripting code as short and concise as possible. Apart from the "header" of the script, there isn't any need to comment the scripts, except where minimal end-user editing is required within the script itself.

    Errors, omissions, bugs or other issues? Please let me know.

    The coding platform Snippet.io is being used to host the code, as it offers the ability to group code into "collections" that are easy to find, use and maintain. 


    Photoshop Action Helper Scripts – Paths

    Photoshop Action Helper Scripts – Channels

    Photoshop Action Helper Scripts – Layers

    Photoshop Action Helper Scripts – Conditionals

    Photoshop Action Helper Scripts – Rulers

    Photoshop Action Helper Scripts – Tools

    Photoshop Action Helper Scripts – Artboards
    https://snipit.io/public/collections/22836/22836

    Photoshop Action Helper Scripts – Metadata

    Photoshop Action Helper Scripts – Selection

    Photoshop Action Helper Scripts – Guides

    Photoshop Action Helper Scripts – Camera Raw Filter

    Photoshop Action Helper Scripts – Open Files


    Information on saving script code and installing/running scripts here:

    This blog post has been cross-posted to the Adobe Support Community Photoshop forum:

    0

    Add a comment

  4. Adobe Photoshop offers a relatively unknown feature called the "Script Events Manager".

    The Script Events Manager is used to automatically run a script or action after an event is triggered, such as opening a document. There are a handful of useful default events available, with the ability to add further events.

    In the following example, all opened images will automatically run an action to fit the image on the screen.

    Here an action set titled "Fit on Screen Set" has been created with a single step action command "Select Fit on Screen menu item" inserted (as this command can't be directly recorded).




    File > Scripts > Script Events Manager


    To configure the Script Events Manager:
    1. Tick the "Enable Events to Run Scripts/Actions:" check-box
    2. Select an event, such as "Open Document" 
    3. Press the radio-button to run a Script or Action
    4. Press the "Add" button on the right-hand side to add to the events list

     

    Advanced Script Events Manager – Adding a Custom Event

    Example 1:

    Use the "Add an Event" menu option in Step 2 to create a custom event.

    For example, you may wish to automate further steps whenever the Gaussian Blur filter is run.

    Note: The "Descriptive Label" field is the actual event case sensitive code required for the event (GsnB), while the name is just the description. The official Adobe JavaScript reference PDF has a list of events codes found in "Appendix A: Event ID Codes".

    Example 2:

    Another example could be running the "Fit on Screen Set" action when editing a smart object layer:

    The code for the event of editing the smart object layer is:

    placedLayerEditContents

    Deleting Custom Events:

    Adobe doesn't offer a GUI-based method to remove custom events added via the "Add an Event" menu command. Event notifiers are added to an XML file. For Photoshop 2021 the path is similar to:

    Mac OS:

    /Users/username/Library/Preferences/Adobe Photoshop 2021 Settings/Script Events Manager.xml

    Win OS (Note: the AppData directory may be hidden):

    C:\Users\username\AppData\Roaming\Adobe\Adobe Photoshop 2021\Adobe Photoshop 2021 Settings\Script Events Manager.xml



    Note: Before editing the Script Events Manager.xml file to remove an unwanted event, it is recommended that a backup copy is made.


    Editing the Event "valueClass":

    Some events are generic, such as "select" – which can be triggered by selecting a layer, or selecting a tool! By adding a property such as "layer" to "valueClass", the event can be made specific, such as only being triggered when selecting a layer. The existing event will need to be removed from the Script Events Manager and added again after editing the XML file to pickup on the change:


    <name>Select layer</name>
    
    <value>select</value>
    
    <valueClass>layer</valueClass>
    



    0

    Add a comment

  5. I have been posting off and on to this blog for eleven or so years, however recently an overzealous Google/Blogger security algorithm has been taking this site down for suspected Phishing. It is impossible to communicate with an actual human being at Blogger to verify what the actual problem is, therefore in desperation I have taken down all ExtendScript/JavaScript/AppleScript code samples in a last-ditch attempt to stop my blog from being deleted by Google/Blogger.

    If I can host the (harmless) code on another site and link to it that may be the best solution.

    Needless to say, I am very unhappy with Blogger at the moment!


    UPDATE (13 February 2022):

    Most of the scripts have been moved over to GitHub, either as a Repository (full scripts) or Gist (code snippets for use in larger scripts):




    0

    Add a comment



  6. In an earlier post I explored running an action from a script. Adding a few extra lines of code, the scripted action can be timed, which is useful when optimising an action or comparing the merit of different steps that achieve the same end result.

    https://github.com/MarshySwamp/Photoshop-Action-Timer/blob/main/Action%20Timer.jsx

    2

    View comments


  7. When it comes to accepting various “special” characters in filenames, the MacOS is more tolerant than MS Windows. That being said, one may not wish to have various “special” characters in a filename, even if they are valid for the current OS. Adobe Bridge’s Batch Rename tool can easily remove unwanted characters using it's regular expression based string substitution feature.





    The first regular expression based string substitution found on the “Original Filename” in the screenshot above uses the following search pattern in the “Find” field:

    [^-_0-9a-zA-Z\.\s]

    The “Replace with” field is intentionally left blank (deleting the found content).

    This particular regular expression contains the literal characters and regular expression meta-characters that we wish to retain. Any characters not contained in the “negated” character set [^] are deleted. The following list of characters are preserved:


    • - (hyphen)
    • _ underscore
    • all digits 0 through 9
    • alpha lowercase a through z
    • alpha uppercase A through Z
    • . period character
    • \s whitespace character (can be substituted with a word space)


    The subsequent regular expression based string substitutions using an “Intermediate Filename” have been added to help tidy up the end of the filename before the filename extension period character and text. Depending on the input filenames, these additional intermediate filename options may need to be modified or removed.



    3

    View comments

Popular Posts
Popular Posts
About Me
About Me
Blog Archive
Labels
Stephen Marsh
Stephen Marsh
Graphic Prepress Operator (Cert. III)
Vocational Trainer & Assessor (TAA Cert. IV)

Technical Editor

Sydney, Australia

e: stephenamarsh[at]gmail.com
Binary FX
Loading
Dynamic Views theme. Powered by Blogger. Report Abuse.