skip to Main Content

I am trying to set up photshop Scripting environment in my preferred IDE. So I am using the excellent Davide Barranca’s Package for Sublime found HERE.

I’ve installed the package and have ticked ExtendScript-PS option found under Tools > Build System > ExtendScript-PS

This here is the code I am using as a test:

#target Photoshop
alert("Done!");

The issue is in Sublime Text, when I go to Tools >Build I just get an error dump in the Console:

The filename, directory name, or volume label syntax is incorrect.
[Finished in 0.1s with exit code 1]

But if I directly execute the Test.Jsx file in windows explorer, it works just fine in Photoshop.

enter image description here

So the issue must be with sublime, Anyone know what I could be doing wrong? I am running latest version of Photoshop. Any help would be appreciated.

My build.bat file is set up like this:

@echo off 
:: Renaming arguments
set jsx_file=%1%

:: Change this accordingly to your CS version
set version= Adobe Photoshop CC 2020

set ps_folder_path=c:Program FilesAdobeAdobe Photoshop %version% (64 Bit)

::set ps_folder_path=c:Program FilesAdobeAdobe Photoshop %version% (64 Bit)


:: Adobe Photoshop folder location 32 bit versions:
:: set ps_folder_path=c:Program Files (x86)AdobeAdobe Photoshop %version%

cd "%ps_folder_path%"

:: Running script in Photoshop
photoshop.exe "%jsx_file%"

:: Printing happy feedback in the console
echo "Successfully compiled %file_name% to %full_path%%file_name%";
 

And the run.scpt file

 on run arg

  tell application "Adobe Photoshop CC 2020"
    do javascript file (arg's item 1)
    -- ALTERNATIVELY: 
    -- do javascript file (arg's item 1) show debugger before running
    -- do javascript file (arg's item 1) show debugger never
    -- do javascript file (arg's item 1) show debugger on runtime error
    activate
  end tell

end run

2

Answers


  1. The way you have set up your .bat file, it won’t find the Photoshop executable. If you have a look at Davide’s original script, the version variable is

    set version='CC 2015.5'
    

    so to set it up accordingly for Photoshop 2020, it should be something like

    set version='2020'
    

    (I think this should be without the CC as Adobe omits the CC in the app names beginning with the 2020 apps). Once you do this, it should find the path correctly. Also, don’t forget to include the quotes.

    Login or Signup to reply.
  2. A year later, I was struggling with the same problem and solved it for my setup. Perhaps its of use to someone. I got my files from github here.

    most notably, I had to put the value of the ps_folder_path variable in double quotes ("") in the build.bat.

    @echo off
    
    :: Renaming arguments
    set jsx_file=%1%
    
    :: Change this accordingly to your CS version
    set version=2020
    
    :: Adobe Photoshop folder location 64 bit versions:
    set ps_folder_path="C:Program FilesAdobeAdobe Photoshop %version%"
    
    cd "%ps_folder_path%"
    
    :: Running script in Photoshop
    Photoshop.exe "%jsx_file%"
    
    :: Printing happy feedback in the console
    echo "Successfully compiled %jsx_file%";
    

    run.scpt: changed the application name but did not make a difference in my case

    on run arg
    
      tell application "Adobe Photoshop 2020"
        do javascript file (arg's item 1)
        -- ALTERNATIVELY: 
        -- do javascript file (arg's item 1) show debugger before running
        -- do javascript file (arg's item 1) show debugger never
        -- do javascript file (arg's item 1) show debugger on runtime error
        activate
      end tell
    
    end run
    

    ExtendScript-PS.sublime-build: Here I removed the brackets (list-indicators []) around the cmd values and changed all single quotes ('xxx') to escaped double quotes ("xxx") to make it work.

    {
      "cmd": "osascript "${packages}/ExtendScript-PS/run.scpt" "$file"",
      "shell": true,
      "windows": 
      {
        "cmd": "cd ${packages}\ExtendScript-PS\ && build.bat "$file"",
        "encoding": "cp850"
      }
    }
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search