Photoshop script to save


set i to choose file -- open any PDF file
set thePath to i as text -- This is the path of the file opened
--display dialog thePath -- show me the path 
tell application "Adobe Photoshop 7.0"
	open i as PDF with options {width:3, page:1, resolution:72, mode:RGB, constrain proportions:true} -- open the pdf as a 72 dpi thumbnail
	save in "DEPTS:CHEMICON:Marketing:Literature:Thumbnails:" as JPEG with options {quality:5} with copying
	--do action "PDF Thumbnail" from "Saver Actions.atn"  -- this works but the actions would have to be installed on the host computer running the script
end tell
set PDF_dest to quoted form of POSIX path of "DEPTS:CHEMICON:Marketing:Literature:PDFs:" -- this is the destination folder for the pdf to be copied to
set PDF_source to quoted form of POSIX path of (i as text) --thePath
do shell script "cp " & PDF_source & " " & PDF_dest -- this copies the pdf file to the destination folder

I use the preceeding script to open a pdf file at 72 dpi and 3" wide then save the result to a jpg file and copy the new jpg to a folder and copy the orignal pdf to a folder both on network volumes

problem is in the red highlighted section
save in “DEPTS:CHEMICON:Marketing:Literature:Thumbnails:” as JPEG with options {quality:5} with copying
PS tells me

anybody understand what is happening?

i have a work around by writing an action to do the same
commented out --do action “PDF Thumbnail” from “Saver Actions.atn”

but i would like to maintain portability of this script to other machines withou copying my actions set to each machine as well

any help wuld be great

Try giving it a file name, not just a path.



set i to choose file -- open any PDF file
set thePath to i as text -- This is the path of the file opened
--display dialog thePath -- show me the path 

set this_info to info for i
set the current_name to the displayed name of this_info
tell application "Adobe Photoshop 7.0"
	open i as PDF with options {width:3, page:1, resolution:72, mode:RGB, constrain proportions:true} -- open the pdf as a 72 dpi thumbnail
	flatten document 1
	save in "DEPTS:CHEMICON:Marketing:Literature:Thumbnails:" & current_name as JPEG with options {quality:5} appending lowercase extension with copying
	--do action "PDF Thumbnail" from "Saver Actions.atn"  -- this works but the actions would have to be installed on the host computer running the script
end tell
set PDF_dest to quoted form of POSIX path of "DEPTS:CHEMICON:Marketing:Literature:PDFs:" -- this is the destination folder for the pdf to be copied to
set PDF_source to quoted form of POSIX path of (i as text) --thePath
do shell script "cp " & PDF_source & " " & PDF_dest -- this copies the pdf file to the destination folder

Here is the event log

[/quote]

Try changing

save in "DEPTS:CHEMICON:Marketing:Literature:Thumbnails:" & current_name as JPEG with options {quality:5} appending lowercase extension with copying

to

save document 1 in (("DEPTS:CHEMICON:Marketing:Literature:Thumbnails:" & current_name) as file specification) as JPEG with options {quality:5} appending lowercase extension with copying

Jon

save document 1 in file "DEPTS:CHEMICON:Marketing:Literature:Thumbnails: FIG_English.pdf" as JPEG with options {quality:5} appending lowercase extension with copying
	"Adobe Photoshop 7.0 got an error: invalid file path" :(

I tried to use a file with no spaces and it still wont save i also cut the extension off the original file name

save document 1 in file "DEPTS:CHEMICON:Marketing:Literature:Thumbnails: FIG_English" as JPEG with options {quality:5} appending lowercase extension with copying
	"Adobe Photoshop 7.0 got an error: invalid file path"

Any ideas??

It doesn’t look like you changed your code the way I suggested. You’re using: file “path:to:file”, while my code suggested, “path:to:file” as file specification. This code works flawlessly for me including opening the PDF and saving the JPEG with the proper extension:

Jon

I am sorry i don’t think i understood what you were trying to help me with

I thought i copied your post into my script

haven’t had a chance to try the second post but i will i had to go check out the

UPDATE:

i copied your script exact and it will not let me save the JPG file to the volume indicated

I am beginning to think it may be a Rights issue with the network volume I am planning on trying it on some local volumes instead
Script to markup code

After further experimenting i have found that i can manually save a jpg file to the network volume with no problem , but it fails when run through the AS

Strange :?

Has anyone else found anything similar when saving to a shared volume

I know for a workaround i could save it to my HD then cp or mv it to the volume.

set source_path_thumbs to “Macintosh HD:Users:jbradfield:Desktop:move to MktThumbnails:”
set target_path_thumbs to “DEPTS:CHEMICON:Marketing:Literature:Thumbnails:”

set target_path_pdfs to “DEPTS:CHEMICON:Marketing:Literature:PDFs:”

set chosen_file to (choose file) as alias
set current_name to displayed name of (get info for chosen_file)

tell application “Adobe Photoshop 7.0”
open chosen_file as PDF with options {width:3, page:1, resolution:72, mode:RGB, constrain proportions:true}
tell current document
flatten
save in ((source_path_thumbs & current_name) as file specification) as JPEG with options {quality:5} appending lowercase extension
close saving no
end tell
end tell
do shell script "cp " & (quoted form of POSIX path of chosen_file) & " " & (quoted form of POSIX path of target_path_pdfs)
do shell script "mv " & (quoted form of POSIX path of source_path_thumbs) & "* " & (quoted form of POSIX path of target_path_thumbs)

this script was automatically tagged for
color coded syntax by Script to Markup Code
written by Jonathan Nathan

Thanks johnn8 for your help!