次の関数はリストを返します-{1,2,3}
リストの各項目を異なる値とキーでレコードに入力したいと思います。
これを行う簡単な方法はありますか?
on somefunc()
return {1, 2, 3}
end somefunc
set {a, b, c} to somefunc()
set my_record to {a:a, b:b, c:c}
これは私が基本的に欲しいものです:
{a:1, b:2, c:3}
次の関数はリストを返します-{1,2,3}
リストの各項目を異なる値とキーでレコードに入力したいと思います。
これを行う簡単な方法はありますか?
on somefunc()
return {1, 2, 3}
end somefunc
set {a, b, c} to somefunc()
set my_record to {a:a, b:b, c:c}
これは私が基本的に欲しいものです:
{a:1, b:2, c:3}
レコードを扱うときは、ASObjCRunnerを使用するのが好きです
レコードスイートの例を次に示します。
tell application "ASObjC Runner" to link values {1, 2, 3} with labels {"a", "b", "c"}
編集
スクリプトの実行メソッドを使用することもできます。
set myRecord to {}
set listA to {"a", "b", "c"}
set listB to {1, 2, 3}
repeat with i from 1 to count of listA
set myRecord to myRecord & (run script "return {" & item i of listA & ":" & item i of listB & "}")
end repeat