AntiVirusGuy Posted November 27, 2005 Share Posted November 27, 2005 I am writing alittle diagnosic which checks the presense of the spysweeper service and the spysweeper program the problem is they have the same name and both run at the same time. the service is SPYSWEEPER.EXE and the program is SpySweeper.exe if I do a prossessexist it can not tell the difference between the two Any ideas? Link to comment Share on other sites More sharing options...
GaryFrost Posted November 27, 2005 Share Posted November 27, 2005 (edited) from the help=Tests if two values are equal (case insensitive if used with strings). e.g. If $var= 5 Then (true if $var equals 5)==Tests if two values are equal (case sensitive if used with strings) Edited November 27, 2005 by gafrost SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
AntiVirusGuy Posted November 27, 2005 Author Share Posted November 27, 2005 (edited) I still can not distinguish between the two with processexist. It will come back true if the service is runnging. Or I don't understand what you are saying, I am new at this here is what I am doing If ProcessExists("SPYSWEEPER.EXE") Then GUICtrlCreateInput("Servicice Running", 130, 340, 125, 20, $WS_DISABLED) If ProcessExists("spysweeper.exe") Then GUICtrlCreateInput("Program Running", 260, 340, 120, 20, $WS_DISABLED) Edited November 27, 2005 by ssebrownatcolby Link to comment Share on other sites More sharing options...
GaryFrost Posted November 27, 2005 Share Posted November 27, 2005 (edited) the following solution would require beta $service = "spysweeper" If _ServiceExists($service,@ComputerName) Then MsgBox(0, "Service Status", $service & " Service Exists:") Else MsgBox(0, "Service Status", $service & " Service Does Not Exist:") EndIf Func _ServiceExists($s_ServiceName, $strComputer = "localhost") ; Generated by AutoIt Scriptomatic Const $wbemFlagReturnImmediately = 0x10 Const $wbemFlagForwardOnly = 0x20 Local $colItems = "" $objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\CIMV2") $colItems = $objWMIService.ExecQuery ("SELECT * FROM Win32_Service where Name = '" & $s_ServiceName & "'", "WQL", _ $wbemFlagReturnImmediately + $wbemFlagForwardOnly) If IsObj($colItems) Then For $objItem In $colItems Return 1 Next Return 0 EndIf SetError(1) Return 0;object not created EndFunc ;==>_ServiceExists Edited November 27, 2005 by gafrost SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
AntiVirusGuy Posted November 27, 2005 Author Share Posted November 27, 2005 I get an error in line 16 $colItems = $objWMIService.ExecQuery ("SELE.............. and this script is way to advanced for me to figure out why any ideas? Link to comment Share on other sites More sharing options...
w0uter Posted November 27, 2005 Share Posted November 27, 2005 just use '==' and 'processlist()' My UDF's:;mem stuff_Mem;ftp stuff_FTP ( OLD );inet stuff_INetGetSource ( OLD )_INetGetImage _INetBrowse ( Collection )_EncodeUrl_NetStat_Google;random stuff_iPixelSearch_DiceRoll Link to comment Share on other sites More sharing options...
GaryFrost Posted November 27, 2005 Share Posted November 27, 2005 I get an error in line 16 $colItems = $objWMIService.ExecQuery ("SELE..............and this script is way to advanced for me to figure out why any ideas? as I posted it requires beta, make sure you run it using betaone way to check to ensure you are running it in beta would beMsgBox(0,"AutoIt Version",@AutoItVersion)if you don't have beta, see link in my signature. SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
AntiVirusGuy Posted November 28, 2005 Author Share Posted November 28, 2005 how do I do that?just use '==' and 'processlist()' Link to comment Share on other sites More sharing options...
LxP Posted November 28, 2005 Share Posted November 28, 2005 (edited) This should do it rather nicely:Local $PList = ProcessList() Local $RunningSvc, $RunningPrg For $I = 1 To $PList[0][0] If Not $RunningSvc And $PList[$I][0] == 'SPYSWEEPER.EXE' Then $RunningSvc = 1 If Not $RunningPrg And $PList[$I][0] == 'spysweeper.exe' Then $RunningPrg = 1 If $RunningSvc And $RunningPrg Then ExitLoop NextEdit: And then:If $RunningSvc Then GUICtrlCreateInput('Servicice running', 130, 340, 125, 20, $WS_DISABLED) If $RunningPrg Then GUICtrlCreateInput('Program running', 260, 340, 120, 20, $WS_DISABLED) Edited November 28, 2005 by LxP Link to comment Share on other sites More sharing options...
AntiVirusGuy Posted November 28, 2005 Author Share Posted November 28, 2005 I owe you my first born thanks I need to find a good source to figure out what all these things mean. I read the autoit documentation but do not know how to do these cool things. As usual I am in your debt This should do it rather nicely: Local $PList = ProcessList() Local $RunningSvc, $RunningPrg For $I = 1 To $PList[0][0] If Not $RunningSvc And $PList[$I][0] == 'SPYSWEEPER.EXE' Then $RunningSvc = 1 If Not $RunningPrg And $PList[$I][0] == 'spysweeper.exe' Then $RunningPrg = 1 If $RunningSvc And $RunningPrg Then ExitLoop Next Edit: And then: If $RunningSvc Then GUICtrlCreateInput('Servicice running', 130, 340, 125, 20, $WS_DISABLED) If $RunningPrg Then GUICtrlCreateInput('Program running', 260, 340, 120, 20, $WS_DISABLED) 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