Jump to content

Problem. AutoIt freezes/stalls/hangs


Recommended Posts

I have created a script that loops and watches for a window.  When the window appears... it closes it.

On Windows 7, the script works just fine.

On Windows XP.. the script sometimes hangs/stalls/freezes.

Below is the script

So... the reason I know it hangs.. is that when it is looping, the "Checking Window State" scrolls with a new time every few seconds.

Then.. on XP, when the window appears "Network ScanGear"," "All originals have been scanned" ....

1.  The Checking Window State message freezes; and

2.  The window does not go away.

When I manually click the mouse to make the window go away... the script resumes.

Any ideas on what I can check to determine what is hanging my system?

 

WHILE 1

    ToolTipFunc("Checking Window State... [" & @HOUR & ":" & @MIN & ":" & @SEC & "]")
    If WinExists("Network ScanGear", "Network processing is timed out") Then
       Send("{Enter}")
       ToolTipFunc("Scanner Not Found. Locate the Scanner")
       ToolTipFunc("Closing Process:" & $i_viewID)
       $Error=ProcessClose($i_viewID)
       ToolTipFunc("i_View Process (" & $i_viewID & " Closed:" & $Error & ". @Error=" & @Error)
       Sleep(50000)
    ElseIf WinExists("Network ScanGear", "All originals have been scanned") Then
       ToolTipFunc("Activating Window ... All Originals Scanned.")
       WinActivate ( "Network ScanGear", "All originals have been scanned")
       ToolTipFunc("Terminating Window.")
       Send("{TAB}{Enter}")
       ToolTipFunc("Scan Finished Window Terminated.")
       $ScanState = "2"
       Sleep(5000)
    ElseIf WinExists("Transfer Pages", "Transferring Page") Then
       ToolTipFunc("Scanning Pages....")
       Sleep(1000)
    ElseIf WinExists("Network ScanGear", "&Scan") Then
       ToolTipFunc("Executing Scan.")
       ToolTipFunc("Activating Window ... Network ScanGear.")
       $Error = WinActivate ( "Network ScanGear")
       Sleep(1000)
       ToolTipFunc("Starting Scan..." & $Error)
       If $ScanState = "2" Then
          ToolTipFunc("Closing ScanGear ... Network ScanGear. [" & $ScanState & "]")
          $ScanState = "0"
          ToolTipFunc("Closing ScanGear ... Network ScanGear. [" & $ScanState & "]")
          WinClose ( "Network ScanGear", "&Scan" )
          Sleep(5000)
       Else
          Send("!s")
          $ScanState = "1"
          ToolTipFunc("Scan Started.")
       EndIf
    Else
        ToolTipFunc("No Window Match...")
        Sleep(1000)
    EndIf
    ToolTipFunc("Window State Check Complete...")
    Sleep(1000)

WEND

 

Link to comment
Share on other sites

Hi.

  • Where do you define the variable $i_viewID?
  • Where is the function ToolTipFunc() ?

I added a line on top of your script, so when your run it from SciTE, a "mouseover" for the systray Icon will show you the line number, it's currently at.

if not @Compiled then opt ("TrayIconDebug",1)



While 1
    ToolTipFunc("Checking Window State... [" & @HOUR & ":" & @MIN & ":" & @SEC & "]")
    If WinExists("Network ScanGear", "Network processing is timed out") Then
        Send("{Enter}")
        ToolTipFunc("Scanner Not Found. Locate the Scanner")
        ToolTipFunc("Closing Process:" & $i_viewID)
        $Error = ProcessClose($i_viewID)
        ToolTipFunc("i_View Process (" & $i_viewID & " Closed:" & $Error & ". @Error=" & @error)
        Sleep(50000)
    ElseIf WinExists("Network ScanGear", "All originals have been scanned") Then
        ToolTipFunc("Activating Window ... All Originals Scanned.")
        WinActivate("Network ScanGear", "All originals have been scanned")
        ToolTipFunc("Terminating Window.")
        Send("{TAB}{Enter}")
        ToolTipFunc("Scan Finished Window Terminated.")
        $ScanState = "2"
        Sleep(5000)
    ElseIf WinExists("Transfer Pages", "Transferring Page") Then
        ToolTipFunc("Scanning Pages....")
        Sleep(1000)
    ElseIf WinExists("Network ScanGear", "&Scan") Then
        ToolTipFunc("Executing Scan.")
        ToolTipFunc("Activating Window ... Network ScanGear.")
        $Error = WinActivate("Network ScanGear")
        Sleep(1000)
        ToolTipFunc("Starting Scan..." & $Error)
        If $ScanState = "2" Then
            ToolTipFunc("Closing ScanGear ... Network ScanGear. [" & $ScanState & "]")
            $ScanState = "0"
            ToolTipFunc("Closing ScanGear ... Network ScanGear. [" & $ScanState & "]")
            WinClose("Network ScanGear", "&Scan")
            Sleep(5000)
        Else
            Send("!s")
            $ScanState = "1"
            ToolTipFunc("Scan Started.")
        EndIf
    Else
        ToolTipFunc("No Window Match...")
        Sleep(1000)
    EndIf
    ToolTipFunc("Window State Check Complete...")
    Sleep(1000)
WEnd

Regards, Rudi.

Earth is flat, pigs can fly, and Nuclear Power is SAFE!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...