pcjogi Posted February 6, 2008 Share Posted February 6, 2008 Hi, I am locking for a way to stop (abort) a running script with only pressing the X while an external program is running. Thanks Link to comment Share on other sites More sharing options...
whim Posted February 6, 2008 Share Posted February 6, 2008 Ehm... better descriptions -> better help as in: garbage in -> garbage out Link to comment Share on other sites More sharing options...
pcjogi Posted February 6, 2008 Author Share Posted February 6, 2008 Ehm... better descriptions -> better help as in: garbage in -> garbage out Sorry, thought that was ok. I have something like this: While 1 $id_msg = GUIGetMsg() Select Case $id_msg = $GUI_EVENT_CLOSE Or $id_msg = $id_menu_file_exit ExitLoop Case $id_msg = $id_button_connect Or $id_msg = $id_menu_file_connect Connect() EndSelect Wend func connect() runwait("externalprogram.exe") endfunc The function connect() may take a while. In case of difficulties I do not want to wait for any timeout but cancel the connect which does not work while the externalprogramm is running. Understandable? Thanks Link to comment Share on other sites More sharing options...
whim Posted February 6, 2008 Share Posted February 6, 2008 I hope so ! Let's see. You want your externalprogram.exe to abort, as soon as you close your script, right ? insert this before ExitLoop in your While/Wend If ProcessExists("externalprogram.exe") Then ProcessClose("externalprogram.exe") EndIf BTW Please read the help file on these 2 commands to adapt the code to your program. Also, you might want to replace RunWait by Run & WinWaitActive, so that your script still reacts ! hope that helps (not tested, YMMV) Link to comment Share on other sites More sharing options...
pcjogi Posted February 6, 2008 Author Share Posted February 6, 2008 I hope so ! Let's see. You want your externalprogram.exe to abort, as soon as you close your script, right ? insert this before ExitLoop in your While/Wend If ProcessExists("externalprogram.exe") Then ProcessClose("externalprogram.exe") EndIf BTW Please read the help file on these 2 commands to adapt the code to your program. Also, you might want to replace RunWait by Run & WinWaitActive, so that your script still reacts ! hope that helps (not tested, YMMV) Thanks, but the externalprogram.exe is an DOS application which I want to run hidden. Therefor WinWaitActive would not work. Any further ideas? Thanks Link to comment Share on other sites More sharing options...
whim Posted February 6, 2008 Share Posted February 6, 2008 Ehm... better descriptions -> better helpas in: garbage in -> garbage outwhat's the 'DOS program' ? Link to comment Share on other sites More sharing options...
pcjogi Posted February 11, 2008 Author Share Posted February 11, 2008 what's the 'DOS program' ?It is the CISCO VPN Client (vpnclient.exe) Link to comment Share on other sites More sharing options...
evilertoaster Posted February 11, 2008 Share Posted February 11, 2008 (edited) runwait is going to block the script until it's done running. Two possible options are: 1. Not block the script by using run() instead and then manually detect in a loop when the program finishes (ProcessExists() or WinExists() are viable here). In this loop you could then allow your script to handle other input (like pressing 'X'). 2. Use a seperate thread (or a seperate 'proccess' by using a co-routine UDF) to run the blocking part and monitor it from the other thread/proccess. Edited February 11, 2008 by evilertoaster Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now