Automatically scan to a network folder from a button on the MFP

    Good afternoon.
    A very long time ago there was such an article on how to implement automatic scanning when a button is pressed on the scanner, but either my hands are crooked or my reluctance to understand in detail, but I could not repeat the author’s feat. Nevertheless, he decided to implement this idea for several reasons:
    - not to distract the operator from the workstation to which the MFP is connected;
    - accelerate the process of obtaining electronic copies due to the automatic sheet feeder and two-sided scanning.

    So, we have: The Canon imageRUNNER 1133A MFP is connected via USB to a computer running Windows 7. The network has domain management, there is a separate computer with file storage.

    1. In the above article we are looking for a link to the author’s program
    Note: Initially, the author had 3 buttons (the config.ini and scan.js file shows this). Therefore, in the sources from line 31 of the scan.js file, we add one more condition. Here is a piece of code that I got:
    switch (param2) //Запускаем приложения при получении нужных параметров
      {
        case get_ini_value("config.ini", "scan1_flag"):
          wsh = new ActiveXObject("WScript.Shell");
          wsh.Run(get_ini_value("config.ini", "scan1_app"),6);
          break;
        case get_ini_value("config.ini", "scan2_flag"):
          wsh = new ActiveXObject("WScript.Shell");
          wsh.Run(get_ini_value("config.ini", "scan2_app"),6);
          break;
        case get_ini_value("config.ini", "scan3_flag"):
          wsh = new ActiveXObject("WScript.Shell");
          wsh.Run(get_ini_value("config.ini", "scan3_app"),6);
          break;
    	case get_ini_value("config.ini", "scan4_flag"):
          wsh = new ActiveXObject("WScript.Shell");
          wsh.Run(get_ini_value("config.ini", "scan4_app"),6);
          break;
        default:
          write_log(get_ini_value("config.ini", "logfile"), "No valid parameters\n" + objArgs);
      }
    

    How to compile with the author is written.

    2. Log in as an administrator and unpack the archive in C: \ ProgramData \ scan and give full access to the Domain Users group (or some other) in this directory. In principle, only two config.ini and scan.js files are needed from the archive .

    3. In the admin console, execute
    C:\ProgramData\scan\scan -reg
    

    4. Reboot the PC

    5. Log in as administrator and run regedit. Fixing the registry path to scan.exe full at the following locations:
    - In the HKEY_LOCAL_MACHINE \ SOFTWARE \ Microsoft \ Windows \ CurrentVersion \ explorer \ AutoplayHandlers \ Handlers \ WIA_ {FC36F676-4675-4CC9-B705-3AC86F456214} key InitCmdline
    - Under HKEY_LOCAL_MACHINE \ SOFTWARE \ Microsoft \ Windows \ CurrentVersion \ StillImage \ Registered Applications key the Value
    - 5.3 under HKEY_LOCAL_MACHINE \ SYSTEM \ CurrentControlSet \ Control \ StillImage \ Events \ STIProxyEvent \ {FC36F676-4675-4CC9-B705-3AC86F456214} key Cmdline

    example would scan .exe
    A will become c: \ ProgramData \ scan \ scan.exe

    How to prescribe my program for scanning honestly peeped from peeped on iCopy blog

    6. Restart the PC, log in as administrator

    7. Open “Devices and Printers”, right-click on the MFP, select “Scan Properties”, in the window that opens, go to the “Events” tab , where we select the action for each event to run ScanApp

    8. In the config file c: \ ProgramData \ scan \ config.ini, the debugflag option is set to true so that the log file is

    9. We put the MFP in scan mode, select the option, write ID_Event for each scan profile

    10. Fix confi g.ini to fit your needs
    Here's mine:
    [debug]
    debugflag=true
    logfile=debug.log
    [flags]
    scan1_flag=/StiEvent:{2A6CE1DC-C3E2-4ECF-8540-41F9197DDB86};
    scan2_flag=/StiEvent:{030E4709-6263-4278-93B4-33C15644841A};
    scan3_flag=/StiEvent:{6336E0AE-81A7-4B8A-9A63-156788D9AF9C};
    scan4_flag=/StiEvent:{2BC72F52-CE02-42BC-A843-609A9FCEA15D};
    [applications]
    scan1_app=c:\ProgramData\scan\scan_col.cmd
    scan2_app=c:\ProgramData\scan\scan_bw.cmd
    scan3_app=c:\ProgramData\scan\scan_bw_150.cmd
    scan4_app=rem резерв

    11. We also need a utility that allows you to run completely hidden console processes hidcon . You can take it here . We get their archive hidcon -x64.exe or hidcon-x32.exe , copy it to C: \ ProgramData \ scan and rename it hidcon.exe for short

    . 12. Like the author of that article, I used iCopy for scanning . The archive with the program was unpacked in C: \ ProgramData \ scan . I recommend that before scanning run the program with a graphical interface and debug the required modes.

    13. Listing of each cmd file for a specific action (Windows 1251 encoding)
    rem scan_col.cmd
    rem меняем кодировку 
    chcp 1251
    rem получаем дату_время
    set now=%TIME:~0,-3%
    set now=%now::=%
    set now=%now: =0%
    set now=%DATE:~-4%%DATE:~3,2%%DATE:~0,2%_%now%
    rem сетевая шара
    set dt=\\server\scan
    c:\ProgramData\scan\hidcon.exe "c:\ProgramData\scan\iCopy.exe /file /path %dt%\%now%.jpg /adf /duplex /r 300"

    rem scan_bw.cmd
    rem меняем кодировку 
    chcp 1251
    rem получаем дату_время
    set now=%TIME:~0,-3%
    set now=%now::=%
    set now=%now: =0%
    set now=%DATE:~-4%%DATE:~3,2%%DATE:~0,2%_%now%
    rem сетевая шара
    set dt=\\server\scan
    c:\ProgramData\scan\hidcon.exe "c:\ProgramData\scan\iCopy.exe /file /path %dt%\%now%.jpg /adf /duplex /gray /r 300"

    rem scan_bw_150.cmd
    rem меняем кодировку 
    chcp 1251
    rem получаем дату_время
    set now=%TIME:~0,-3%
    set now=%now::=%
    set now=%now: =0%
    set now=%DATE:~-4%%DATE:~3,2%%DATE:~0,2%_%now%
    rem сетевая шара
    set dt=\\server\scan
    c:\ProgramData\scan\hidcon.exe "c:\ProgramData\scan\iCopy.exe /file /path %dt%\%now%.jpg /adf /duplex /gray /r 150"

    14. On the machine that provides the ball for scanning (in my case, Windows OS), we add the following task to the scheduler: run scan_move.cmd every day at 21:00 (OEM 866 encoding)
    rem scan_move.cmd
    rem сетевая шара, вид со стороны файлохранилища
    set dt=d:\scan
    rem файлы перемещаем в Архив
    move /y %dt%\*.jpg %dt%\Архив
    rem в Архиве файлы старше 7-ми дней удаляем
    forfiles /p %dt%\Архив /d -7 /c "CMD /c del /Q @FILE"

    Hanged near the MFPs:


    UPD 05/05/2014: There was an inconvenience - scanning does not occur if no one logs in locally.

    Also popular now: