Append Custom Tab to current Assembler Window
Posted: Wed Nov 02, 2022 4:51 pm
As the Description says, the code will add a Custom Tab to the current edited Assembler Script.
This is useful if you have your own library and dont want do remember every functionname and its parameters.
Just copy the code into a script and put the script under CEs Autorun Folder.
Maybe its usefull for someone.
This is useful if you have your own library and dont want do remember every functionname and its parameters.
Just copy the code into a script and put the script under CEs Autorun Folder.
Spoiler
Code: Select all
function bla(msg)
print(msg)
end
local fncNamesWithDescription = { -- the functions to call and their descriptions
{'bla','-- (msg)'},
}
local function createDynamicMenuItems(form) -- dynamically creates the new Assembly Tab
if form then
local GlobalFunctions = createMenuItem(form.Menu)
GlobalFunctions.Caption = 'GlobalFunctions'
form.Menu.Items.insert(form.Menu.Items.Count, GlobalFunctions)
for i=1,#fncNamesWithDescription do
FunctionsMenuItem = createMenuItem(GlobalFunctions)
FunctionsMenuItem.Caption = fncNamesWithDescription[i][1] .. ' ' .. fncNamesWithDescription[i][2]
FunctionsMenuItem.OnClick = function ()
writeToClipboard('\n' .. fncNamesWithDescription[i][1]..'() ' .. fncNamesWithDescription[i][2]) -- copy the selected content of the table line to the clipboard
local paste = form.findComponentByName('miPaste') -- paste the selected content to the currently edited script
if paste then
paste.doClick()
end
end
GlobalFunctions.Add(FunctionsMenuItem)
end
end
end
local function formCreateNotify(form)
if form.ClassName~="TfrmAutoInject" then return end
local timer=createTimer()
timer.Interval=100
timer.OnTimer = function (t)
if (form.Menu==nil) then return end
t.destroy()
timer.destroy()
createDynamicMenuItems(form)
end
end
registerFormAddNotification(formCreateNotify)