I’ve gone through these forums, multiple others and have attempted every solution that I could find. If you have some ideas (or a solution!), please post but no redirections to another post plz (there’s a large chance I’ve looked at it already). My script creates various folders, takes an Ai file, exports it as various formats and then places them in the designated folders. However, a TIFF can only be exported in Photoshop which is where I run into issues. I want to automatically have Photoshop open a PDF (no choose file with prompt etc.) and export it as a TIF. I believe my exporting script is fine, but the import is broken. I’ve tried setting theFile as string/alias/text, naming and renaming, and using/not using Finder to handle the pre-import actions, and rearranging the set theFile and set theFileName. Thanks for any help in advance! Script:
display dialog "Please create a folder called LOGO PACKAGE in your desired location and place your primary native ai file inside. Press OK when finished."
tell application "Finder"
set locationLogoPackage to (choose folder with prompt "Please locate your LOGO PACKAGE folder") as alias
set folderPrimary to make new folder at locationLogoPackage with properties {name:"Primary"}
set folderPDF to make new folder at folderPrimary with properties {name:"pdf"}
set folderTIF to make new folder at folderPrimary with properties {name:"tif"}
set folderPrimary to (folderPrimary) as alias
set folderPDF to (folderPDF) as alias
set folderTIF to (folderTIF) as alias
set primaryAi to files in locationLogoPackage
set filePDF to files in folderPDF
end tell
tell application "Adobe Illustrator"
open primaryAi as alias
save current document in folderPDF as pdf without options
close current document saving no
end tell
set theFile to filePDF as string
set theFileName to name of filePDF
tell application "Adobe Photoshop CS5"
open file theFile
save current document in folderTIF as TIFF without options
close current document saving no
end tell
Model: White iMac
AppleScript: 2.3
Browser: Chrome 13.0.782.220 m
Operating System: Mac OS X (10.6)
There seems to be an issue with just opening a pdf via a script in Photoshop, need to investigate further to make sure however this works if you save as a droplet.
to open droppedFiles
repeat with i in droppedFiles
tell application "Adobe Photoshop CS5"
activate
open i as PDF with options {class:PDF open options, crop page:trim box, suppress warnings:true, mode:RGB, resolution:100.0, use antialias:true, constrain proportions:true}
set display dialogs to never
set thisdoc to current document
set w to width of document 1
set h to height of document 1
set ruler units of settings to pixel units
if (mode of thisdoc is CMYK) then
change mode thisdoc to RGB
end if
end tell
end repeat
end open
Thanks for looking into it pidge. Would importing an EPS be any easier? I tried it earlier but I’m having trouble getting any file to open with options.
Just been looking at the Photoshop CS4 scripting guide and found some sample scripts which work.
The EPS Version:
tell application "Adobe Photoshop CS4"
set myFilePath to choose file
open myFilePath as EPS with options {class:EPS open options, height:pixels 100, width:pixels 200, mode:RGB, resolution:72}
end tell
The PDF Version:
tell application "Adobe Photoshop CS4"
set display dialogs to never
set myFilePath to choose file --alias "Data:docsamples:testfiles:PdfTest.pdf"
open myFilePath as PDF with options ¬
{class:PDF open options, height:pixels 100, width:pixels 200, mode:RGB, resolution:72, use antialias:true, page:1, constrain proportions:false} ¬
end tell
Just google to find the guide.
Seems a bit flakey as i got it to work then it didn’t work the odd time.
Thought it might be my CS5 that was causing the issue.
See how you get on anyhow your mileage may vary.
Thanks for your assumption, that i don’t have the guides.
But i don’t read them all back to front everyday to keep myself up to date as you obviously do Mark.
If you want to take jHollando’s problem on then feel free.
and not a “choose file” command. The issue is setting the file as an alias/string/text so Photoshop recognizes the file unlike Finder does, I just don’t know how to properly tweak the script. And yes, I’ve looked at those guides many many times.
This works:
set filePDF to "500gig:Users:wyatt:Desktop:logo_package:Primary:pdf:testAi.pdf" as string
tell application "Adobe Photoshop CS5"
open alias filePDF
end tell
This does not:
set filePDF to files in folderPDF as string
tell application "Adobe Photoshop CS5"
open alias filePDF
end tell
But I can’t have a non-dynamic file path, it changes based on where the user originally selects where the parent folder is. In the above script… the file won’t be on the desktop the next time the script is run.
set folderPDF to choose folder
tell application "Finder" to set filePDF to every item of folderPDF as alias list
repeat with i in filePDF
tell application "Adobe Photoshop CS5"
activate
open i as PDF
end tell
end repeat
Sorry Pidge1 that comment was intended for the OP I should have made that clearer. What happens some times and this may be the case is syntax that was perfectly OK for earlier versions is picked up from posted examples without checking for version changes. I don’t recall if the app dictionary includes this info. I also script Photoshop in JavaScript so I have had to read the manuals at least twice. If you still want to use the older method of ‘height’ & ‘width’ over resolution calculations then the only option is to use action manager code from the supplied ‘scriptlistener’ plug-in.
jholland0 Take a look over in the Adobe Photoshop Scripting Forum. You will find a longish thread about Adobe busting the way AppleScript aliases are handled with Photoshop CS5. Scripts that were working before failed after this Version. Pass a string to the open command was the conclusion I think.?
Okay, so for whatever reason the first time I ran this Photoshop silent failed. Then I changed some folder alias, and changed it right back to what it was and this worked. No idea why.
set folderPDF to (choose folder) as alias
tell application "Finder"
set filePDF to every item of folderPDF as string
end tell
-- export filePDF to folderPDF via Illustrator
tell application "Adobe Photoshop CS5"
open alias filePDF
end tell
now the trick is getting Photoshop to export a file to a non-dynamic location…
Yes this is exactly the case with CS5 v12.0. You MUST update your Phototshop CS5 to v12.0.1 or 12.0.2
There may be other problems but this update is critical in order to use paths in a sane way.
You can export from Illustrator as a jpeg using applescript. Would that make it easier? Also, what about using Image Events to convert the jpeg to a tiff, bypassing Photoshop altogether?
@Divster I need jpgs as well as tifs. Bypassing Photoshop would nullify exporting as a TIF since jpgs don’t support transparency. Solved the issue already though. Thanks