Jump to content

I Want Helping In This Script ...


Recommended Posts

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 by AHJAHJ
Link to comment
Share on other sites

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

  • Developers

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

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 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

  • Moderators

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

Hi,

have a look at : http://www.autoitscript.com/forum/index.ph...284&hl=GetOwner

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

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

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 by jefhal
...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format
Link to comment
Share on other sites

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
WEnd
It Runs Successfully :)
Link to comment
Share on other sites

  • Moderators

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 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

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

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

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...