OK, Here’s an example about why I’d like to see the hierarchy for each item clearly spelled out.
I tried to run a script sample and found some problems with it. Just reporting which Framework, class etc. for the problem script, is more confusing that it should be.
Framework: Foundation (Root)
Class Name: NSObject
Item Type: Function
Class: className()
That should be all in one string somewhere in the layout I can cut and paste. (I could also be in the sample window itself).
Here’s the sample script:
set AppleScriptString to "Hello world"
set CocoaString to current application's NSString's stringWithString:AppleScriptString
class of AppleScriptString --> text
class of CocoaString --> __NSCFString
CocoaString's className() --> __NSCFString
__________________________________________________________________________
set TheValues to current application's NSArray's arrayWithArray:{"v1", "v2", "v3", "v4"} --> (NSArray) {"v1","v2","3","v4"}
set TheKeys to current application's NSArray's arrayWithArray:{"k1", "k2", "k3", "k4"} --> (NSArray) {"k1","k2","k3","k4"}
set TheDictionary2 to current application's NSDictionary's alloc()'s initWithObjects:TheValues forKeys:TheKeys
TheDictionary2's className() --> (NSString) "__NSDictionaryI"
(TheDictionary2's className()) as string --> "__NSDictionaryI"
class of TheDictionary2 --> (Class) __NSDictionaryI
__________________________________________________________________________
set TheNSString to (NSString's stringWithString:"12345678")
TheNSString's |description| --> (NSString) "12345678"
TheNSString's className() --> (NSString) "__NSCFString"
So the first problem is there are no “Use” statements.
Next, it won’t run because the separator you’re using is treated like a variable.
This is a case where I’d suggest using handlers to make it work.
Finally the script itself seems buggy. The last segment doesn’t run at all. I think the variable name is wrong and it’s missing a “current application”.
Here’s a version I edited that runs, and I think is a little more clear and easier to understand.
use framework "foundation"
set AppleScriptString to "Hello world"
set firstList to {"v1", "v2", "v3", "v4"}
set secondList to {"k1", "k2", "k3", "k4"}
set AppleScriptText to "12345678"
ReturnTextClass(AppleScriptString)
ReturnArrayClass(firstList, secondList)
ReturnStringDescClass(AppleScriptText)
on ReturnTextClass(AppleScriptString)
set CocoaString to current application's NSString's stringWithString:AppleScriptString
set ASTextClass to class of AppleScriptString --> text
set cocoaClass to class of CocoaString --> __NSCFString
set cocoaClassName to CocoaString's className() --> __NSCFString
return {ASTextClass, cocoaClass, cocoaClassName}
end ReturnTextClass
on ReturnArrayClass(firstList, secondList)
set TheValues to current application's NSArray's arrayWithArray:firstList --> (NSArray)
set TheKeys to current application's NSArray's arrayWithArray:secondList --> (NSArray)
set TheDictionary2 to current application's NSDictionary's alloc()'s initWithObjects:TheValues forKeys:TheKeys
set dictClassName to TheDictionary2's className() --> (NSString) "__NSDictionaryI"
set dictClassNameText to (TheDictionary2's className()) as string --> "__NSDictionaryI"
set dictClass to class of TheDictionary2 --> (Class) __NSDictionaryI
return {dictClassName, dictClassNameText, dictClass}
end ReturnArrayClass
on ReturnStringDescClass(AppleScriptText)
set the NSString to (current application's NSString's stringWithString:AppleScriptText)
set NSStringDesc to the NSString's |description| --> (NSString) "12345678"
set nsStringClassName to the NSString's className() --> (NSString) "__NSCFString"
return {NSStringDesc, nsStringClassName}
end ReturnStringDescClass