Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Need an aplication that will automatically hit close on finishing a scan

Posted on 2009-02-20
13
Medium Priority
?
366 Views
Last Modified: 2013-11-10
We have a scanner hooked up (via USB) to a standalone laptop. When a a scan is completed a window apperas on the laptop saying scan completer please close window to perform another scan. The doc produced is a pdf and is saved in a shared folder on a server.

Is there an application that will automatically click the close button when this window appears? The application (ScanSnap -Fujitsu) won't allow this windows to not appear. Without manually going on the laptop to press  the mouse to close the window noone can scan again.

thanks and hope this is clear
Jim
0
Comment
Question by:buksahelp
  • 7
  • 5
13 Comments
 
LVL 7

Expert Comment

by:Ned Ramsay
ID: 23693261
Could you do it the other way round, put a batch file in so that when someone presses the scan button it triggers the program but first closes the last sessions window!
0
 
LVL 5

Expert Comment

by:pghn
ID: 23693296
You can do it with AutoHotKey - http://www.autohotkey.com/

Make a script that detects when the window opens (based on the window name), and then close it (based on the name too).

Some basic examples:
Sending keystrokes and mouse clicks
  http://www.autohotkey.com/docs/Tutorial.htm#Send

Activating and manipulating windows
  http://www.autohotkey.com/docs/Tutorial.htm#Activate

Closing Windows
  http://www.autohotkey.com/docs/commands/WinClose.htm


Install the application and make a file with extension *.ahk. Then put the code an save. Whe double click, the script loads and an icon of the application stays in the tray.

It will be something like this code (very simple):


WinWait, The_Scanner_Application_Name
IfWinExist, The_Scanner_Application_Name
    WinClose ; use the window found above

Open in new window

0
 

Author Comment

by:buksahelp
ID: 23693662
I am not a programmer so I will have to think on this one. Figured out the mouse position>>>
whrere do i put the code?
Mouse x/y is 505,422

0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 5

Expert Comment

by:pghn
ID: 23693983
You don't really need the mouse position. This is because the case of the windows doesn't appear always on the same location... I'll try to help you.

What's the name of the window you want to close?

Example: if you go Start -> Accessories -> Notepad the window name is "Untitled - Notepad"
0
 
LVL 5

Expert Comment

by:pghn
ID: 23694117
Try this (full steps):

1- Download Autohotkey from http://www.autohotkey.com/download/AutoHotkeyInstall.exe

2- Install it

3- Put the code down in a file and save it with extension *.ahk
   (change the "Untitled - Notepad" to the title of your window (without the quotes))

4- Double click on the ahk file

5- A icon appears on the system tray meaning the script is running

Now every time your window appears, the script closes it.

(I've tested this script with notepad)


Loop  ; Since no number is specified with it, this is an infinite loop unless "break" or "return" is encountered inside.
{
	WinWait, Untitled - Notepad ;wait for the window to appear
	IfWinExist, Untitled - Notepad ;check if the window is open
		WinClose ;close the window if found above
}

Open in new window

close-notepad.txt
0
 

Author Comment

by:buksahelp
ID: 23694118
this what i have recorded
but it wont run unless I launch it


WinWait, ScanSnap Manager ,
IfWinNotActive, ScanSnap Manager , , WinActivate, ScanSnap Manager ,
WinWaitActive, ScanSnap Manager ,
MouseClick, left,  156,  127
Sleep, 100
0
 
LVL 5

Expert Comment

by:pghn
ID: 23694157
That's because you need to put the code inside a continuous loop. Otherwise it will only run every time you execute it (which is the case now)
Loop
{
  "your code here"
}

Open in new window

0
 
LVL 5

Expert Comment

by:pghn
ID: 23694172
And you done right... i forgot to mention the Sleep. You need in order the scan to finish.
0
 

Author Comment

by:buksahelp
ID: 23694191
is this correct?
_______________________________________

Loop
{
WinWait, ScanSnap Manager ,
IfWinNotActive, ScanSnap Manager , , WinActivate, ScanSnap Manager ,
WinWaitActive, ScanSnap Manager ,
MouseClick, left,  156,  127
Sleep, 100
}
0
 
LVL 5

Expert Comment

by:pghn
ID: 23694306
Almost OK.
First you need to put the sleep before the mouseclick (otherwise the window will close as soon as opened)

A tip: I sugest using the WinClose instead the mouseclick. It's more fail proof.

Note that the value 1000 in the sleep is 1 second. (You need increase this value)

And don't forget right click on the systray icon and "reload this script" in order to update the script from the file after edit it.

So the final working code is (don't forget increase the sleep value):

Loop
{
	WinWait, ScanSnap Manager ,
	IfWinNotActive, ScanSnap Manager , , WinActivate, ScanSnap Manager ,
	WinWaitActive, ScanSnap Manager ,
	Sleep, 100
	IfWinExist, ScanSnap Manager
          WinClose
}

Open in new window

0
 

Author Comment

by:buksahelp
ID: 23694418
Heres the problem 2 more windows comes up before the scan is complete.

this ascript stops these windows which cancels the scan.

i only want this script to run on the very last window

thanks for your help with this
0
 
LVL 5

Accepted Solution

by:
pghn earned 200 total points
ID: 23694458
You just need to increase the sleep time.

See how many minutes a scan takes from the very beginning to the end and adapt the sleep time (give 1 minute more to make sure thinks run OK)

In this way the script will only close any of those windows when the sleep time ends.

I can't see the problem on that "extra" windows...
0
 

Author Closing Comment

by:buksahelp
ID: 31549281
Great help!!!
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If something goes wrong with Exchange, your IT resources are in trouble.All Exchange server migration processes are not designed to be identical and though migrating email from on-premises Exchange mailbox to Cloud’s Office 365 is relatively simple…
Steps to fix error: “Couldn’t mount the database that you specified. Specified database: HU-DB; Error code: An Active Manager operation fail”
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question