Function Reference


ObjName

Returns the name or interface description of an Object

ObjName ( $Objectvariable [,Flag] )

Parameters

$Objectvariable A variable containing an Object whose name you want to retrieve
Flag [optional] 1 = The name of the Object
2 = Description string of the Object
3 = The ProgID of the Object
4 = The file that is associated with the object in the Registry
5 = Module name in which the object runs (WIN XP And above). Marshaller for non-inproc objects.
6 = CLSID of the object's coclass
7 = IID of the object's interface

Return Value

Success: Returns a string representing the name
Failure: Sets @error and Returns ""

Remarks

Not all Objects support flags 2 to 7. Always test for @error in these cases.

Related

IsObj, ObjGet, ObjCreate

Example


Local $oInternet = ObjCreate("InternetExplorer.Application")
$oInternet.Navigate("http://www.google.com") ; Opening a web page that contains a form
Sleep(4000) ; Give the page time to load

Local $oDoc = $oInternet.document ; Example object to test
Local $oForm = $oDoc.forms(0) ; Example object to test

MsgBox(0, "", "Interface name of $oInternet is: " & ObjName($oInternet) & @CRLF & _
        "Object name of $oInternet is:    " & ObjName($oInternet, 2) & @CRLF & _
        "Interface name of $oDoc is:      " & ObjName($oDoc) & @CRLF & _
        "Object name of $oDoc is:         " & ObjName($oDoc, 2) & @CRLF & _
        "Interface name of $oForm is:     " & ObjName($oForm) & @CRLF & _
        "Object name of $oForm is:        " & ObjName($oForm, 2))