autoitxp Posted October 2, 2008 Share Posted October 2, 2008 (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 October 2, 2008 by autoitxp Link to comment Share on other sites More sharing options...
autoitxp Posted October 2, 2008 Author Share Posted October 2, 2008 (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 October 2, 2008 by autoitxp Link to comment Share on other sites More sharing options...
Richard Robertson Posted October 2, 2008 Share Posted October 2, 2008 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. Link to comment Share on other sites More sharing options...
autoitxp Posted October 2, 2008 Author Share Posted October 2, 2008 can u give any example to do that effeciently ? Link to comment Share on other sites More sharing options...
Richard Robertson Posted October 2, 2008 Share Posted October 2, 2008 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. Link to comment Share on other sites More sharing options...
autoitxp Posted October 2, 2008 Author Share Posted October 2, 2008 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 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