AppleScript名:NSDictionaryのObjectEnumlator, KeyEnumlatorで値列挙 |
— Created 2017-07-30 by Takaaki Naganoya — 2017 Piyomaru Software use AppleScript version "2.4" use scripting additions use framework "Foundation" set aRec to {aaa:1, bbb:2, ccc:3} set aDict to current application’s NSMutableDictionary’s dictionaryWithDictionary:aRec set dEnum to aDict’s objectEnumerator() repeat set aVal to dEnum’s nextObject() if aVal = missing value then exit repeat log aVal (* 15:40:47.098 (* (NSNumber) 1 *) 15:40:47.099 (* (NSNumber) 2 *) 15:40:47.099 (* (NSNumber) 3 *) *) end repeat set kEnum to aDict’s keyEnumerator() repeat set aVal to kEnum’s nextObject() if aVal = missing value then exit repeat log aVal (* 15:50:52.276 (* (NSString) "aaa" *) 15:50:52.276 (* (NSString) "bbb" *) 15:50:52.276 (* (NSString) "ccc" *) *) end repeat |
More from my site
(Visited 18 times, 1 visits today)