AHJAHJ Posted May 18, 2006 Share Posted May 18, 2006 (edited) Hi All,I try this Script but it doesn't run properly;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;Run ("A.exe")ProcessClose ("A.exe")Msgbox (0,"A","A");;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;First : Autoit Run A.exe then two process starts in same name (( one of them in System and the other is normal))after nearly 5 second the normal process Closes and the system Process Still Running ...I want doing something ((For eg MSGBox )) When Normal Process Closed ...I hope you understand what am i want . Edited May 18, 2006 by AHJAHJ Link to comment Share on other sites More sharing options...
Xenobiologist Posted May 18, 2006 Share Posted May 18, 2006 HI, Opt("OnExitFunc", "endscript") MsgBox(0,"","first statement") Func endscript() MsgBox(0,"","after last statement " & @EXITMETHOD) EndFunc Hope that helps. So long, Mega Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times Link to comment Share on other sites More sharing options...
AHJAHJ Posted May 18, 2006 Author Share Posted May 18, 2006 No NO !! Link to comment Share on other sites More sharing options...
Developers Jos Posted May 18, 2006 Developers Share Posted May 18, 2006 No NO !!Could be your request thats not clear .... maybe some more detail ? SciTE4AutoIt3 Full installer Download page  - Beta files    Read before posting   How to post scriptsource   Forum etiquette Forum Rules  Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Xenobiologist Posted May 18, 2006 Share Posted May 18, 2006 (edited) Hi, after read it again, I think what you need is to detect in which user context a process is running. So, you've got to processes with the same name and want to know when the user context process is closed. I have to look that up. I duuno jet, how to get the ProcessOwner or ProcessUser ... So long, Mega Edited May 18, 2006 by th.meger Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted May 18, 2006 Moderators Share Posted May 18, 2006 You could always look at ProcessWaitClose() if you wanting to do something "After" the process has closed. But even if there is a language barrier, I suggest you type it in your native tongue, and then try and do a translation so that maybe you can get the help you want or "think" you deserve... the "No No !!" didn't read so nicely from me, and I'm sure wasn't taken nicely from th.meger that was only trying to help from what he understood.. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Xenobiologist Posted May 18, 2006 Share Posted May 18, 2006 Hi,have a look at : http://www.autoitscript.com/forum/index.ph...284&hl=GetOwnerHope that helpsSo long,Mega Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times Link to comment Share on other sites More sharing options...
Valuater Posted May 18, 2006 Share Posted May 18, 2006 (edited) you should visit the "Classroom"http://www.autoitscript.com/forum/index.php?showtopic=21048#8) Edited May 18, 2006 by Valuater Link to comment Share on other sites More sharing options...
jefhal Posted May 18, 2006 Share Posted May 18, 2006 I hope you understand what am i want .I'm game. Is this what you want?:$pid = Run("charmap") While 1 If ProcessWaitClose($pid) Then MsgBox(1,"alert:","Process " & $pid & " is closed") Exit EndIf WEnd ...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format Link to comment Share on other sites More sharing options...
jefhal Posted May 18, 2006 Share Posted May 18, 2006 (edited) I hope you understand what am i want .WAIT! This is even better!!#include <Process.au3> ; run the program $pid = Run("charmap") Run("charmap"); to simulate the shadow copy for my testing only $pname = _ProcessGetName($pid) $parray = ProcessList() ; find the "shadow" copy of the program For $i = 1 to $parray[0][0] If $parray[$i][0] = $pname And $pid <> $parray[$i][1] Then $secondpname = $parray[$i][1] ExitLoop EndIf Next ; wait for the shadow copy to close and let me know when it does While 1 If ProcessWaitClose($secondpname) Then MsgBox(1,"alert:","Process " & $secondpname & " is closed") Exit EndIf WEnd Edited May 18, 2006 by jefhal ...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format Link to comment Share on other sites More sharing options...
AHJAHJ Posted May 19, 2006 Author Share Posted May 19, 2006 Thanks All, I'm game. Is this what you want?:$pid = Run("charmap") While 1 If ProcessWaitClose($pid) Then MsgBox(1,"alert:","Process " & $pid & " is closed") Exit EndIf WEndIt Runs Successfully Link to comment Share on other sites More sharing options...
Valuater Posted May 19, 2006 Share Posted May 19, 2006 be sure to put a small sleep inside the while loop as not to use CPU while ; your stuff sleep(10) wend 8) Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted May 19, 2006 Moderators Share Posted May 19, 2006 (edited) be sure to put a small sleep inside the while loop as not to use CPU while ; your stuff sleep(10) wend 8)I don't see that mattering... the sleep() or the If/Then Statement... Example:$PID = Run('Notepad.exe') ProcessWait($PID) While 1 If ProcessWaitClose($PID) Then MsgBox(64, 'Closed', 'Closed Pid') EndIf If MsgBox(64, 'Info:', "If you got here, the If statement made a difference, if not until after you got the first msgbox() it didn't") = 1 Then Exit WEnd Edit: So in other words, there's no difference between the above and this:$PID = Run('Notepad.exe') ProcessWait($PID) ProcessWaitClose($PID) MsgBox(1,"alert:","Process " & $pid & " is closed") Exit Edited May 19, 2006 by SmOke_N Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
jefhal Posted May 19, 2006 Share Posted May 19, 2006 ProcessWait($PID)ProcessWaitClose($PID)Hi SmOke_N-Do the above functions have some kind of "cpu saver" built into them, or do they consume lots of cpu time while they are waiting? If they don't then maybe the while wend loop with a sleep(10) would be less cpu intensive? - jefhal ...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format Link to comment Share on other sites More sharing options...
mr.underperson Posted May 19, 2006 Share Posted May 19, 2006 From the AutoIt manual entry for *both* functions, in a paragraph all by itself... "The process is polled approximately every 250 milliseconds." -mu 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