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

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
buksahelpAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Ned RamsayNetwork Operations ManagerCommented:
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!
pghnCommented:
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

buksahelpAuthor Commented:
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

10 Tips to Protect Your Business from Ransomware

Did you know that ransomware is the most widespread, destructive malware in the world today? It accounts for 39% of all security breaches, with ransomware gangsters projected to make $11.5B in profits from online extortion by 2019.

pghnCommented:
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"
pghnCommented:
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
buksahelpAuthor Commented:
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
pghnCommented:
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

pghnCommented:
And you done right... i forgot to mention the Sleep. You need in order the scan to finish.
buksahelpAuthor Commented:
is this correct?
_______________________________________

Loop
{
WinWait, ScanSnap Manager ,
IfWinNotActive, ScanSnap Manager , , WinActivate, ScanSnap Manager ,
WinWaitActive, ScanSnap Manager ,
MouseClick, left,  156,  127
Sleep, 100
}
pghnCommented:
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

buksahelpAuthor Commented:
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
pghnCommented:
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...

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
buksahelpAuthor Commented:
Great help!!!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Programming

From novice to tech pro — start learning today.