Sign in to follow this  
Followers 0
goodbyeplanet

how do i timeout a run command

8 posts in this topic

the run command executes the exe file which install the program on the computer. How do i timeout suppose the installation for some reason hangs....

thank you for your help...

Share this post


Link to post
Share on other sites



You can check the PID whether it still exists after x seconds/minutes/hours.

The Run command returns the PID.

Br,

UEZ


Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites

You can check the PID whether it still exists after x seconds/minutes/hours.

Not really..I have noticed that the PID will ALWAYS remain even if the exe hangs. I tried it soemtime last week...

Share this post


Link to post
Share on other sites

What do you want to do when the app. hangs? Close the hanging app?

Br,

UEZ


Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites

yes i would like to close the hanging app...

Share this post


Link to post
Share on other sites

$pid = run (myapp.exe)
$time = @sec
if $time > 20 then
processclose($pid)
endif

above is something that might be close but determining how long each app installs is a bit complicated since i have soo many applications..

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

Here an simple example which starts Calc.exe and closes it after 10 seconds.

$pid = Run("calc.exe", "", @SW_HIDE)
$timer = TimerInit()
$wait = 1000 * 10 ;10 seconds
While TimerDiff($timer) < $wait
    Sleep(50)
WEnd
ProcessClose($pid)
Exit

You can use an array for saving the pids and its timeout values.

Each second you can check whether pid still exits and if it is running more than timeout value close the app.

Br,

UEZ

Edited by UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites

How do i timeout suppose the installation for some reason hangs....

So what condition is true after a successful install? Check for that after an amount of time has passed since the start.


- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

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