Jump to content

Newbie with strange issue


Recommended Posts

I am new to AutoIT and I am having a strange issue that I am hoping some one can help me with. I have a script that I have written to monitor certain processes and display a message box if one of them is not running. When I run it on my machine it runs fine whether I run the script file or the exe that I compiled.

When I put the exe on another machine however, I get an error message that states 'Line 15 variable used without being declared'. I don't understand why I don't get this error on my machine but do on another. If anyone has any insight it would be appreciated. The code for the script is below.

func checkProcesses()
    Dim $status
    Dim $afis = 9
    Dim $as1 = processExists("auth_svr_odbc.exe")
    Dim $cardCcol = processExists("card_col_odbc.exe")
    Dim $comm = processExists("comm_svr_odbc.exe")
    Dim $job = processExists("mapper_odbc.exe")
    Dim $nstdmn = processExists("nist_dmn_odbc.exe")
    Dim $prndmn = processExists("prn_dmn.exe")
    Dim $region = processExists("reg_sm_odbc.exe")
    
    If $afis == 0 Then
        $status = "AFIS"
    ElseIf $as1 == 0 Then
        $status = "AS1"
    ElseIf $cardCol == 0 Then
        $status = "COLL11"
    ElseIf $comm == 0 Then
        $status = "COMM"
    ElseIf $job == 0 Then
        $status = "JOB"
    ElseIf $nstdmn == 0 Then
        $status = "NSTDMN"
    ElseIf $prndmn == 0 Then
        $status = "PRNDMN"
    Else
        $status = "OK"
    EndIf
    
    return $status
    
EndFunc

While 1
    $check = checkProcesses()

    if $check <> "OK" Then
        msgBox(0, "Process Down", "Process " & $check & " is down!")
        sleep(60000)
    Else
        sleep(60000)
    EndIf
WEnd
Link to comment
Share on other sites

Thanks everyone for your assistance. I really appreciate it as I am trying to learn.

Also, does anyone have any idea why I would not get the error that I was getting about the variable when running on my machine but only when running on a different machine? I am just trying to understand the behavior.

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