How to make scanners in general (it will be about Canoscan LIDE 210) silently click a button to scan a file with the necessary parameters in the desired folder?
In my opinion, this is the most common task, and to solve it, the manufacturer gives us the most uncommon solutions.
In the next versions, manufacturers will probably add something like “send scan to facebook” or “share on Twitter” to their software, but to make a quiet mode, set up once and scan without any windows ... we will not live to see it before.
')
At the end of the article is a ready-made utility that allows you to scan from any button of any scanner to any folder without any manifestation on the screen. And now let's start with how we managed to realize this ...
Without native software, the Canoscan LIDE 210 buttons do not want to work. And with the native - cause terrible indignation. It is impossible to scan by buttons without opening the native application. To change the software, yes there is nothing. Secretaries because of the stress they have to look at cats because of this 5% more time, maybe that's why they are so popular? (Cats)). I came across this problem three years ago in a previous scanner model, I ran into this problem today. I read the comments of many people vybeshennyh this problem.
We have an A5 Plusteck 550 passport scanner in the office, it’s really three times more expensive, but its software silently knows how to do what is indicated in its settings from the buttons. Thank God that almost all scanners have long supported polling standards TWAIN and WIA. This means that in the windows family they should work without their software and generally without installing any manufacturer drivers.
We can tear down if desired all standard software. We will work through
our own windowless application via WIA (download
CmdTwain or, at the end of the article, our utility ).
Method 1 is more theory. I recommend all the same
method 2
It is written in c # due to the number of ready-made examples. It works very simple:
- Search for the first scanner in the system.
- Saves the scan to the directory whose address is passed by the parameter.
- Allows you to assign yourself to any button of the scanner through a standard Windows interface
With the first two points is clear, and the third we just consider in this article. From the desktop, the utility works fine. We launch it, it searches for a scanner, and scans it into the folder that was specified by the parameter at startup. But we need to ensure that it is invoked by a button from the scanner, and not by a click from the desktop. It is best to put it somewhere in this window:
To be honest, information about this is quite small, Google did not reveal to me America as well as msdn. There are several sources (hi icopy), but they are not working ... But somehow, the Canon manufacturer (in this case, MP Navigator EX 4.0, and in the screenshot above, Photoshop) managed to do it and we will try to find out how.
Finding a solution
All the necessary entries are stored in the registry (and where else?) And we will use the free
Regshot application (
http://sourceforge.net/projects/regshot/ ) to search for changes. It allows you to remove two registry snapshots and show changes.
We take a snapshot of the registry before installing MP Navigator EX 4.0 and after, and save the result of the comparison in html file for analysis.
I will not give all the log that we received. From it, two keys in the registry were interesting for us.
Method 1.
HKLM\SYSTEM\CurrentControlSet\Control\Class\{6BDD1FC6-810F-11D0-BEC7-08002BE2092F}\
This branch is responsible for scanners and webcams. It contains, in the form of folders, your USB connections for image pickup devices.
If the device is connected to any USB port for the first time, a folder with the next sequence number and a nested hierarchy inherent to the connected device type is created. Different scanners may have different sections.
When connecting Canoscan LIDE 210, a directory 0014 was created with two subfolders of DeviceData and Events. If your scanner supports 5 buttons, in the Events folder you will see each of them even with a description of the action in the key values. (however, not everything is so logical, see below)
If you connect the scanner for the first time via this USB, then the PushButtonPushed sections will be empty. Otherwise, you will find folders with names in the form of a GUID and keys with a description of the associated software, links to the executable file TP.
This folder is a designated event through the Windows interface in the properties of the scanner. Delete folders with GIUD keys, the binding will be reset. You can delete them without problems.
But you can not delete the folder 0014 in any case. They are not restored even when driver drivers are run and will not work with wia anymore. Verified by
You can repeat this folder yourself by changing the GUID of the partition and the path to the executable file. Similarity logic works here. Only a GUID come up unique.
Like that:
Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class\{6BDD1FC6-810F-11D0-BEC7-08002BE2092F}\0014\Events\PushButtonPushed1\{9927FCDF-2047-4571-B318-762646A98111}] "Name"="Notepad salo" "Desc"="Notepad" "Icon"="sti.dll,0" "Cmdline"="C:\\Project1.exe /StiDevice:%1 /StiEvent:%2"
Changes to the system will take effect after reconnecting the USB connector.
Project1.exe application output parameters% 1 and% 2
Now we can admire that our test application has appeared in the event binding window:
However, I don’t understand the fact that at least in the registry we created a folder with the path before launching our application, at the root of whose parent is “Button for sending an email” in the windows button binding window, our application is available for another event. Why so ... I have not fully figured out.
By clicking on the scanner button, we see our console application displaying the parameters. Hooray.
Method 2
HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\StillImage\Events\STIProxyEvent\
What are the Proxy Events?
The section created in this directory allows you to globally be accessible to your application in the scan properties for linking to buttons. It allows you to assign an event to the current connected scanner via the Windows interface.
In the first case, you will have to guess on which folder (0014 in our case) your scanner is hanging.
Enough to write in this section, and your application will be available for all events, and when you bind the WIA driver makes a copy of the STIProxyEvent to the desired button on the scanner.
A
reboot is required for the changes to take effect
. (changed the path to the application? Similarly - reboot.) Or restart the WIA service.
Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\StillImage\Events\STIProxyEvent\{9927FCDF-2047-4571-B318-762646A98111}] "Name"="" "Desc"="" "Icon"="sti.dll,0" "Cmdline"=" C:\\twia\\WIATest.exe C:\\scans"
As you can see in the picture above, we can hang on any key our utility, which works fine.
The event assignment is simply a copy of the directory from the
STIProxyEvent to the corresponding
PushButtonPushed folder described in the first case.
Total
- You should understand that when you change the USB connector to another, you will have to repeat the binding of events to the buttons. This is not a flaw, it works even with official products. Changed the connector - the mood of the button.
- The registry branch STIProxyEvent is needed only as a master. At the time it is assigned to the application buttons, WIA copies the section from the EventProxy branch to the desired event folder of the scanner button.
- In the properties of the scan, in the events, the drop-down list with applications for linking to the scanner buttons is built from 2 branches, with STIProxyEvent and all PushButtonPushed folders located in the parent directory.
- Brightness, dpi and other settings through the utility is not necessary. She uses the default profile that is configured here.
That's probably all. With other scanners, I think everything will be the same for - wia. Delete the standard software is not necessary.
And yet, duplicate registry branches for 64 bit systems is not necessary. They somehow do it themselves - conveniently)
It's nice when such a mess, you can so neatly settle.
Utility (win7-64 and win 8-64):
Open with the help of the archiver (7zip, etc.) a picture or rename to zip
Installation1) Unpack the archive in the right place (for example C: \ wiatest)
2) Run via cmd.exe
"C: \ wiatest \ WIATest.exe reg C: \ 1221"
Where
reg - make an entry in the registry. (This is the second paragraph of the article)
and the second parameter “C: \ 1221” is the desired way to save your scans.
3) Reboot and assign the desired scanner button in the Control Panel -> devices and printers-> right click on the scanner -> scan properties -> Events for "4 cats". Now this button on the scanner will save scans in “C: \ 1221”.
You can simply make a shortcut with one parameter “C: \ wiatest \ WIATest.exe C: \ 1221” then the utility will simply scan into the folder “C: \ 1221” or any other.
Not yet available for download. There is a bug.
UPDATE. 11/08/13
1)
Canon mp280 reviews initially somehow crookedly works through the image wizard. It scans only 1/4 of the A4 format with hard copying wherever possible in A4 format. They say this bug is treated by updating drivers.
The reader of the article and the owner of this device was offered a solution to repeat the idea through VBscript compiled in exe.
pastebin.com/ce5d8yFi