At first I tried using classDescriptionForClass from the class “NSClassDescription” but it always returned nil.
The Apple docs said:
In macOS 10.6 and later, this method (and as a result classDescription methods of any object) will return nil when the sdef contains no element for the Cocoa class, but there is a element defined for a superclass.
This is incorrect, as object instances should never be required to be exactly a given class, any class should be allowed to be a subclass of the required class and receive the correct value.
This situation can have a serious impact on Cocoa Scripting, and there is no plan on changing this behavior.
Instead of using this method, you should use the classDescriptionForClass: method of NSScriptClassDescription instead.
So I tried using the NSScriptClassDescription class instead. The problem is no matter what class I give to the classDescriptionForClass method I always get exactly the same results. I tried a lot of things in foundation and all were the same. I tried passing the type by passing an object of the class I wanted info on, and I tried passing the class name as a string and still I got the same exact response.
I doesn’t make sense Apple would implement a method that always returns the same thing for everything so I figured I am doing something wrong, or the method doesn’t work.
set TheVar to current application's NSString's stringWithString:"Test" set TheAnswer to current application's NSScriptClassDescription's classDescriptionForClass:TheVar class of TheAnswer --> (Class) NSScriptClassDescription TheAnswer --> (* (NSScriptClassDescription) Class: class ('pcls'), superclass: item, hidden: no Implementation class: NSObject Name: "class", plural name: "classes", description: "A class" Attribute: className ('pnam'), type: text ('ctxt'), access: read-write, hidden: no Name: "name", description: "The title of the class." Default subcontainer: <none> Primitive type: <none> *)
Do you know if classDescriptionForClass works and if so do you know what I am doing wrong?