Sign in to follow this  
Followers 0
Docfxit

Script doesn't recognize windows

5 posts in this topic

#1 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites



Call functions directly:

instead of

Call("Start_K9")

use

Start_K9()
Thank you for the reply....

I have applied the change. It still fails. I can't see where the problem might be.

Thank you,

Docfxit

Share this post


Link to post
Share on other sites

Evidently there must be a bug in the compiler

On both XP and '98 when this script is run un-compiled it does show the current line number.

When it is compiled it doesn't show.

Docfxit

Share this post


Link to post
Share on other sites

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" :-)

Share this post


Link to post
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
Sign in to follow this  
Followers 0