Я пытаюсь создать скрипт с использованием lua в hammpersppon. Там, где нажатие «x» даст пользователю возможность вставить тип шаблона, который он хочет вставить в текстовое поле в Интернете.
К сожалению, я не могу понять, как отформатировать этот текст в виде таблиц (со строками и столбцами)?
Я попытался вставить таблицу из таблицы Google (Excel) в код lua, но все равно она не отображается как таблица в текстовом поле.
-- Focus the last used window.
local function focusLastFocused()
local wf = hs.window.filter
local lastFocused = wf.defaultCurrentSpace:getWindows(wf.sortByFocusedLast)
if #lastFocused > 0 then lastFocused[1]:focus() end
end
-- On selection, copy the text and type it into the focused application.
local chooser = hs.chooser.new(function(choice)
if not choice then focusLastFocused(); return end
hs.pasteboard.setContents(choice["subText"])
focusLastFocused()
hs.eventtap.keyStrokes(hs.pasteboard.getContents())
end)
chooser:choices({
{
["text"] = "Option 1",
["subText"] = [[ Text 1 Text 2
Text 3 Text 4]]
},
{
["text"] = "Option 2",
["subText"] = [[ Text 1 Text 2
Text 3 Text 4]]
},
})
hs.hotkey.bind({"X"}, "X", function() chooser:show() end)