Copy link to clipboard
Copied
I do not want Photoshop to display any warning dialogs when trying to open an image(Ex:PDF file contains annotations and they will be discarded.. etc,) Is there any way that we can turn off or suppress these Warning Dialogs in PhotoshopCS3
Copy link to clipboard
Copied
You could try this..
app.displayDialogs = DialogModes.NO;
Copy link to clipboard
Copied
Thanks Paul,
That will help us not to display the dialog boxes in photoshop..but still the warning dialogs which comes with OK button and a check box(Dont show dialog again) is still displayed..
ps = app('/Applications/Adobe Photoshop CS3/Adobe Photoshop CS3.app')
ps.display_dialogs.set(k.never)
The above mentioned two lines will help to suppress only dialog boxes not the warning dialogs which will come only some times when trying to open an image...any suggestions??
Copy link to clipboard
Copied
It may be your pdf open options?
var pdfOpenOptions = new PDFOpenOptions();
pdfOpenOptions.antialias = true;
pdfOpenOptions.suppressWarnings = true;
pdfOpenOptions.usePageNumber = true;
pdfOpenOptions.page = 1;
pdfOpenOptions.resolution = 72;
pdfOpenOptions.mode = OpenDocumentMode.RGB;
open(file,pdfOpenOptions);
Copy link to clipboard
Copied
I am already using the opening options for PDF as below:
OPEN_OPTIONS = { 'PDF': {k.class_:k.PDF_open_options,
k.resolution: 300,
k.page: 1,
k.mode: k.RGB,
k.use_antialias:True,
k.suppress_warnings:True},
'EPS': {k.class_:k.EPS_open_options,
k.resolution: 300,
k.use_antialias:True}}
Copy link to clipboard
Copied
PDF_open_options -- Settings related to opening a generic PDF document
suppress_warnings boolean -- supress any warnings that may occur during openin
This doesn't work..Is there any other way that I can suppress warnings while opening a PDF file
Copy link to clipboard
Copied
I don't think there is much more you can do, I haven't had that problem using javascript. Have you tried javascript to open the same file? if so does it give the same problem. Is it a bug with com?
Copy link to clipboard
Copied
Hi Paul,
Forgot to say you that I am working on Mac...In Windows you can get the opened pop ups in an application..so it is not a problem with com...In mac there is no such option to find the pop ups and its controls that are coming up in an application.. Is there in any way on mac with Photoshop CS3 we can suppress these warning dialogs
Copy link to clipboard
Copied
This doesn't work..Is there any other way that I can suppress warnings while opening a PDF file
I don't know about this specific case with PDF files, but I know that
there are cases with certain kinds of file corruption (esp jpegs) that
it will always show a warning in spite of anything that you do
programatically or with preferences. This has been a massive problem
with PS when writing scripts that have to process large numbers of
jpegs. On WinXP, you can use AutoKey (or whatever is was called) to get
around this annoying problem, but I never could get anything working on
the Mac. But you may have better luck.
-X
Copy link to clipboard
Copied
I have never been able to sort this either on a Mac with AppleScript. Sure in some cases the corruption may give a dialog that you can have system events return to OK the button and the file opens but with other types of corruption there is no such dialog and file just does not open. Photoshop seems much more fussy over JPEG markers than some other apps.
Copy link to clipboard
Copied
Thanks Mark,
I am working on Mac and are there any system events which can return to OK the button and the file opens.. I tried Carbon with no success... I am trying to check Cocoa in Mac to return OK... What are the system events to be used to return OK and check on Dont show dialogs again..
Copy link to clipboard
Copied
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 CS2"
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 CS2"
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 Muppet,
I tested the script with three images that come up with a warning ...Now the script you gave is able to suppress the warning and record them in a file and able to open the image...Need to check with some other image file(different extensions) and il reply you once I complete testing with different type of images that come up with different warnings..Thanks again for your help...
Copy link to clipboard
Copied
set The_File to choose file
Is there a way so that we need not choose a file so that it gets opened in photoshop can we pass it as an argument..
For testing purpose I tried to statically give it as set The_File to "/Users/xxxx/Desktop/test.pdf"
Applescript is not able to identify the path..How to declare the filepath in AppleScript
Copy link to clipboard
Copied
In AppleScript both Photoshop and the handler to write the report expect the file path to be HFS (colon delimited) and passed as alias specifier.
To set a string to alias you do this:
set The_File to "Marks G5:Users:marklarsen:Desktop:Forms.pdf" as alias
The file must exist for the coercion "as alias" to work
Copy link to clipboard
Copied
Hey Muppet... That works..I am scripting photoshop in Python and is it possible to convert this AppleScript to Python Script ..I downloaded ASTransalate which converts Applescript to Python,Ruby and ObjC..But it doesnt work for this one...any help
Copy link to clipboard
Copied
You are way way way out of my depth now I've only just started to learn JavaScript and I doubt I'll have the time to do anything else after that.
You may find someone here with experience in that…
http://macscripter.net/viewforum.php?id=2
Copy link to clipboard
Copied
T
Copy link to clipboard
Copied
Thanks for your support ...Il figure it out how to implement this applescript in my Project...
Copy link to clipboard
Copied
Hi Mark, Thanks for your support till now... I am done with suppressing the warning dialogs using python...Just want to know is there a way in apple script to check the check box in the warning dilaog box so that there will be no warning dialog box with the same message coming up..Presently I am able to just click on the OK button .. I want to check the check box also
Copy link to clipboard
Copied
tell application "System Events"
tell application process "Adobe Photoshop CS3"
keystroke return
end tell
my Problem_Images(The_File, PS_Info)
end tell
Is it possible to check the CheckBox before doing keystroke return.
Copy link to clipboard
Copied
Thanks X,
It is not possible for me manually click on the warning dialog box always so that the same warning dialogs will not come in the future.. but photoshop will come up with warnings depending on the images ...so is there a way in photoshop that we can turn off all the waring dialogs in photoshop..(PS gave option to Reset Warning Dialogs) but no option to turn off Warning Dialogs...Any help is greatly appreciated
Copy link to clipboard
Copied