Thread View: adobe.photoshop.scripting
5 messages
5 total messages
Started by Andrew_L_Slayman
Tue, 03 Mar 2009 23:39
Scripting novice needs help!
Author: Andrew_L_Slayman
Date: Tue, 03 Mar 2009 23:39
Date: Tue, 03 Mar 2009 23:39
12 lines
1795 bytes
1795 bytes
Apologies in advance for asking a "how do I do this" question. While I've written a couple of very simple scripts in the past, it's been a couple of years, and I don't know where to begin with this one: Somehow a couple of my files got damaged, such that when I try to open them Photoshop CS3 returns a dialog saying, "This file has been damaged by a disk error," with options to open anyway or to cancel. I would like to have Photoshop systematically check all my other files to see if there are any additional problems. (I could of course just sit there and try to open all X-thousand images one by one, but I'd be there forever.) So I thought I'd write an action to save resized copies, run all my images through it in a batch, and Photoshop would log any damaged-file errors to the batch error log. Trouble is I can't figure out how to automate an "OK" reply to the dialog box, and the message doesn't get recorded as an error in the errors log. Is there any way to do this via scripting? The key piece of this is to capture which images throw up the error, and make a list of them somewhere. I can't be the first person who has wanted to do this... Many thanks, Andrew
Re: Scripting novice needs help!
Author: christoph_pfaffenbichler
Date: Wed, 04 Mar 2009 08:42
Date: Wed, 04 Mar 2009 08:42
1 lines
664 bytes
664 bytes
Does the Error-message get recorded when opening with Scripting-Listener?
Re: Scripting novice needs help!
Author: Andrew_L_Slayman
Date: Wed, 04 Mar 2009 14:59
Date: Wed, 04 Mar 2009 14:59
1 lines
772 bytes
772 bytes
Good question. Unfortunately, I think the answer is no. The JS log for opening and immediately closing a damaged file looks exactly the same as that for a normal file; ditto for the VB log.
Re: Scripting novice needs help!
Author: fazstp
Date: Mon, 16 Mar 2009 05:47
Date: Mon, 16 Mar 2009 05:47
31 lines
1169 bytes
1169 bytes
Can you just suppress dialogs and use a try block to open the image?
function openImage( file_name ) {
// store dialog mode
dialog_mode = displayDialogs;
displayDialogs = DialogModes.NO;
// init flag
var file_valid = true;
// get file ref
var file_ref = File( file_name );
// try to open image
try {
// open file
open ( file_ref );
} catch( err ) {
// clear flag
file_valid = false;
}
// restore dialog mode
displayDialogs = dialog_mode;
// return success
return file_valid;
}
Re: Scripting novice needs help!
Author: xbytor
Date: Mon, 16 Mar 2009 13:53
Date: Mon, 16 Mar 2009 13:53
22 lines
1477 bytes
1477 bytes
fazstp@adobeforums.com wrote:
> Can you just suppress dialogs and use a try block to open the image?
>
> function openImage( file_name ) {
>
There are some broken images that will slip by this technique. Instead of
throwing an exception (as it should), you get the 'damaged' dialog.
If you are running on XP, you can use a utility like AutoHotKey to automatically
hit the 'damaged' dialog which results in the above openImage function
returning false.
Here's what I originally wrote on the topic:
http://www.ps-scripts.com/bb/viewtopic.php?p=8519&sid=710f64b04bc6cfb71aa4bc5f2b3d3cc0
I never could find anything that would automatically take care of the 'damaged'
dialog on the Mac, so, for a lot of people, this is a less than complete solution.
-X
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads