📜 ⬆️ ⬇️

Automatic scan to a network folder with a button on the MFP

Good day.
A long time ago there was such an article on how to implement an automatic scan when a button is pressed on a scanner, but either my hands are crooked or unwilling to understand in details, but I could not repeat the author’s feat. And yet decided to implement this idea for several reasons:
- do not distract the operator for the workstation to which the multifunction device is connected;
- to speed up the process of obtaining electronic copies through the automatic sheet feeder and double-sided scanning.

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

1. In the above article we are looking for a link to the author’s program .
Note: Initially, the author involved 3 buttons (in the file config.ini and scan.js you can see it). Therefore, in the source code from line 31 of the scan.js file, we add another 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 the author is written.

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

4. Restart the PC

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

For example, it was scan.exe
And it becomes c: \ ProgramData \ scan \ scan.exe

How to register your program to scan honestly peeped at peeked in the blog iCopy

6. Restart the PC, log in by the 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 to run ScanApp for each event

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

9. Transfer the MFP to scan mode, select the option, record the ID_Event for each scan profile

10. Fix the config.ini to fit your needs.
Here is my:
 [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 get it here . We extract their archives from hidcon-x64.exe or hidcon-x32.exe , copy to C: \ ProgramData \ scan and for brevity, rename to hidcon.exe

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

13. Listing of each cmd-file for a specific action (encoding Windows 1251)
 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 balloon for scanning (in my case, Windows), add the following task to the scheduler: perform scan_move.cmd at 9:00 pm (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" 

Near the multifunctional hanged:


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

Source: https://habr.com/ru/post/221333/


All Articles