• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Applescript Photoshop Automate Batch

New Here ,
Jun 21, 2019 Jun 21, 2019

Copy link to clipboard

Copied

I am trying to make an applescript that will launch Photoshop and call the Automate Batch function.  I have zero experience doing this and have only gotten snippets of code from my searching.  I was wondering if someone could help me on this.. in particular if it is at all possible to pass a source folder to the batch call and then how to make the Batch call.  Here is what I have so far, which I am pretty sure doesn't work:

    set sourceFolder to "/Users/Joe/Desktop/Temp" 

    do shell script "echo Source Path is: " & sourceFolder 

 

    tell application "com.adobe.Photoshop" 

        activate 

        try 

            set Batch_Options to {class:batch options, source folder:sourceFolder, destination:save and close, error file:Error_File, file naming:{document name lower, extension lower}, macintosh compatible:true, override open:false, override save:true, suppress open:true, suppressprofile:true, unix compatible:true, windows compatible:true} 

            batch with options Batch_Options 

        end try 

        return "Done" 

    end tell 

Any help is appreciated.

TOPICS
Actions and scripting

Views

2.3K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe
Contributor ,
Jun 21, 2019 Jun 21, 2019

Copy link to clipboard

Copied

Bonjour

Here the scripts are rather directed javascript (.jsx) that Appelscripts .......

You can consider creating a Droplet or a command line file (Windows) ?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 24, 2019 Jun 24, 2019

Copy link to clipboard

Copied

Where can I post to find people who utilize Applescript + Photoshop?  This is a pretty simple script... just haven't had the luck finding the best area to post it.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Jun 24, 2019 Jun 24, 2019

Copy link to clipboard

Copied

Here is the right place for your question, but most of us prefer Javascript, because you can use it under OSX and Windows...

Is there a specific reason why you want to use Applescript?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 25, 2019 Jun 25, 2019

Copy link to clipboard

Copied

Ok.  Let's try this via Javascript.  I've been searching on google with no luck on how to make a batch call, with batch options.  Can someone send me in the right direction?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 25, 2019 Jun 25, 2019

Copy link to clipboard

Copied

If I were to call Photoshop via Python and have it launch this javascript.. would it be something like this?  Getting errors when I've tried this.  Seems to error out on the batch_options and batch call.  So I did something wrong...

app.bringToFront();

var source_folder = arguments[0];

my_action = "ActionA"

var file_naming_options = new Array("DOCUMENTNAMELOWER", "EXTENSIONLOWER");

batch_options = 'destination=BatchDestinationType.SAVEANDCLOSE, errorFile="", fileNaming=file_naming_options, macintoshCompatible=true, overrideOpen=false, overrideSave=true, suppressOpen=true, suppressProfile=true, unixCompatible=true, windowsCompatible=true'

app.batch(source_folder, my_action, from batch_options)

283:425: execution error: Adobe Photoshop CC 2018 got an error: General Photoshop error occurred. This functionality may not be available in this version of Photoshop.

->   (8800) Expected: ).

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Jun 25, 2019 Jun 25, 2019

Copy link to clipboard

Copied

!

Bonjour

If you do not know the javascript or the Appelscript for Photoshop
It is still easier to use javascript because the OUEBE is richer in information and help for this one ???


You should start with simple functions just look at the script provided in the help and test them!

I call a batch like this on Windows: !

#target photoshop //formule pour Mac

app.bringToFront();

var bat = new File("C:/Program Files/Adobe/Adobe Photoshop CS2/Paramètres prédéfinis/Scripts/simple_viewer/SimpleW.bat");  

// run SimpleW.bat file

bat.execute();         

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 26, 2019 Jun 26, 2019

Copy link to clipboard

Copied

Erh... this is for the Photoshop batch command.  Not to run a .bat file.

Can anyone help?  It's just getting the syntax right, which seems to be the issue here.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 26, 2019 Jun 26, 2019

Copy link to clipboard

Copied

Maybe someone can help?  This is what I am using... but the syntax on calling doesn't seem to be working

BATCH command

Method

Parameter type

Returns

What it does

batch

(inputFiles, action,

from
[, options])

array of File string
string
BatchOptions

string

Runs the batch automation routine (similar to the File > Automate > Batch command).

The inputFiles parameter specifies the sources for the files to be manipulated by the batch command.

BATCHOPTIONS

Property

Value type

What it is

destination

BatchDestinationType 

Read-write. The type of destination for the processed files (default: BatchDestinationType.NODESTINATION).

destinationFolder

Folder

Read-write. The folder location for the processed files.

Valid only when destination = BatchDestinationType.FOLDER.

errorFile

File

Read-write. The file in which to log errors encountered.

To display errors on the screen (and stop batch processing when errors occur) leave blank.

fileNaming

array of

FileNamingType 

Read-write. A list of file naming options (maximum: 6).

Valid only when destination = BatchDestinationType.FOLDER.

macintoshCompatible

boolean

Read-write. True to make the final file names Macintosh compatible (default: true).

Valid only when destination = BatchDestinationType.FOLDER.

overrideOpen

boolean

Read-write. True to override action open commands (default: false).

overrideSave

boolean

Read-write. True to override save as action steps with the specified destination (default: false).

Valid only when destination = BatchDestinationType.FOLDER or SAVEANDCLOSE.

startingSerial

number

Read-write. The starting serial number to use in naming files (default: 1).

Valid only when destination = BatchDestinationType.FOLDER.

suppressOpen

boolean

Read-write. True to suppress the file open options dialogs (default: false).

suppressProfile

boolean

Read-write. True to suppress the color profile warnings (default: false).

typename

string

Read-only. The class name of the referenced batchOptions object.

unixCompatible

boolean

Read-write. True to make the final file name Unix compatible (default: true).

Valid only when destination = BatchDestinationType.FOLDER.

windowsCompatible

boolean

Read-write. True to make the final file names Windows compatible (default: true).

Valid only when destination = BatchDestinationType.FOLDER.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Jun 26, 2019 Jun 26, 2019

Copy link to clipboard

Copied

Try this..

Personally I would have just have created a Droplet like dominique mentioned, but Apples and Oranges I guess..

NOTE; I'm using Photoshop CS6, and there is a 'bug.' You need to include a 'save action' as part of the action you want to run, otherwise it will not save anything out!

set sourceFolder to POSIX file "/Users/Joe/Desktop/Temp/"

tell application "Finder"

             set imageSet to files of folder sourceFolder as alias list

end tell

set FileNames to {}

repeat with i from 1 to the count of imageSet

             set current_file to item i of imageSet

             copy current_file as text to the end of FileNames

end repeat

tell application id "com.adobe.Photoshop"

             activate

             try

                          set Batch_Options to {class:batch options, destination:save and close, file naming:{document name lower, extension lower}, macintosh compatible:true, override open:false, override save:true, suppress open:true, suppressprofile:true, unix compatible:true, windows compatible:true}

                          batch "Put your Action name here" from files FileNames from "Put your Action Set name here" with options Batch_Options

             end try

end tell

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Jun 26, 2019 Jun 26, 2019

Copy link to clipboard

Copied

LATEST

Hum.......

I do not know Mac!

Test this kind of way:
var yourvariable = new File ('~ / Desktop / whatever you want to open')

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines