How to teach scanners to scan silently on buttons without windows and crutches?

    How to make scanners in general (we will talk about Canoscan LIDE 210) silently click a button to scan a file with the necessary parameters in the desired folder?

    image


    In my opinion, this is the most common task and for its solution the manufacturer gives us the most uncommon solutions.
    In the next versions, the manufacturers will surely add something like “send a scan to facebook” or “share on Twitter” in their software, but in order to make the mode quiet, configure it once and scan it without any windows ... we won’t survive before that.

    At the end of the article, 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 it was realized ...

    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. Change the software, but there is nothing. Because of the stress received, the secretaries have to look at cats because of this, 5% more time, maybe that is why they are so popular? (Cats)). I came across this problem three years ago in the previous scanner model, I ran into this problem today. I read the comments of many people freaked out by this problem.

    We have a passport scanner of the A5 Plusteck 550 format in the office, it really is three times more expensive, but its software can silently do with the buttons what is specified in their settings. Thank God that almost all scanners have long supported the TWAIN and WIA standards. This means that in the windows family they should work without their software and generally without installing any manufacturer's drivers.

    If desired, we can demolish all the standard software. We will work through our own windowless application through WIA (download CmdTwain or our utility at the end of the article ).

    Method 1 is more theory. I still recommend method 2.

    It is written in c # because of the number of ready-made examples. It works very simply:

    • On start, it searches for the first scanner in the system
    • Saves the scan to the directory whose address is passed by the parameter.
    • Allows itself to be assigned to any scanner button through a standard Windows interface


    With the first two points it’s clear, and the third one we will just consider in this article. From the desktop, the utility works fine. We start it, it searches for the scanner, and makes a scan to the folder that was specified by the parameter at startup. But we need to ensure that it is called by the button from the scanner, and not by clicking on the desktop. It’s best to put it somehow in this window:

    image

    To be honest, there’s not enough information about it, Google didn’t open America to me like msdn. There are several sources (hello icopy), but they are not working ... But somehow, the manufacturer of Canon (in this case, the application “MP Navigator EX 4.0”, and in the screenshot above “Photoshop”) managed to do this and we will try to find out how.

    Search for a solution


    All necessary entries are stored in the registry (well, where else?) And to search for changes we will use the free Regshot application ( http://sourceforge.net/projects/regshot/ ). It allows you to remove two snapshots of the registry and show the changes.
    We will take a snapshot of the registry before installing MP Navigator EX 4.0 and after, and save the result of the comparison in an html file for analysis.

    I will not cite the entire log that we received. From it, two keys in the registry turned out to be 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 connection of image pickup devices.
    If the device is connected to any USB port for the first time, a folder is created with the following serial number and nested hierarchy inherent in the connected device type. Different scanners may have different names for sections.

    image

    When the Canoscan LIDE 210 was connected, the directory 0014 was created with two subfolders 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, more on that below)

    If you connected the scanner for the first time via this USB, then in the PushButtonPushed sections you 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, etc.
    This folder is the assigned event through the Windows interface in the scanner properties. Delete the GIUD folders with the keys, the binding will reset. You can delete them without any problems.

    But you can’t delete folders 0014 themselves. They will not be restored even when the official drivers are rolled forward and will not work with wia anymore. Checked

    image

    This is the folder you can repeat by changing the GUID of the partition and the path to the executable file yourself. Similarity logic works here. Only GUID come up with a unique one.

    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"
    


    image

    Changes to the system will take effect after reconnecting the USB connector.

    Project1.exe application that displays the parameters% 1 and% 2
    Now we can admire that our test application appeared in the window for binding events to buttons:

    wia

    However, I don’t understand the fact that even in the registry we created a folder with a path before launching our application, in the root of the parent of which the “Button for sending by email” is indicated 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. Hurrah.
    wia

    Method 2



    HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\StillImage\Events\STIProxyEvent\
    


    STIProxyEvent

    What kind of proxy events?
    The section created in this directory allows you to globally access your application in the scan properties for binding to buttons. It allows you to assign an event to the currently connected scanner through the Windows interface.

    In the first case, you will have to figure out which folder (0014 in our case) your scanner is hanging on.

    Just write in this section, and your application will be available for all events, and when binding WIA, the driver will make a copy from STIProxyEvent to the desired scanner button.

    For the changes to take effect, a reboot is required. (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"
    


    image

    As you see in the picture above, we can put our utility on any key, which works fine.

    The purpose of the event is simply a copy of the directory from STIProxyEvent to the corresponding PushButtonPushed folder described in the first case.

    Total



    • You must understand that when changing the USB connector to another, you will have to repeat the binding of events to the buttons. This is not a defect, it even works with official products. Changed the connector - button settings.
    • The STIProxyEvent registry branch is needed only as a wizard. At the time of assignment to application buttons, WIA copies the section from the EventProxy branch to the desired event folder of the scanner button.
    • In the scan properties, in events, the drop-down list with applications for binding 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 do not need to be configured through the utility. She uses the default profile, which is configured here.

    image

    That is probably all. With other scanners, I think everything will be the same for - wia. Removing standard software is not necessary.
    And yet, there is no need to duplicate registry branches for 64 bit systems. They somehow do it themselves - conveniently)

    It's nice when such a mess, you can so carefully resolve.

    Utility (win7-64 and win 8-64):
    Open a picture using the archiver (7zip, etc.) or rename it to zip
    Installation
    1) Unzip the archive to the desired location (for example, C: \ wiatest)

    2) Run through 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 to the Control Panel -> devices and printers-> right-click on the scanner -> scan properties -> Events on “4 cats”. Now this button on the scanner will save scans to “C: \ 1221”.

    You can make a shortcut simply with one parameter “C: \ wiatest \ WIATest.exe C: \ 1221” then the utility will simply scan to the folder “C: \ 1221” or any other.


    Not yet available for download. There is a bug.

    UPDATE 11/08/13

    1) Canon mp280 according to reviews initially somehow crookedly works through the image wizard. It scans only 1/4 of the A4 format when registered hard wherever possible in A4 format. They say this bug is being treated by updating drivers.

    The reader of the article and the owner of this device proposed a solution to repeat the idea through VBscript compiled in exe. pastebin.com/ce5d8yFi

    Also popular now: