Skip to content

Instantly share code, notes, and snippets.

@rok-git
Created February 21, 2018 07:26
Show Gist options
  • Save rok-git/2a82c0fd7ab1c42201b187369ba1dc31 to your computer and use it in GitHub Desktop.
Save rok-git/2a82c0fd7ab1c42201b187369ba1dc31 to your computer and use it in GitHub Desktop.
AppleScript の Record から、キーや値を個別に取り出す。
-- use AppleScript version "2.4"
-- use scripting additions
use framework "Foundation"
set aRec to {q:"hogbehoge", n:999} -- AppleScript's Record
-- create an instance of NSMutableDictionary
set aDic to current application's (NSMutableDictionary's dictionaryWithDictionary:aRec)
-- use NSMutableDictionary's methods
set aKeyList to (aDic's allKeys()) as list
set aValList to (aDic's allValues()) as list
set aVal to (aDic's valueForKey:"q") as string
set aVal to (aDic's valueForKey:"n") as integer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment