For some reason this script doesn’t always work when launched on a new machine. It is as if the file or Path isn’t being recognized.
Below is the line that usually errors out when such a problem exists. But after a few trial runs done manually, and once the file exists in the correct location, the file can be deleted and so can the folder, and the script will continue to work from that point on. I can not explain this accurately, because I don’t know why it isn’t working, and I am having trouble replicating the error.
Any help or insight to this with this would be Extremely appreciated. Does it have to deal with: “Open for Access” and Close for Access"? I remember seeing that code somewhere in the past?
Thanks,
jeff
This is the part of the code that comes up as error:
tell application "Adobe Photoshop CS"
with timeout of 300 seconds
activate
open alias "Illustrations:Users:admin:Desktop:Images:Exported_Image.jpg" showing dialogs never
--Do Stuff here
Here is the entire code:
tell application "Finder"
-- set visible of process "Script Editor" to false -- don't use name extension - this assumes you run it from there.
set Front_App to item 1 of (get name of processes whose frontmost is true)
end tell
if Front_App is "Illustrator CS" then
tell application "Illustrator CS"
export document 1 to file "Illustrations:Users:admin:Desktop:Images:Exported_Image.jpg" as JPEG with options {class:JPEG export options, quality:100, blur:0, horizontal scaling:100, vertical scaling:100, matte:false, optimization:false, artboard clipping:false, antialiasing:true}
end tell
tell application "Adobe Photoshop CS"
with timeout of 300 seconds
activate
open alias "Illustrations:Users:admin:Desktop:Images:Exported_Image.jpg" showing dialogs never
--Do Stuff here
end timeout
end tell
-- this ends the script and QK goes on to step 2
else if Front_App is "InDesign CS" then
tell application "InDesign CS"
tell JPEG export preferences
set properties to {Exporting Selection:true, JPEG Quality:high, JPEG Rendering style:baseline encoding}
end tell
export active document format JPG to file "Illustrations:Users:admin:Desktop:Images:Exported_Image.jpg"
end tell
tell application "Adobe Photoshop CS"
with timeout of 300 seconds
activate
open alias "Illustrations:Users:admin:Desktop:Images:Exported_Image.jpg" showing dialogs never
--Do Stuff here
end timeout
end tell -- this ends the script and QK goes on to step 2
else
tell application "Adobe Photoshop CS" to activate -- start it up. This ends the script and QK goes on to step 2
end if