Complete Newbie - help required

Hi there im am an absolute beginner to applescript so please forgive me if i am asking a ridiculously easy question.

Please see below the script i have written so far… basically you drop a PDF on to the package and depending on what option is chosen it runs an action that i already have in photoshop…


on open Flat
	
	display dialog "Size...?" buttons {"King", "Standard", "Small"} default button 2
	
	set the button_pressed to the button returned of the result
	
	if the button_pressed is "Standard" then
		
		tell application "Adobe Photoshop CS3"
			
			open Flat
			
			do action "3D 150/160g Cans with no yellow banner" from "3d Actions"
			
			close documents saving no
			
		end tell
		
		
	else if the button_pressed is "King" then
		tell application "Adobe Photoshop CS3"
			
			open Flat
			
			do action "3d King Cans with yellow banner" from "3d Actions"
			
			close documents saving no
			
		end tell
	else if the button_pressed is "Small" then
		tell application "Adobe Photoshop CS3"
			
			open Flat
			
			do action "3D 40g Can" from "3d Actions"
			
			close documents saving no
		end tell
		
	end if
	
end open

Currently the action in photoshop saves a .jpg on the desktop Called rename.jpg

My question is can i have the script take the file “rename.jpg” on the desktop and give it the same name as the file that was originally dropped on the app… currently this file has the variable “flat”. Obviously i still want it to be .jpg and not .pdf.

Any help would be greatfully received as like i say i am a complete novice.

Many thanks in advance

Darren

Hi Daza

You will probably need to take the save bit out of the action and create that bit via the script to save
it down with it’s original name.

or another way would be to change it’s name once it’s on the desktop with something similar to this:

tell application "Finder" to set name of file "rename.jpg" of desktop to "daza.jpg"

daza.jpg would be the name of the original file which you would extract from the variable flat

there’s a couple of ways to go.
i would say look into the first option it’s more compact.

Hope this helps.

Thank you for your reply.

I think i am going to look in to the mothod you mentioned first and try to save the file using the script.

I wasnt sure if there was a way that the script could take the filename of the file that was dropped on then use it to become the name of something else… but like i say im totally new to all of this so gonne keep looking and let u know how i get on.

Thanks Again

Darren