Jump to content

Restart Programm


Recommended Posts

I want to restart a program, if the window or process closes, the program gets crashed and so on.
I used Runwait in a While loop, that worked so far really good.

Now I got the problem that Windows sometimes does show me this window
http://i.stack.imgur.com/4bCtC.png
it is not excatly that one but looks close to it.

So I want to close that window immidiatly if it appears.

Edited by NiceBoy1234
Link to comment
Share on other sites

Okay, as per our chat in the Chatbox, I will provide an example here shortly.

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

Spoiler

What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)

userbar.png

Link to comment
Share on other sites

This is the basic idea I was mentioning.

Global $check, $vshost

$vshost = @WindowsDir & "\vshost.exe"

AdlibRegister("MyAdLibFunc", 250)

Run($vshost)

$check = 1

Func MyAdLibFunc()
    If $check = 1 Then
        If Not ProcessExists("vshost.exe") Then
            Run($vshost)
        EndIf
    EndIf
EndFunc   ;==>MyAdLibFunc

You can adjust that 250 milliseconds to what you want. Basically the "MyAdLibFunc" function will be called repeatedly every 250 milliseconds or until you close your GUI or click STOP.

$vshost is obviously just an example of a path.

You can use a button in your GUI to both Run the program you want to watch, plus set $check = 1

You can also add in a window check too if you want, with WinExists etc.

You could also add a STOP button, to set AdlibUnRegister( "MyAdLibFunc") or just have that run when your GUI closes.

EDIT

Strictly speaking, you don't really need to use $check = 1, but that can provide greater flexibility if you need it (i.e. you could use START and STOP monitoring buttons). Even with that, you could just enable and disable the Adlib function at need and not use the $check flag. It all depends on what else you might be doing.

Edited by Santa

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

Spoiler

What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)

userbar.png

Link to comment
Share on other sites

Further to that, I suggest you whip up some code for your GUI etc, and provide it here for us to help you troubleshoot, if need be.

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

Spoiler

What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)

userbar.png

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

×
×
  • Create New...