XAccessor
文字列で record のラベルや scirpt object の property /グローバル変数を指定して、値を取得/設定すること AppleScript モジュールです。
AppleScript の言語レベルではサポートされていない柔軟性を提供します。
use XAccessor : script "XAccessor"
set a_record to {a:"aa"}
script AScript
property a : "aa"
global b
on get_b()
return b
end get_b
end script
(*== Using Class Methods ==*)
(* access to property *)
log XAccessor's value_of(AScript, "a") -- "aa"
XAccessor's set_value(AScript, "a", "hello")
(* access to global variable *)
XAccessor's set_global("b", "hey")
log XAccessor's global_value("b") -- "hey"
(*== Using XAccessor Instance ==*)
(* access to property *)
set a_accessor to XAccessor's make_with("a")
log a_accessor's value_of(AScript) -- "hello"
log a_accessor's value_of(a_record) -- "aa"
(* access to global variable *)
set b_accessor to XAccessor's make_with("b")
log b_accessor's global_value() -- "hey"
更新履歴
- 1.2.1 -- 2020-02-12
- Updated help.
- 1.2 -- 2020-02-05
- OpenHelpBook.scptd is used to display help book instead of HelpBook.osax.
- OS X 10.9 or later is required.
- 1.1.1 -- 2010-10-22
- Removed a dependency on ShowHelpBook.
- 1.1 -- 2007.08.22
- Split DynamicAccess into two moules of XAccessor and XHandler
- 1.0 -- 2007.06.06
- First Release