A draft AppleScript to:
- collapse the whole Bike outline one level more, or
- expand the whole Bike outliner one level more.
To get a pair of scripts, make an extra copy of the AppleScript below, and change the value of the collapsing
property, near the top of the script, from true
to false
.
Expand disclosure triangle to view AppleScript source
-------- BIKE :: COLLAPSE OR EXPAND ONE MORE LEVEL -------
-- Rob Trew @2022
-- Ver 0.04
-- OPTION - collapse or expand
-- to EXPAND more, set the value of `collapsing` to false
-- to COLLAPSE more, set the value of `collapsing` to true
property collapsing : true
------------ EXPAND OR COLLAPSE ONE LEVEL MORE -----------
on run
tell application "Bike"
set doc to front document
if exists doc then
tell doc
set nextLevel to my collapseLimit(collapsing, ¬
level of rows where ¬
contains rows is true ¬
and expanded is collapsing)
if missing value is not nextLevel then
collapse (rows where level > nextLevel)
if not collapsing then ¬
expand (rows where level is nextLevel)
nextLevel
else
-- CYCLE ?
-- set collapsing to not collapsing
if collapsing then
"Fully collapsed"
else
"Fully expanded"
end if
end if
end tell
else
"No documents open in Bike."
end if
end tell
end run
-- collapseLimit :: Bool -> [Int] -> Int
on collapseLimit(isMax, xs)
if {} ≠ xs then
set limit to item 1 of xs
if isMax then
repeat with x in rest of xs
if x > limit then set limit to x
end repeat
else
repeat with x in rest of xs
if x < limit then set limit to x
end repeat
end if
contents of limit
else
missing value
end if
end collapseLimit
See: Using Scripts - Bike
For Keyboard Maestro versions:
BIKE Outliner – Expand or Collapse one level more - Macro Library - Keyboard Maestro Discourse