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 --filename option.
|
2*
|
Could not start TWAIN system.
|
3
|
Could not start TWAIN device. If the --selectdefault command was used to open the TWAIN device, the default device (TWAIN driver or hardware) is faulty.
|
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.
|
10
|
TwainSave has timed out due to no paper being placed in feeder within specified time frame. See --nouiwait and --nouiwaittime for more information.
|
11
|
TwainSave user interface could not be enabled. This return code is also produced with the --noui or --nouiwait option if a severe error interferes with proper image retrieval (for example, an unrecoverable hardware error such as a power outage, or operation error on acquisition such as a paper jam).
|
12
|
TwainSave exited due to file already existing.
This return code will occur if --overwritemode 2 is specified.
|
13
|
Device does not support the mode 2 file type specified. See
--filetype for mode 2 file types.
|
14
|
Device does not support the --uionly mode.
|
* 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 or one of the folders specified by the
--dsmsearchorder option.
|
•
|
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, or a directory specified by the --dsmsearchorder option. The TWAINDSM.DLL can be found in the DSM folder of your TwainSave folder.
|
|