|
As with most well-behaved command-line programs, TwainSave returns an integer return code on termination indicating success or failure when TwainSave exits. The return code can be used in batch programs that check for the return values of executable functions (i.e. the ERRORLEVEL command), or the return code can be used by programs that start the TwainSave executable as a process, and check the return code of the process.
A list of the return codes, as well as their definitions are as follows:
Return Code
|
Definition
|
0
|
TwainSave ran successfully.
|
1
|
File name was not specified. The TwainSave command-line is missing the -f option.
|
2*
|
Could not start TWAIN system.
|
3
|
Could not start TWAIN device.
|
4
|
Could not save file successfully.
|
5
|
Bad or illegal command-line argument(s).
|
6
|
User cancelled TwainSave by not selecting a device.
|
7
|
Error in starting the acquisition process from the device.
|
8
|
Device does not support Black/White, Grayscale, or RGB images.
|
9
|
Console not available. Use -noconsole option
|
* Special instructions if you get a return code of 2:
For return code 2, the probable reason why the TWAIN system cannot be started is that your system has a missing or corrupted TWAIN_32.DLL, or for 64-bit TwainSave, TWAINDSM.DLL is missing, corrupted or for some reason cannot be opened.
This file (TWAIN_32.DLL or TWAINDSM.DLL for 64-bit programs) is the TWAIN Data Source Manager. These files must be available for all programs (not just TwainSave) that wish to utilize the TWAIN protocol. If these files are indeed missing, then the following steps are required:
| • | If you are running on a Windows® 32-bit operating system, or if you're running on a 64-bit Windows® operating system but only utilizing the 32-bit version of TwainSave, the TWAIN_32.DLL is already installed when the operating system is initially installed. Usually it is located in the 32-bit Windows® System32 folder. Note that TWAINDSM.DLL need not exist to retrieve images from 32-bit devices. Please make sure TWAIN_32.DLL exists or is in one of the folders specified by your PATH environment variable.
|
| • | If you are running on a Windows 64-bit system and utilizing 64-bit TwainSave (TwainSave64.exe) , then the TWAINDSM.DLL needs to be installed. As of this writing of the documentation, 64-bit Windows operating systems do not install TWAINDSM.DLL. By default, the TwainSave64.exe program will dynamically create the TWAINDSM.DLL on each run (and will systematically destroy this file when TwainSave64 closes), therefore a return code of 2 should never occur. However, in the rare event of a return code of 2 occurring, you need to manually "install" TWAINDSM.DLL, either in the same folder as TwainSave64.exe, or in any directory that is accessible specified in your PATH environment variable. The TWAINDSM.DLL can be found in the DSM folder of your TwainSave folder. |
|