XAccessor
XAccessor is an AppleScript library to make it possible to :
- get/set a value from a record by specifying the label name with text.
- get/set a value of a property from a script object by specifying the property name with text.
- get/set a value of a global variable by specifying the name with text.
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"
History
- 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