cp.app.menu.NIB_FILE -> string
cp.app.menu.ROLE -> string
cp.app.menu.STORYBOARD_NAME -> string
cp.app.menu(app) -> menu
cp.app
instance the menu belongs to.cp.app.menu.showing <cp.prop: boolean; read-only; live>
cp.app.menu.UI <cp.prop:hs._asm.axuielement; read-only; live>
axuielement
representing the menu.cp.app.menu:addMenuFinder(finder) -> nothing
AXMenuItem
finder function. The finder's job is to take an individual 'find'finder
- The finder functionAXMenuItem
found, or nil
.finder
should have the following signature:function(parentItem, path, childName, locale) -> childItem
AXMenuItem
containing the children. E.g. the Go To
menu under Window
.{"Window", "Go To"}
."Libraries"
.cp.i18n.localeID
that the menu titles are in.AXMenuItem
that was found, or nil
if not found.cp.app.menu:app() -> cp.app
cp.app
instance this belongs to.cp.app
.cp.app.menu:doFindMenuUI(path[, options]) -> cp.rx.go.Statement <hs._asm.axuielement>
Statement
that when executed will emit each of the menu items along the path.Statement
, ready to be executed.true
if it matches.options
may contain:false
.myApp:menu():doFindMenuUI({"Edit", "Copy"}):Now(function(item) print(item:title() .. " enabled: ", item:enabled()) end, error)
cp.app.menu:doSelectMenu(path, options) -> cp.rx.go.Statement <boolean>
Statement
, ready to execute.true
if it matches.options
may include:localeID
or string
for the locale that the path values are in.true
, all menu items will be pressed on the way to the final destination.false
.previewApp:menu():doSelectMenu({"File", "Take Screenshot", "From Entire Screen"}):Now()
cp.app.menu:findMenuUI(path[, options]) -> Menu UI, table
nil
if it could not be found.true
if it matches.options
can contain:localeID
or string
with the locale code. Defaults to "en".false
.cp.app.menu:getMenuTitles([locales]) -> table
localeID
or a list of localeID
s to ensure are loaded.cp.app.menu:isChecked(path[, options]) -> boolean
true
if checked otherwise false
.options
may include:localeID
or string
with the locale code. Defaults to "en".cp.app.menu:isEnabled(path[, options]) -> boolean
true
if enabled otherwise false
.options
may include:localeID
or string
with the locale code. Defaults to "en".cp.app.menu:selectMenu(path[, options]) -> boolean
true
if the press was successful.true
if it matches.options
may include:localeID
or string
for the locale that the path values are in.true
, all menu items will be pressed on the way to the final destination.false
.require("cp.app").forBundleID("com.apple.FinalCut"):menu():selectMenu({"View", "Browser", "Toggle Filmstrip/List View"})
cp.app.menu:visitMenuItems(visitFn[, options]]) -> nil
visitFn
on all the 'item' values - that is,options
may include:localeID
or string
with the locale code. Defaults to "en".visitFn
will be called on each menu item with the following parameters:function(path, menuItem)
menuItem
is the AXMenuItem object, and the path
is an array with the path to that menu item. For example, if it is the "Copy" item in the "Edit" menu, the path will be { "Edit" }
.