Skip to main content
Participant
December 18, 2008
Question

Applescript Save As PNG without dialogs

  • December 18, 2008
  • 1 reply
  • 3386 views
Does anyone know how to force the dialogs that sometimes appear when applescripting a save as PNG to never ever appear? The Photoshop CS4 Applescript ref doc doesn't mention any options about this.

Thanks in advance,
- Alex Zavatone
This topic has been closed for replies.

1 reply

Inspiring
August 17, 2009

Well, this is an old post, but maybe someone else needs the answer. Here's what worked for me:

set destinationfolder to "MyHardDrive:MyFolder:"

set currentFilepath to destinationfolder & "MyFileName.png"

set saveOptions to {class:PNG save options, interlaced:false}

save current document in file currentFilepath as PNG with options saveOptions appending no extension with copying

Applescript won't tell you if the destination folder doesn't exist. Instead, the save dialog box will pop up.

Muppet_Mark-QAl63s
Inspiring
August 17, 2009

It is better where possible to use the "path to" from AppleScript's standard additions suite as this gives you flexible parts to a location as opposed to hard coding a path also you can check the existence of a location by using a try and error and coerce the path to an 'alias' if it works it exists on error it does not.