This script attempts to open Tinderbox’s Inspector to the provided tab title.
Tinderbox’s Inspector got 31 subtabs. That probably just shows how powerful Tinderbox is. However, most of the time I only need a subset of the tabs. Clicking around in the Inspector often distracts me, especially when I’m trying to make something new work.
Alfred workflow
I’m currently using the script in a Alfred workflow that got
- a search for all Inspector tabs
- shortcuts for a subset of the tabs
Tinderbox - Open Inspector Tab.alfredworkflow.zip (63.8 KB)
Not sure whether I’ll stick to these shortcuts, it’s all new.
You can of course use any app that’s capable of running AppleScript with text input.
Hard coded version
If you’d like to use a hard coded version then use this
Script (hard coded)
-- Tinderbox - Open Inspector Tab (hard coded)
-- Note: Tinderbox's "Inspector" menu item got a different index across macOS versions. E.g. it's 16 on Catalina and 19 on Monterey. Those are already handled, but I didn't test other versions.
property theSubTab_Title : "Edict" -- Set the desired tab's title
property theSubTabsRecords_list : {¬
{Subtab_Title:"Info", Subtab_Index:1, Tab_Title:"Tinderbox Inspector", Tab_Index:1}, ¬
{Subtab_Title:"Agents & Rules", Subtab_Index:2, Tab_Title:"Tinderbox Inspector", Tab_Index:1}, ¬
{Subtab_Title:"System", Subtab_Index:1, Tab_Title:"Document Inspector", Tab_Index:2}, ¬
{Subtab_Title:"User", Subtab_Index:2, Tab_Title:"Document Inspector", Tab_Index:2}, ¬
{Subtab_Title:"Colors", Subtab_Index:3, Tab_Title:"Document Inspector", Tab_Index:2}, ¬
{Subtab_Title:"Links", Subtab_Index:4, Tab_Title:"Document Inspector", Tab_Index:2}, ¬
{Subtab_Title:"Stamps", Subtab_Index:5, Tab_Title:"Document Inspector", Tab_Index:2}, ¬
{Subtab_Title:"Prototype", Subtab_Index:1, Tab_Title:"Properties Inspector", Tab_Index:3}, ¬
{Subtab_Title:"Quickstamp", Subtab_Index:2, Tab_Title:"Properties Inspector", Tab_Index:3}, ¬
{Subtab_Title:"More", Subtab_Index:3, Tab_Title:"Properties Inspector", Tab_Index:3}, ¬
{Subtab_Title:"Interior", Subtab_Index:1, Tab_Title:"Appearance Inspector", Tab_Index:4}, ¬
{Subtab_Title:"Border", Subtab_Index:2, Tab_Title:"Appearance Inspector", Tab_Index:4}, ¬
{Subtab_Title:"Shadow", Subtab_Index:3, Tab_Title:"Appearance Inspector", Tab_Index:4}, ¬
{Subtab_Title:"Outline", Subtab_Index:4, Tab_Title:"Appearance Inspector", Tab_Index:4}, ¬
{Subtab_Title:"Plot", Subtab_Index:4, Tab_Title:"Appearance Inspector", Tab_Index:4}, ¬
{Subtab_Title:"Title", Subtab_Index:1, Tab_Title:"Text Inspector", Tab_Index:5}, ¬
{Subtab_Title:"Subtitle", Subtab_Index:2, Tab_Title:"Text Inspector", Tab_Index:5}, ¬
{Subtab_Title:"Caption", Subtab_Index:3, Tab_Title:"Text Inspector", Tab_Index:5}, ¬
{Subtab_Title:"Hover", Subtab_Index:4, Tab_Title:"Text Inspector", Tab_Index:5}, ¬
{Subtab_Title:"Text", Subtab_Index:5, Tab_Title:"Text Inspector", Tab_Index:5}, ¬
{Subtab_Title:"Export", Subtab_Index:1, Tab_Title:"Export Inspector", Tab_Index:6}, ¬
{Subtab_Title:"Markup", Subtab_Index:2, Tab_Title:"Export Inspector", Tab_Index:6}, ¬
{Subtab_Title:"Style", Subtab_Index:3, Tab_Title:"Export Inspector", Tab_Index:6}, ¬
{Subtab_Title:"List", Subtab_Index:4, Tab_Title:"Export Inspector", Tab_Index:6}, ¬
{Subtab_Title:"Macro", Subtab_Index:5, Tab_Title:"Export Inspector", Tab_Index:6}, ¬
{Subtab_Title:"Query", Subtab_Index:1, Tab_Title:"Action Inspector", Tab_Index:7}, ¬
{Subtab_Title:"Action", Subtab_Index:2, Tab_Title:"Action Inspector", Tab_Index:7}, ¬
{Subtab_Title:"Rule", Subtab_Index:3, Tab_Title:"Action Inspector", Tab_Index:7}, ¬
{Subtab_Title:"Remove", Subtab_Index:4, Tab_Title:"Action Inspector", Tab_Index:7}, ¬
{Subtab_Title:"Edict", Subtab_Index:5, Tab_Title:"Action Inspector", Tab_Index:7}, ¬
{Subtab_Title:"Sort", Subtab_Index:6, Tab_Title:"Action Inspector", Tab_Index:7} ¬
}
----------------------------------------------------------------- Get record ------------------------------------------------------------------
set theSubTab_record to missing value
repeat with thisSubTab_record in theSubTabsRecords_list
if (Subtab_Title of thisSubTab_record) = theSubTab_Title then
set theSubTab_record to thisSubTab_record
set theTab_Title to Tab_Title of theSubTab_record
set theTab_Index to Tab_Index of theSubTab_record
set theSubTab_Index to Subtab_Index of theSubTab_record
exit repeat
end if
end repeat
if theSubTab_record = missing value then
error "Couldn't find subtab in records"
end if
-------------------------------------------------------------------------------------------------------------------------------------------------
tell application "System Events"
try
tell process "Tinderbox"
---------------------------------------------------------------- Get Inspector -----------------------------------------------------------------
set theWindow to my getWindow()
-------------------------------------------------------- If necessary open Inspector ---------------------------------------------------------
if theWindow = missing value then
tell application id "Cere" to activate
repeat with thisMenuIndex in {16, 19} -- 16 auf MBP (Catalina), 19 auf Mac Studio (Monterey)
click menu bar 1's menu bar item 9
click menu bar 1's menu bar item 9's menu 1's menu item thisMenuIndex
set theWindow to my getWindow()
if theWindow ≠ missing value then
exit repeat
end if
end repeat
end if
if theWindow = missing value then
error "Couldn't find Inspector window"
end if
---------------------------------------------------- If necessary change Inspector tab -----------------------------------------------------
if name of theWindow does not start with theTab_Title then
click radio button theTab_Index of radio group 1 of theWindow
set theWindow to (first window whose value of attribute "AXRoleDescription" = "floating window")
end if
--------------------------------------------------------------- Change subtab ----------------------------------------------------------------
click radio button theSubTab_Index of tab group 1 of theWindow
end tell
on error error_message number error_number
if the error_number is not -128 then display alert "System Events" message error_message as warning
return
end try
end tell
on getWindow()
try
tell application "System Events"
tell process "Tinderbox"
set theWindows to (windows whose value of attribute "AXRoleDescription" = "floating window")
if theWindows ≠ {} then
set theWindow to item 1 of theWindows
else
set theWindow to missing value
end if
return theWindow
end tell
end tell
on error error_message number error_number
activate
if the error_number is not -128 then display alert "Error: Handler \"getWindow\"" message error_message as warning
error number -128
end try
end getWindow
Note
- As the script uses UI scripting it might not work on your macOS version out of the box. E.g. on my main mac (Monterey) the menu item’s index is 19 but on the old mac (Catalina) it’s 16. Please let me know if it doesn’t work.