im using macros in this kind (it's SciTE4AutoIt, working with event class looks a little different). Here I'm using "Ctrl+Numpad1..6" to activate the macros:
Macro = EventClass:new(Common)
-------------------------------------------------------------------------
TimeOS = function() local datetable = os.date("*t", os.time())
return string.format('%02d:%02d:%02d', datetable.hour, datetable.min, datetable.sec)
end
-------------------------------------------------------------------------
-------------------------------------------------------------------------
GetProp = function(_prop)
return props[_prop]
end
-------------------------------------------------------------------------
-------------------------------------------------------------------------
LoremIpsum = function()
return
[[Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut
labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores
et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem
ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore
et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea
rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.]]
end
-------------------------------------------------------------------------
-------------------------------------------------------------------------
local scitemacro = function(_value)
local tMacro = {
[97] = GetProp('FilePath'), -- NUMPAD-1 full path of the current file
[98] = GetProp('FileDir'), -- NUMPAD-2 directory of the current file without a trailing slash
[99] = GetProp('FileName'), -- NUMPAD-3 base name of the current file
[100] = GetProp('FileExt'), -- NUMPAD-4 extension of the current file
[101] = TimeOS(), -- NUMPAD-5 current time
[102] = LoremIpsum() -- NUMPAD-6 predefined text block
}
return tMacro[_value]
end
-------------------------------------------------------------------------
function Macro:OnKey(_keycode, _shift, _ctrl, _alt)
-- print('_keycode: '..tostring(_keycode)..', _shift: '..tostring(_shift)..', _ctrl: '..tostring(_ctrl)..', _alt: '..tostring(_alt)) -- DebugToConsole
-- our macro keys: "ctrl+NUMPAD-1 to NUMPAD-6"
local textMacro = scitemacro(_keycode)
if textMacro ~= nil and _ctrl and not _shift and not _alt then
editor:InsertText(editor.CurrentPos, textMacro)
return true -- avoids default processing
end
end