photoshop saving

Good Day!

I was thinking of an applescript that will trigger a dialog box when saving a file in Photoshop CS. Do you guys have any experience of coding such script?

Ex.

I opened a file in PSCS and when I go to File–> save or apple-S; it will run the applescript to flag a dialog box saying “did you check blah blah blah”

thanks in advance

As far as I know you cannot trigger an AppleScript through an event like “Save As”. You would need to have the script launched and do the save.

Thanks Jerome,

Meaning after I opened the file in PSCS i will run the applescript to save it so I can include the dialog box before the script saves it?

Can you give me a sample?

thanks in advance

Photoshop does have events like this but to my knowledge they are javascript only if it is just a reminder that you are after then. Here is basic edit to the “Welcome.jsx” file which you will find in Adobe Photoshop CS2/Presets/Scripts/Event Scripts Only. To add an event go menubar/File/Scripts/Scripts Events Manager pick the event that you want to evoke something choose/locate the script to perform click the add button. Save document event works for both save and save as. This was saved to the events folder and called “Check.jsx” you can see this in the alert line. I didn’t touch anything else as I know almost nothing of java.

// (c) Copyright 2005. Adobe Systems, Incorporated. All rights reserved.

/** “$$$/JavaScripts/Welcome/Description=Show a simple alert when Photoshop starts.” **/

// on localized builds we pull the $$$/Strings from a .dat file, see documentation for more details
$.localize = true;

try {
alert( localize( “$$$/JavaScripts/Check=Did you remember to check blah blah blah?” ) );
}

catch( e ) {
// always wrap your script with try/catch blocks so you don’t stop production
// remove comments below to see error for debugging
// alert( e );
}

Not sure I am fully understanding what you want but I gave it a shot. Assuming you are going to have a file open in PhotoShop and then will run the AppleScript instead of hitting save or command-s, this might do what you want. Or at least get you started:

set PathToDesktop to path to the desktop as text

tell application "Adobe Photoshop CS2"
	activate
	set FileNameFull to (name of current document as text)
	set AppleScript's text item delimiters to {"."}
	set FileName to first text item of FileNameFull --gets rid of extension
	with timeout of 9999 seconds
		set SaveFormat to the button returned of (display dialog ("Check blah blah blah." & return & return & "Choose save format:") buttons {"TIFF", "PhotoShop", "Cancel"} default button "TIFF" giving up after 9990)
	end timeout
	if SaveFormat is "PhotoShop" then
		save current document in file (PathToDesktop & FileName & ".psd") as Photoshop format with options {class:Photoshop save options, embed color profile:false, save layers:true}
	end if
	if SaveFormat is "TIFF" then
		flatten current document
		save current document in file (PathToDesktop & FileName & ".tif") as TIFF with options {class:TIFF save options, byte order:Mac OS, embed color profile:false, image compression:none, save layers:false}
	end if
	close current document without saving
end tell


Oh, I just realized that it looks llike you are in CS and I am in CS2. You may need to tweak some of the language. Check the PhotoShop library for syntax if this doesn;t work.

Good luck!

Browser: Safari 419.3
Operating System: Mac OS X (10.4)