Copy link to clipboard
Copied
Hi All,
I am automating photoshop to process image conversion(using python and appscript) and at times photoshop comes up with a "Warning Dialogs" for some images when trying to open. I tried to suppress this warning when opening a PDF file by using the options
PDF_open_options -- Settings related to opening a generic PDF document
suppress_warnings boolean -- supress any warnings that may occur during opening
Still Photoshop opens the warning dialogs.I want a solution so that I can manually or programatically(using appscript or python) make photoshop not to show any warning dialogs.
Copy link to clipboard
Copied
Hi. Have a same problem. Have You a solution?
Copy link to clipboard
Copied
Yep hade a solution
You are welcome to try this for what its worth. It should do 2 things. First if there is a Photoshop "warning" record the info the dismiss the dialog proceed with file else record the "error" info kicked back to AppleScript but not process this file. This is a far as I got with this and you would be well advised to do some testing of your own. Requires Enable access for assistive devices this is in system prefs.
property Error_Report : (path to desktop folder as Unicode text) & "Problem Image Report.txt"
global PS_Info
set PS_Info to ""
--
set The_File to choose file
--
tell application "Adobe Photoshop CS3"
activate
try
with timeout of 2 seconds
open The_File
end timeout
on error
my Check_For_Dialogs()
tell application "System Events"
tell application process "Adobe Photoshop CS3"
keystroke return
end tell
my Problem_Images(The_File, PS_Info)
end tell
end try
if exists document 1 then
set Doc_Ref to the current document
tell Doc_Ref
-- do your stuff here
end tell
end if
end tell
--
on Check_For_Dialogs()
-- This should catch the text of a Photoshop warning dialog
try
tell application "System Events"
if UI elements enabled then
tell window 1 of application process "Adobe Photoshop CS2"
if title contains "Adobe Photoshop" then set PS_Info to value of static text 2
end tell
else
tell application "System Preferences"
activate
set current pane to pane "com.apple.preference.universalaccess"
display dialog "UI element scripting is not enabled. Check \"Enable access for assistive devices\""
end tell
end if
end tell
return PS_Info
-- This should catch an error kicked back to AppleScript
on error eM number eN
set PS_Info to "Error: " & eN & ". " & eM
return PS_Info
end try
end Check_For_Dialogs
--
on Problem_Images(The_File, PS_Info)
-- Whatever info about the file you want a record of…
set File_Name to name of (info for The_File)
-- String of records to write to "Problem Image Report" text file…
set The_Info to File_Name & tab & PS_Info & return
try
open for access file the Error_Report with write permission
write The_Info to file the Error_Report starting at eof
close access file the Error_Report
on error
close access file the Error_Report
end try
end Problem_Images
Copy link to clipboard
Copied
Thanks for that script Harold, its what I was looking for. Do you know off hand how I can make that work with "on run argv"? I need to use that exact script, but have the file name/path passed to it via an argument instead of selecting it manually. I've been unsuccesful in editing what you posted to work this way. Any help would be appreciated.
Regards,
Daniel
Copy link to clipboard
Copied
Instead of set The_File to choose file you can use set The_File to "Server HD:Users:Harold:Desktop:image.psd" as alias
Copy link to clipboard
Copied
Daniel, are you wanting to use this as a call from another script of yours? If so you could just use it as a loaded script pass it a variable your file path then just run. Have it return boolean true in the exists document 1 let your other script continue.
Copy link to clipboard
Copied
Thanks for the help guys. What I've actually done is created a text file with your script that has the file variable line changed via a PERL script which then compiles the script and runs it. This works great, but as always, new problems arrise.
In short, I'm dumping a huge ammount of files into a system which checks to see if they are CS4 TIFS, or not. If they aren't, they are opened and resaved via an action to be CS4 TIFs. So far so good. Using a Photoshop droplet, I was getting a whole bunch of errors that couldn't be avoided, and would lock up the process of resaving these files. You're applescript solved nearly 100% of this, thank you. But as always, there are new problems.
There are two errors plaguing me which the applescript doesn' t handle. One of which is this...

As you can see, this error isn't a PhotoShop error, so the Applescript isn't logging it to file. The problem is occuring in the AppleScript itself. I have read from google that this error is not uncommon, and it has something to do with the files.
The second error I'm still getting is this:

This one is a PhotoShop error that is not being written to file. Both errors require manual clicking of the "OK" button.
Do you think it may be possible to edit the applescript to handle these two exceptions? As always, everyone's help is greatly appreciated.
Kindest Regards,
Daniel Costello
Copy link to clipboard
Copied
Daniel, I have not come across either of these errors before. From the dialog messages it looks like you are processing files that are located on a server or shared volume and the errors arise when attempting a save NOT an open. I always copy directories of files local then replace when processed. It might be possible to create a second AppleScript that tries a save with a short time out look for a dialog then dismiss it however I would not be able to do this for you as I can"t replicate your situation. Also my guess is that the first of your dialogs if OK was clicked it would take you to a 'Save As' dialog where you would need to rename etc.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now