Sign in to follow this  
Followers 0
JohnCleese

Prevent Pause?

7 posts in this topic

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

Share this post


Link to post
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

Share this post


Link to post
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."

Share this post


Link to post
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.


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
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."

Share this post


Link to post
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.

Share this post


Link to post
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."

Share this post


Link to post
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
Sign in to follow this  
Followers 0