skip to Main Content

How are you?

I’ve created an applescript automation to save files in .JPG while the Save Dialog Box is open. (So I can control the name of the saved files)

Is there a way to control the Save Dialog Box of Photoshop?

What I want to happen is: Upon appearing of save dialog box
-Command + a will happen (to select all characters)
-Press delete (to delete all characters selected)
-Delay 8 seconds = Enough time for me write my own file name.
-Automation will press return to save the file under my own written file name.

I tried reading Photoshop’s dictionary at Script editor but found no results for Controlling Photoshop’s save dialog box.

I tried doing system events to do command a + press delete + delay 8
seconds and pressing return but that event only happens after the save
dialog box disappears instead of doing that on the actual save dialog
box.

My Photoshop is: CS6 Extended
Os: El Capitan

Thank you very much.

2

Answers


  1. You should avoid using GUI scripting : each time Adobe (or Apple) will change the graphic display of the ‘save as’ dialog box, your script may no longer work.

    Instead, use a 2 step approach : 1) get the false name and path using a standard ‘choose file name’ and then use this file to save using ‘save’ command in Photoshop. This script assume there is a current open document.

    Please update ‘Adobe Photoshop CS3’ with your version (mine is a bit old, but good enough to test !).

    Also, the default folder could be adjusted for your needs (here = Desktop).

    tell application "Adobe Photoshop CS3"
    set docRef to the current document
    set docName to name of docRef -- current name will be use as default new name
    set file2save to ((choose file name default location (path to desktop) default name docName) as string)
    save docRef in file file2save as JPEG appending lowercase extension with copying
    end tell
    

    Note 1: you can improve that script by checking the extension typed in file2save variable, and, if missing, the script can add the correct extension (i.e. ‘jpg’).

    Note 2: Adobe made some changes in ‘open ‘ command between version CS3 and CS6. I hope these changes do not affect the ‘save’ command.

    Login or Signup to reply.
  2. This is a code to what you specified also it includes open the save box:

    tell application "Adobe Photoshop CS6"
        activate
        tell application "System Events"
            keystroke "s" using {command down, shift down}
            delay 1
            keystroke "a" using {command down}
            delay 0.1
            key code 51
            delay 8
            keystroke return
        end tell
    end tell
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search