otakon otakon - 1 year ago 130
AppleScript Question

How to create NSRange object in AppleScriptObjC

I can't create NSRange object in ASOC. I've googled it but with no luck.

I have tried:

current application's NSMakeRange_({0, 1})

current application's NSMakeRange_({location:0, length:1})

current application's NSRange's NSMakeRange_({location:0,length:1})

please help

Answer Source

Too complicated:

set range1 to current application's NSMakeRange(0, 1)

And – since C structs can be represented by AppleScript lists or records – still easier:

set range2 to {location:0, |length|:1}

AppleScriptObjC recognizes the "literal" creation as NSRange

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download