I'm totally new to this and can't get my head around why my code snippet doesn't entirely work.
I have, by some of the scripts I've seen on the forum, a simple script that performs keystrokes to scan a document to make a PDF.
The problem I have is that the scanner sometimes takes longer to scan than I envisaged. My script is working perfectly as I've allowed 10 seconds for the scan to complete and carry on the rest of the operations required. This is ok until the scan takes longer than 10 seconds.
I noticed that the Scan dialogue changes from Scanner ready... to Scanning... and then to Scanner disabled... when it's finished.
I thought it would be simple to insert the following code into my script and when the scan was finished, however long it took, the rest of the script would execute.
This is my standalone test code:
Code: Select all
#Persistent
WinWait, Kodak Scanner Properties (Kodak i40 Scanner),
IfWinNotActive, Kodak Scanner Properties (Kodak i40 Scanner), , WinActivate, Kodak Scanner Properties (Kodak i40 Scanner),
WinWaitActive, Kodak Scanner Properties (Kodak i40 Scanner),
Sleep, 100
DetectHiddenText Off
SetTimer, CheckText, 250
return
MsgBox %text%
ExitApp
CheckText:
WinGetText, text,Kodak Scanner Properties (Kodak i40 Scanner), Scanner disabled...
if (text <> "")
{
SetTimer, CheckText, Off
return
}
When I check to see what it's doing I can see that it detects when Scanner disabled... is displayed and executes the SetTime, CheckText, Off line but then just sits at return.
I'm sure I'm missing something simple but I just don't know what it is.
Any help would be appreciated.