Photoshop document renaming - HELP!

hi, i’m a newbie to applescripting and hope someone can help. the script i’ve got is to take clipboard contents (of an image), and paste them into a photoshop document whereby the image gets saved into a folder / server, etc… all this bit works fine, but i’m also trying to display a dialogue box before the saving of the image that asks for a filename for the image to be saved as…i can create the dialogue bos, get the results of the characters typed in and display them, but how do i pass this (still within the photoshop application) to photoshop to rename the open document. i can’t seem to find any dictionary item to ‘rename’ or something similar…is there a way?
i can’t include all the script as i don’t have it to hand, but it works up until photoshop (either 7 or CS) pastes and flattens the clipboard contents into a new document. the save section then follows a (bad) attempt to take the results of text entered into a dialogue window and rename the open photoshop document using the text results:

Please note that “myNewDocument” is the name of the photoshop document created using applescript

set mySaveDialogWindow to display dialog “Save the image as…” default answer “new filename for image”

that bit diplayed the typed name from the dialog window into the results window of the script editor. then i’ve tried all of these tactics and none work:

set myNewDocument to text returned of mySaveDialogWindow
set theResults to text returned of saveWindow
set myNewDocument to name of theResults
set saveWindow to theResults

i hope you can see that i’m trying to take the current document in photoshop (that’s had clipboard contents pasted into it) and save it using the filename specified by the results of the dialog box…

HELP!!!

Renaming is done through the “Finder”. As a newbie you will learn that the Finder is its own application with some of the most powerful features of AS. Copy, move, rename, info for, new folder, etc. are all Finder jobs.


set UserInput to display dialog "Name This File" default answer ""
tell application "Finder" to set name of myNewDocument to (text returned of UserInput)

SC

try something like this in PS CS:

save document 1 in (theSavePath & NewFileName) as JPEG --with options {quality:5} appending lowercase extension with copying.

Check the Photoshop dictionary under save and save options
you might want to look in you photoshop folder for a sample called “save as tiff”

-N

thanks to all who responded…i’ve tried using sitcom’s script. here’s my script with sitcom’s bit added in

tell application “Adobe Photoshop CS”
activate
set myNewDocument to make new document with properties {width:640 as pixels, height:480 as pixels, initial fill:white}
paste clipboard
flatten myNewDocument

then here’s your bit next:

set UserInput to display dialog “Save the image as…” default answer “image name here”
tell application “Finder” to set name of myNewDocument to {text returned of UserInput}
end tell

then, it comes up with error:
“Adobe Photoshop CS got an error: Property is read/only and cannot be changed”

i have access to the file / hard disk, etc as admin with read /write access

does the script give anybody else the same error? i’m probably missing something glaringly obvious!

As I mentioned, try the following:

In your Applications folder, go to your Adobe Photoshop CS folder. If you installed the extras (part of the default install) there will be a folder called Scripting Guide.

In side of that folder is a ton of documentation AND even folder containing SAMPLE SCRIPTS. Between the documentation, the sample script titled “Save As TIFF” and Sitcom’s above snippet, it should get you going.

-N