|
|
|||||||
Since it's a slow day, thought I would pump the korg brain-trust with a challenge ... Can anybody think of a way, using RUN or SHELL or maybe even COM (wsh what have you) to be able to do the following ... At the beginning of the script, start an instance of an exe (say - notepad.exe for example), have notepad running "in the background", yet get control returned back to your script (because the script needs to do stuff while notepad is displayed), then (and here's the trick) ... be able to AUTOMATICALLY close-down notepad when the script terminates (without explicitly killing the notepad process) ... Say for example, the assumption would be that notepad would be some kind of "child" process that would automatically terminate when the parent process (kix32) terminated. If this is not possible (not sure if it is), then kill the notepad process somehow, without alot of muss and fuss. But ideally, if this child process could be killed by default, that would be the best. Thoughts anyone ? For example... the script would start like this. The following is the script ... see the script below ... the script is coming next, here it is ... Code:
-Shawn |
||||||||
|
|
|||||||
doesn't START have such a switch? |
||||||||
|
|
|||||||
sooo ... show me the money ! |
||||||||
|
|
|||||||
too busy, you know |
||||||||
|
|
|||||||
Well, it may not be the most elegant way to do it, but... Code: Break on |
||||||||
|
|
|||||||
hehee, good one - clever! What i was hoping to accomplish was that if the "user" canceled the script (however), that the child process would automatically terminate as well ... ja |
||||||||
|
|
|||||||
If you have "Break OFF" then when the user canceled the script the user session would close (logoff) closing notepad. |
||||||||
|
|
|||||||
hmmm, was hoping not to go to that extreme ... |
||||||||
|
|
|||||||
cool! so, hoby only one with acceptable answer. really nice one. I have one other already. it's long but a nicey... just need to get it written. |
||||||||
|
|
|||||||
Shawn, you old mod', forgot the Scripts Forum rules about including a script in the initial post? ;-) |
||||||||
|
|
|||||||
Shawn, the old mod', got moderated. LOL |
||||||||
|
|
|||||||
Happens to the best of us ;-) |
||||||||
|
|
|||||||
I posted here very much on purpose ... |
||||||||
|
|
|||||||
this moved? can't see any notes... |
||||||||
|
|
|||||||
ja, general discussion is a much better place to be talking about a kixtart script. |
||||||||
|
|
|||||||
maybe... anyway, back to the challenge... a direct child-parent stuff is little "eh": Quote: http://www.microsoft.com/msj/0698/win320698.aspx |
||||||||
|
|
|||||||
Thank you Jooel ... that is the magic information i was looking for. There is no parent-child relationship, so no straight-forward way of doing this. |
||||||||
|
|
|||||||
its rude.. crude.... and ugly as all sin to look at.... but.... Code:
|
||||||||
|
|
|||||||
ja bryce, that looks so much like mine. different approach but finally the logic behind is same. sadly shawn said it's too complex. he wants 1 liner [censored]. |
||||||||
|
|
|||||||
What you saying Bryce ? This script is like that ugly girl at the office (that everyone has) ? The one that for some reason we can't stop fantasizing about ? ;0) |
||||||||
|
|
|||||||
nope. that would be your swedish-teacher. "svenska talande pojker och flickor" huh. |
||||||||
|
|
|||||||
Don't mean to ask a stupid question, but what is this doing? Code:
|
||||||||
|
|
|||||||
and to explain. swedish teacher is the ugliest thing you can imagine. |
||||||||
|
|
|||||||
Quote: the script has 2 modes.... the first mode will launch notepad.exe identify nopepads's PID and then the script calles it self again so it can run in the 2nd mode. the 2nd moce is passed a variable $garddog=<kix pid>,<notepad pid> when in guarddog mode, this 2nd script watches the original kix PID and when this PID is no longer running, it terminats the notepad PID. .... confused yet |
||||||||
|
|
|||||||
ahhh... nice idea. There were some discussions on MSN about doing this, but in two scripts... cool |
||||||||
|
|
|||||||
Hi We are having the opposite problen, i.e. we need to keep the application (notepad or whatever) running after the script closes. The really funny thing is that the script behaves differently depending on whether it was invoked (1) through group policy or (2) manually; in (1) all applications called from the script close when the script is closed by the user (there is a progress window that the user can close by clicking OK); in (2) all applications remain active (which is what we want). The win32 specification quoted earlier on in this thread doesn't seem to explain the (1) scenario... but I read somewhere that the GPO thing starts a WSH session in which the login script runs and I am guessing that closing the script also closes the WSH and everything running in it. |
||||||||
|
|
|||||||
and someone said wintendos don't understand inheritance! |