xscan v1.4

Discussion of the xtools Toolkit

Moderators: xbytor, Kukurykus, Tom


xscan v1.4

Post by xbytor »

I have a generalized solution for detecting partially corrupted and completely corrupted images in a totally automated fashion with Photoshop.

This script is an extension of the original xscan script. It adds the ability to handle partially corrupted images (with help) as well as the ability to copy or move corrupted images to a designated "Bad Images" folder.

First, some background:
When Photoshop detects a completely corrupted image, it throws an exception that can be caught with a script or dealt with transparently by the Batch manager.

When Photoshop detects a partially corrupted image, however, it always prompts the user with the "This document may be damaged..." confirmation dialog. There is no way to avoid this and no way to detect this problem ahead of time.

Until now.

I wrote the script xscan that is useful for detecting completely corrupted images. You can run it against thousands of suspect images and get a list of what images are completely corrupted. By itself, it does not deal with partially corrupted images.

To extend support to detect these troublesome images automatically, I found it necessary to use a WinXP keyboard macro tool. The tool I selected is AutoHotKey at http://www.autohotkey.com. The attached zip file contains an AHK script and ini file that I modified to solve this problem. It should be possible to use a similar macro tool on OSX to achieve the same effect.

To use xscan to detect both kinds of corrupted files, you need to copy the xscan.ahk and xscan-ahk.ini file to your "My Documents" folder. If you need to change names or put them somewhere else, you'll need to edit the AHK script accordingly.

Once the files are in place, run the xscan.ahk script with AutoHotKey. While running, the script looks for the "This document may be damaged..." dialog from Photoshop and automatically hits 'Cancel'.

Now that the AHK script is running, you can start the xscan.jsx script. As it runs and comes across damaged image files, if Photoshop displays the "This document may be damaged..." dialog, the AHK script deals with the dialog causing an exception to get thrown which the JSX script then handles.

At the end of processing, all damage image files are displayed in a final dialog and listed in a log file. The damaged files may also have been copied or moved to a Bad Images folder.



xscan v1.4

Post by weihs »

Thanks, xbytor, you've saved me again!

For those interested, I've had success with the following lines in the ini file for CS2:

Title1=Adobe Photoshop
Text1=This document may be damaged (the file may be truncated or incomplete). Continue?


xscan v1.4

Post by beauty9235 »

HI, I change your ahk file to apply our task. Now the problem is that, I run this ahk script ok, if I login on win2008, see it works well. But often On server, we don't always login remotely. if ps encounter the error "This document may be damaged", it can not close the error box, until some login on win2008 server, the ahk begins to work, for example, close the error box "This document may be damaged", the login user does nothing(ahk has being running in Mem and ps also has being running). Do you have any idea? It's very strange. My email is beauty9235@gmail.com, can we talk about it if you have time? TOM


xscan v1.4

Post by xbytor »

The AHK/WinServer2008 interaction does seem odd. It may be that for this to work correctly you will have to have someone logged in.

I haven't touched AHK in 5 years and have never worked with WinServer2008. This may, in fact, be expected behaviour. AHK probably does require that a user be logged in to work.