Automation, of macOS, More Broader

s https://jandp.biz/is/apps/macos/automator/

Apple

Automator.app (app)

Script Editor.app (app)

Services, Quick Actions, Shortcuts

Workflows

Folder Actions (Folder Actions Setup.app)

Hammerspoon

 

Lua programming language

 

caffeine = hs.menubar.new()
function setCaffeineDisplay(state)
if state then
caffeine:setTitle(“AWAKE”)
else
caffeine:setTitle(“SLEEPY”)
end
end

function caffeineClicked()
setCaffeineDisplay(hs.caffeinate.toggle(“displayIdle”))
end

if caffeine then
caffeine:setClickCallback(caffeineClicked)
setCaffeineDisplay(hs.caffeinate.get(“displayIdle”))
end

— ####
— Example paths to your documents
local documentPaths = {
“‘/Users/johan/Dropbox/J&P/Boats! Boating!/Larson! Cabrio 260 2008/Logbook/0-Logbook-LarsonCabrio260.xlsx'”,
“/Users/johan/Dropbox/”,
“/Users/your_username/Documents/Document2.txt”,
“/Users/your_username/Documents/Document3.txt”,
— Add more documents if needed
}

— Function to open the selected document
local function openDocument(path)
hs.alert.show(“Hello World!” .. path)

hs.execute(“open ” .. path)
end

— Create the menubar item with a dropdown menu
local menu = hs.menubar.new()
local menuData = {}

for i, path in ipairs(documentPaths) do
local menuItem = {
title = “Document ” .. i,
fn = function() openDocument(path) end
— fn = function() hs.alert.show(“Hello World!”) end
}
table.insert(menuData, menuItem)
end