Jump to content

How to Do THis script .....


 Share

Recommended Posts

I want a Script when im runing notepad.exe it counter it Im run Notepad and close it again and the script Counters +1 and im running 1 notepad more the script counters 1 more until $a > 4 Then it MSG box How much time i runned notepad anybody can help me Pls

Link to comment
Share on other sites

$a = ""

While 1 
    if ProcessExists ( "notepad.exe" ) Then
        ProcessClose("notepad.exe" )    
        Sleep(300)
        $a = $a +1
    EndIf
    if $a > 3 Then 
        MsgBox(0,"",$a)
        Exit
    EndIf
WEnd

like this?

or something like this?

$a = ""

While 1 
    if ProcessExists ( "notepad.exe" ) Then
        if $a > 2 Then 
            MsgBox(0,"",$a+1)
            Exit
        EndIf
        Do
            Sleep(10)
        Until Not ProcessExists ( "notepad.exe" )
        $a = $a +1
    EndIf
WEnd
Edited by bogQ

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 
Link to comment
Share on other sites

#include<Array.au3>
Dim $pids[1]
$proc="notepad.exe"
$times=0
While 1
    $pid=ProcessList($proc)
    If Not @error Then
        For $i=1 To $pid[0][0]
            $ss=_ArraySearch($pids,$pid[$i][1])
            If $ss=-1 Then 
                _ArrayAdd($pids,$pid[$i][1])
                $times+=1
                ToolTip($times,0,0)
            EndIf
            Sleep(50)
        Next
    EndIf
WEnd

This can even see if you run multiple instances of notepad at the same time :)

Only two things are infinite, the universe and human stupidity, and i'm not sure about the former -Alber EinsteinPractice makes perfect! but nobody's perfect so why practice at all?http://forum.ambrozie.ro

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