Jump to content

Weird Unique Error - Func/Run


kjcdude
 Share

Recommended Posts

I ran into a very weird error tonight while coding a small script, and yes i'm new to autoit.

The goal of the script is to launch a program, check to see if a series of popup errors come up, if they do, close them, then restart the program. If the pop ups come up again, it starts the process all over again until the program launches successfully. As soon as the program launches successfully, it waits for the it load all the way through (pick up updates), then shuts down the computer.

Below is the script.

Opt("WinWaitDelay",100)
Opt("WinTitleMatchMode",4)
Opt("WinDetectHiddenText",1)
Opt("MouseCoordMode",0)
$delayrand = random(1000, 5000)
run("C:\Program Files\Xxxxx\zzzzz.exe -xxxxxxxxxxx xxx -xxxxxxxxxx xxxdll.dll")
sleep($delayrand)
sleep($delayrand)
run(launchcheck())
func launchcheck()
    if Not WinExists("XXX","Unable to connect to") Then
        WinWaitActive("xxxx - xxxxxxxxxxxx","")
        run("C:\WINDOWS\system32\cmd.exe")
        sleep($delayrand)
        Send("shutdown -s -f -t 01{ENTER}")
    Else
        WinActivate("XXX","Unable to connect to")
        WinWaitActive("XXX","Unable to connect to")
        MouseMove(197,17)
        MouseDown("left")
        MouseUp("left")
        MouseMove(201,224)
        MouseDown("left")
        MouseUp("left")
        WinWait("XXX","  Xxxxx for Xxxxx")
            If Not WinActive("XXX","  Xxxxx for Xxxxx") Then WinActivate("XXX","  Xxxxx for Xxxxx")
        WinWaitActive("XXX","  Xxxxx for Xxxxx")
        MouseDown("left")
        MouseUp("left")
        WinWait("XXX","An Unknown Error has")
            If Not WinActive("XXX","An Unknown Error has") Then WinActivate("XXX","An Unknown Error has")
        WinWaitActive("XXX","An Unknown Error has")
        MouseDown("left")
        MouseUp("left")
        sleep($delayrand)
        if ProcessExists ("zzzzz.exe") then
            ProcessClose("zzzzz.exe")
            EndIf
        sleep($delayrand)
        run("C:\Program Files\Xxxxx\zzzzz.exe -xxxxxxxxxxx xxx -xxxxxxxxxx xxxdll.dll")
        sleep($delayrand)
        if WinExists("XXX","Unable to connect to") Then
            run(launchcheck())
        EndIf
    EndIf
EndFunc

And here is the error i got

Autoit Error

Line -1:

Error: Unable to execute the external program.

The system cannot find the file specified.

The error always comes up with the Unable to connect to master server dialog box in the background, it comes up sparaticly, not on certain computers, and not on certain attempts.

Thanks

Edited by kjcdude
Link to comment
Share on other sites

Well, it can be caused by many things. My guess, is that not all the computers use the same program files directory. Try using @ProgramFilesDir instead of "C:\Program Files\". Like this:

run(@ProgramFilesDir & "\Xxxxx\zzzzz.exe -xxxxxxxxxxx xxx -xxxxxxxxxx xxxdll.dll")
Link to comment
Share on other sites

Didn't Nahuel's advice work? It really seemed as if you simply used the wrong path for some computers, and since you hardcoded the path it seems common sense to use the built-in Macro's like @ProgramFilesDir and @WindowsDir instead.

Link to comment
Share on other sites

  • Developers

What is this supposed to do ?

run(launchcheck())

maybe you mean ?:

launchcheck()
Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

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