Sign in to follow this  
Followers 0
autoitxp

Delete Default gateway on IEXPLORER.EXE exists

6 posts in this topic

#1 ·  Posted (edited)

Hi

I need to make app that delete default gatway when ever IEXPLORER.EXE exists in process list i know command line to del default gatway

Run(@ComSpec & " /c " & 'netsh interface ip delete address "local area connection " gateway=all', "", @SW_HIDE);

i want to accpomplish app that delete gateway when IEEXPLORER.EXE in processor list .

app must be activated all time at tray to monitor

similar like that but this is just example help me how to do that properly ?

While 1
Sleep(100)

If ProcessExists("iexplorer.exe") Then
;Run(@ComSpec & " /c " & 'netsh interface ip delete address "local area connection " gateway=all', "", @SW_HIDE); 

Else
;   Run(@ComSpec & " /c " & 'netsh interface ip Add address "local area connection" gateway=192.168.1.254 gwmetric=2', "", @SW_HIDE); 
EndIf

WEnd
Edited by autoitxp

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

first script working fine i retested n it works just fine

one more question wat if i want to put mulity processor list

like

ProcessExists("iexplore.exe" or "firefox.exe")

Edited by autoitxp

Share this post


Link to post
Share on other sites

You have to have different calls to ProcessExists to check different process names. If you try using Or, you'll get an error from ProcessExists because you are calling it with a boolean parameter.

Share this post


Link to post
Share on other sites

can u give any example to do that effeciently ?

Share this post


Link to post
Share on other sites

An easy way is to make a copy of the IE code and write Firefox in there for the copy.

Oh and also, ProcessExists doesn't return a true or false, it returns a 0 or the PID. So using ProcessExists + $Status will give you some weird values.

Share this post


Link to post
Share on other sites

finally i completed my script it works great for me . thanks all who helped me

Dim $explore[25] = ["iexplore.exe", "firefox.exe"]
Dim $Status[25] = [False]


While 1
    Sleep(100)

    For $i = 0 To 1
    If ProcessExists($explore[$i]) And $Status[$i] = False Then
   $Status[$i]  = True
            ConsoleWrite($explore[$i] &  " " & "Active" & @CRLF) 
  EndIf
    If Not ProcessExists($explore[$i])  And $Status[$i] = True Then
        $Status[$i]  = False
            ConsoleWrite($explore[$i] &  " " & "Not Active" & @CRLF)
EndIf
    
Next

WEnd

Share this post


Link to post
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
Sign in to follow this  
Followers 0