Jump to content

Prevent Pause?


Recommended Posts

Hello, I'm fairly new to autoit. I'm working on a script to launch an app under special conditions through a launcher.

But, I'm trying to make it so if I close the launcher without launching the app the script will end.

So far I have,

Run($launcher, $launcherdirectory)  If ProcessExists($launcherexe) =False And ProcessExists($AppExe) =False Then  Exit ElseIf ProcessExists($launcherexe) And ProcessExists($AppExe) =False Then ProcessWait($AppExe) EndIF

It works, but when it pauses even if I close the launcher the script doesn't end because it's stalled at ProcessWait.

Any help would be much appreciated.

"I find it rather easy to portray a businessman. Being bland, rather cruel and incompetent comes naturally to me."

Link to comment
Share on other sites

Ok, if I understand right you have AutoIt script that launches non-AutoIt launcher, that optionally launches program. And you want script to wait until either app starts or launcher closes.

If I got logic right this would be like:

Run($launcher, $launcherdirectory)  
If Not ProcessExists($launcherexe) And Not ProcessExists($AppExe) Then  
    Exit
ElseIf ProcessExists($launcherexe) And Not ProcessExists($AppExe) Then
    Do
        Sleep(100)
    Until ProcessExists($AppExe) Or Not ProcessExists($launcherexe)
EndIf
Link to comment
Share on other sites

Thanks for the attempt but that has the same effect as what I have already.

It still hangs at the end when Launcher is closed and App wasn't started.

"I find it rather easy to portray a businessman. Being bland, rather cruel and incompetent comes naturally to me."

Link to comment
Share on other sites

Thanks for the attempt but that has the same effect as what I have already.

It still hangs at the end when Launcher is closed and App wasn't started.

Maybe...

RunWait($launcher)
If Not ProcessExists($appExe) Then Exit

Cheers, FireFox.

Link to comment
Share on other sites

That's not what I need, the process of my script should go like this

Run Launcher

Wait for App to start

If App doesn't start, and Launcher=closed Then Exit Script

If App does start, Then continue with rest of script.

But thanks.

"I find it rather easy to portray a businessman. Being bland, rather cruel and incompetent comes naturally to me."

Link to comment
Share on other sites

That's not what I need, the process of my script should go like this

Run Launcher

Wait for App to start

If App doesn't start, and Launcher=closed Then Exit Script

If App does start, Then continue with rest of script.

But thanks.

Hm, first attempt should've roughly worked. Anyway take number two:

If Not Run($launcher, $launcherdirectory) Then Exit
;maybe ProcessWait($launcher) here if too fast
Do
    Sleep(250)
Until ProcessExists($AppExe) Or Not ProcessExists($launcherexe)
If Not ProcessExists ($launcherexe) Then Exit
;else script continues here

If this fails as well I'll have to make dummy launcher executable and test with it. >_< Waiting for feedback.

Link to comment
Share on other sites

Hm, first attempt should've roughly worked. Anyway take number two:

If Not Run($launcher, $launcherdirectory) Then Exit
;maybe ProcessWait($launcher) here if too fast
Do
    Sleep(250)
Until ProcessExists($AppExe) Or Not ProcessExists($launcherexe)
If Not ProcessExists ($launcherexe) Then Exit
;else script continues here

If this fails as well I'll have to make dummy launcher executable and test with it. :( Waiting for feedback.

Awesome! That works just as intended. Thank you very much to the both of you, this has been a great learning experience. >_<

"I find it rather easy to portray a businessman. Being bland, rather cruel and incompetent comes naturally to me."

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