2

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 Files\Adobe\Adobe Photoshop %version% (64 Bit)

::set ps_folder_path=c:\Program Files\Adobe\Adobe Photoshop %version% (64 Bit)


:: Adobe Photoshop folder location 32 bit versions:
:: set ps_folder_path=c:\Program Files (x86)\Adobe\Adobe 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
marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Netmano93
  • 75
  • 1
  • 7

2 Answers2

0

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.

mdomino
  • 1,195
  • 1
  • 8
  • 22
  • I tought it may be down to this as well. I experiment with this before asking this questions, sadly it did not produce any results. So the issue that needs to be solved is sublime needing to find the Photoshop executable file? – Netmano93 Jul 23 '20 at 20:30
  • I ask because the name of that file on my system is simply 'photoshop' yet doing it like this this version='photoshop' also does not work – Netmano93 Jul 23 '20 at 20:36
  • You need to set up the correct folder path. The app name is `photoshop.exe`, that is correct. What is your path to that file? Whatever it is, should go into the `ps_folder_path` variable. Currently (if you put `2020` in to you version variable) it points to `c:\Program Files\Adobe\Adobe Photoshop 2020 (64 Bit)`. I highly suspect that you need to remove the `(64 Bit)` part, too. That's probably still in Davide's script because back with CC2015 there were both 32 Bit and 64 Bit versions of Photoshop whereas today there is only a 64 Bit one, so this is probably not part of the file path anymore. – mdomino Jul 23 '20 at 20:43
0

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 Files\Adobe\Adobe 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"
  }
}
Loddi
  • 65
  • 7