Jump to content

Recommended Posts

Posted

I understand the topic is poorly phrased, but I can not think of a better way to phrase it.

I would like my script to start a program. The script is going to check and see if the program started. If it did not start, I would like to to go back to the begining and try again. Since we no longer have GoTo (Yeah, I used it a lot), I would like to know of another way to do this. Here is what I have:

ReadInfo ()
StartProgram ()

  $CheckWindow = WinExists ( 'Program' )
    If $CheckWindow = 0 Then
      Run ( 'another_program.exe' & ' ' & $Paramaters, @SCRIPTDIR )
      Sleep ( 5000 )
    EndIf

NextFunction ()

If the window does not exist, I would like the script to return back to ReadInfo () and start over from the begining..

Any help is greatly appreciated, thank you.

A little reading goes a long way. Post count means nothing.

Posted (edited)

Thank you for the help. I put it all into the 'StartProgram' function. This is what I came up with:

Func StartProgram ()

  Do
    $Switches = IniRead ( $SettingsFile, $Variable, 'Paramater', "ERROR" )
      Run ( $ProgramPath & '\' & $ProgramExecutable & ' ' & $Switches, $ProgramPath )
      Sleep ( $LoadDelay )
        $CheckWindow = WinExists ( 'Program' )
          If $CheckWindow = 0 Then
            Run ( 'another_program' & ' ' & $Variables, @SCRIPTDIR )
            Sleep ( 5000 )
          EndIf
 Until WinExists ( 'Program' )
  Return
EndFunc

Once again, thank you.

Edited by Snarg

A little reading goes a long way. Post count means nothing.

Posted

one other thought

while 1
run("notepad.exe")
sleep(1000)
; do something
if NOT winexists("Untitled") then continueloop; this would restart at while 1
; do more stuff

exitloop
Wend
MsgBox(1,"hi","there")

So many ways....

AutoIt3, the MACGYVER Pocket Knife for computers.

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
  • Recently Browsing   0 members

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