erifash Posted November 6, 2005 Posted November 6, 2005 Here are some object helper functions I have been working on: #cs Uses a For...In loop to return the enumerated element (level in the code) of an object. #ce Func OBJin( $oObject, $iLevel = 1 ) If not IsObj($oObject) Then SetError(1) Return "" EndIf If $iLevel < 1 Then SetError(2) Return "" EndIf Local $i = 1, $o For $o in $oObject If $i = $iLevel Then Return $o $i += 1 Next SetError(3) Return "" EndFunc#cs Returns the number of elements in an object. #ce Func OBJs( $oObject ) If not IsObj($oObject) Then SetError(1) Return 0 EndIf Local $i = 0, $o For $o in $oObject $i += 1 Next If $i = 0 Then SetError(2) Return $i EndFunc Questions and comments are greatly appreciated! My UDFs:_FilePrint() | _ProcessGetName() | _Degree() and _Radian()My Scripts:Drive Lock - Computer Lock Using a Flash DriveAU3Chat - Simple Multiuser TCP ChatroomStringChunk - Split a String Into Equal PartsAutoProxy - Custom Webserver
erifash Posted November 6, 2005 Author Posted November 6, 2005 Here is an example if anyone is confused: Func _GetProxy( $sPC = "." ) Local $oWMI = ObjGet("winmgmts:{impersonationLevel=impersonate}!\\" & $sPC & "\ROOT\CIMV2"), $oProxy = OBJin($oWMI.ExecQuery("SELECT * FROM Win32_Proxy", "WQL", 0x10 + 0x20)) Return $oProxy.ServerName EndFunc My UDFs:_FilePrint() | _ProcessGetName() | _Degree() and _Radian()My Scripts:Drive Lock - Computer Lock Using a Flash DriveAU3Chat - Simple Multiuser TCP ChatroomStringChunk - Split a String Into Equal PartsAutoProxy - Custom Webserver
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