Jump to content

If End if Problem


Pies
 Share

Recommended Posts

hellowee, Im creating a simple program in autoit wherein after running a program another program will be launch again. But I forgot how to to that. haha! Because i've been making some program using vb6 this past few days. anyway,the program just go as simple like this

Run(@ScriptDir & "\Warcraft.exe")
WinWaitActive("Copying","")
Sleep(1000)
WinWaitClose("Copying","")

if WinClose("Copying","") then
Run(@ScriptDir & "\Warcraftshortcut.exe")
EndIf
    
Exit

well, at first the first program will run, but after that, the 2nd program should run next if the first program is already done. But after the closing of the first program, the 2nd program isnt running. How can I make this to work.

"Failure is the key to success. So try and try until you succeed!"
Link to comment
Share on other sites

Using WinWaitClose will pause the script until the window is closed I believe.

Using the If WinClose() Endif is trying to close a non-existant window.

You could re-write it like this.

Run(@ScriptDir & "\Warcraft.exe")
WinWaitActive("Copying","")
Sleep(1000)
WinClose("Copying","")

While 1

if not winexists("Copying","") then
exitloop
EndIf
    
Wend
Run(@ScriptDir & "\Warcraftshortcut.exe")
Exit
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...