Jump to content

browser watcher


Recommended Posts

hi friend i write this script

$_WinList = WinList ( "[REGEXPCLASS:(IEFrame|Mozilla|Chrome)]" )


 dim $pid[$_WinList[0][0]+1]
 $_l=0
For $_I = 1 To UBound ( $_WinList ) -1
    If $_WinList[$_I][0] <> '' Then
        $_Classname = _WinGetClassName ( $_WinList[$_I][1] )
        If $_Classname Then
       ;    MsgBox(0, $_WinList[$_I][0],"Dilip" )
        ;    MsgBox ( 0, $_Classname ,"Dilip" )
         
         $pid[$_l] = WinGetProcess($_WinList[$_I][0])
         
         ;$ar[0]=$pid
            ;msgbox(0,"Dilip",$pid)
         ;
         ;ProcessWaitClose($pid)

          ;   msgbox(0,"Dilip","Why U Closing !! ")
        $_l = $_l+1

        
        EndIf
    EndIf
Next
 ; msgbox(0,"Dilip",$_l)
; $chk=0
; while($chk<$_l)
     
 
 
 
 ;if ProcessExists($pid[$chk]) Then
     
; else 
     
    ; MsgBox(0,"dilip","Close")
     
; EndIf
 
; $chk=$chk+1
 
 
; WEnd
 
 
 
 
Func _WinGetClassName ( $hWnd )
    If Not IsHWnd ( $hWnd ) Then $hWnd = WinGetHandle ( $hWnd )
    $aClassName = DLLCall ( "user32.dll", "int", "GetClassName", "hWnd", $hWnd, "str", "", "int", 64 )
    If Not @error And $aClassName[0] <> 0 Then Return $aClassName[2]
EndFunc

using this script i have pid number of all browser window which i open...

Now i want to watch every browser if any browser will close then it show message....

i can watch any 1 process by

ProcessWaitClose($pid)

but i want watch all pid..

and if any new browser is open so that also wath by script.....

Link to comment
Share on other sites

Hi Dilip,

you could repopulate your array every one or n-th call, e.g. by calling a function that returns a new array.

while 1
    $a_pids = GetBrowserPIDs()
    for $i=1 To $a_pids[0]
        If Not Processexists($a_pids[$i]) then
            ;Do something!
        next
    next
wend

Func GetBrowserPIDs()
    ;populate the array
    ;return values
EndFunc
Regards,Hannes[spoiler]If you can't convince them, confuse them![/spoiler]
Link to comment
Share on other sites

Hi Dilip,

you could repopulate your array every one or n-th call, e.g. by calling a function that returns a new array.

while 1
    $a_pids = GetBrowserPIDs()
    for $i=1 To $a_pids[0]
        If Not Processexists($a_pids[$i]) then
            ;Do something!
        next
    next
wend

Func GetBrowserPIDs()
    ;populate the array
    ;return values
EndFunc

i did also it not working...

it show the message when browser open... then it give the error....

i want to show message when browser is closed

Error is come

Array variable has incorrect number of subscripts or subscript dimension range exceeded.:

..

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