I prefer using isNameUnique, which will work on all objects (even if they cannot have user-defined attributes, like the comment-attributes --> in that case you will get the "unknown identifier" error as well if you try to use getAttrNo) and it also checks for standard attributes. With getAttrNo you can only check for user-defined attributes.
However note that isNameUnique will also check whether there is an object with the given name, when you use it on folders or networks.
The simplest approach which does not have many limitations would be ExecuteSilent, the following lines will tell you if the objects provided has a attribute called Tooltip on them or not.
print ExecuteSilent("param o: Object -> boolean; var text: string := o.Tooltip; return true;", SingleProc) print ExecuteSilent("param o: Object -> boolean; var text: string := o.Tooltip; return true;", SingleProc1)
Using this you can run any code you want, but as soon as it crashes it will return the default value, so in this case if setting the value a local variable to the value of the attribute you are checking for fails then false is returned, if not then the code finishes running and true is returned.
While if all you want to do is to get the value then you could change the following code:
print SingleProc.Name, " - ", SingleProc.Tooltip print SingleProc1.Name, " - ", SingleProc1.Tooltip
print SingleProc.Name, " - ", ExecuteSilent("param o: Object -> string; return o.Tooltip", SingleProc) print SingleProc1.Name, " - ", ExecuteSilent("param o: Object -> string; return o.Tooltip", SingleProc1)
which will do the same thing but if the Tooltip attribute does not exist then it will return the default value for the string data type.