How do I access the first ( and other indices ) item in an NSArray in AppleScript?
TIA
How do I access the first ( and other indices ) item in an NSArray in AppleScript?
TIA
The following demonstrates. They are coerced from an NSString to text with as text.
use framework "Foundation"
use scripting additions
set theArray to current application's NSArray's arrayWithArray:{"a", "b", "c"}
set itemOne to theArray's objectAtIndex:0 --> (NSString) "a"
set itemOne to theArray's firstObject() --> (NSString) "a"
set itemTwo to theArray's objectAtIndex:1 --> (NSString) "b"
set itemThree to theArray's objectAtIndex:2 --> (NSString) "c"
set itemThree to theArray's lastObject() --> (NSString) "c"
Thank you both! Both of these are very helpful!