Jump to content

Script doesn't recognize windows


Docfxit
 Share

Recommended Posts

I can't get this script to recognize the windows anymore. And I can't get it to show me the current line number it's running on.

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_UseAnsi=y
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
Opt("WinWaitDelay",100)
Opt("WinTitleMatchMode",4)
Opt("WinDetectHiddenText",1)
Opt("MouseCoordMode",0)
AutoItSetOption("TrayIconDebug", 1) ;0-off
; Set so that tray displays current line number
Dim $t
Dim $Crashed = -1
Dim $Show_Log
HotKeySet("{F8}", "Terminate")
HotKeySet("{F10}", "Show_Log")

MsgBox(0, "K9 Restarter", "Running K9 and minimizing..." & @CRLF & "")
Call("Start_K9")

While 1
    $t = $t + 1
    If $t = 5 Then
        Call("Start_K9")
        $t = 0
    EndIf
;  ************   Won't recognize this window  **************
    If WinExists("K9 - 1.28 - http://keir.net", "Something bad happen") Then
        WinActivate("K9 - 1.28 - http://keir.net", "Something bad happen")
        WinWaitActive("K9 - 1.28 - http://keir.net", "Something bad happen")
        Send("{ENTER}")
        Call("Start_K9")
    EndIf
;  ************   Won't recognize this window  **************
    If WinExists("K9", "This program has performed") Then
        WinActivate("K9", "This program has performed")
        WinWaitActive("K9", "This program has performed")
        Send("{ENTER}")
        Call("Start_K9")
    EndIf
    Sleep(8000)
WEnd

Func Start_K9()
    If Not ProcessExists("K9.exe") Then
        Run("C:\Program Files\K9\K9.exe", "", @SW_MINIMIZE)
        $Crashed = $Crashed + 1
    EndIf
    Sleep(1000)
EndFunc   ;==>Start_K9

Func Terminate()
    Exit 0
EndFunc   ;==>Terminate

Func Show_Log()
    $Show_Log = Not $Show_Log
    If ($Show_Log) Then
        If (ProcessExists("K9.exe")) Then
            SplashTextOn("K9 Restarter", "K9 is running." & @CRLF & "K9 has crashed " & $Crashed & " times.", 300, 75, 0, 0)
        Else
            SplashTextOn("K9 Restarter", "K9 is NOT running." & @CRLF & "K9 has crashed " & $Crashed & " times.", 300, 75, 0, 0)
        EndIf
    Else
        SplashOff()
    EndIf
EndFunc   ;==>Show_Log

I have tried running this in XP just to test it. I really need it running in Win '98. I have recorded the text of the windows with the AutoIt Recorder. At one point it was recognizing the first window.

When I run it in the AutoIt Debugger in XP it shows the current line number but not if I run it without the debugger.

I discovered it shows the current line number if it's not compiled.

Any ideas why it won't recognize the windows? And why it doesn't show the current line number when it is compiled?

Thank you,

Docfxit

Edited by docfxit
Link to comment
Share on other sites

  • 2 weeks later...

I discovered it shows the current line number if it's not compiled.

Any ideas why it won't recognize the windows? And why it doesn't show the current line number when it is compiled?

AutoIt from 3.2.6 use new bytecode (binary) type for script stored in compiled EXE.

Thaht's why you can't see any line numbers in error messages from compiled EXE.

This isn't bug it's "feature" :-)

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...