local savedialog = createSaveDialog() savedialog.Title = 'Save Symbols' savedialog.DefaultExt = '.txt' savedialog.Filter = 'textfiles (*.txt)|*.txt' savedialog.Options = '[ofOverwritePrompt, ofHideReadOnly, ofEnableSizing]' function exportMainSymbols() local sd_result = savedialog.Execute() if not sd_result then return end local filename = savedialog.FileName if not filename or filename == '' then return end local t = {} for k,v in pairs(getMainSymbolList().getSymbolList()) do t[#t+1] = { address = v, name = k } end table.sort(t, function(lhs, rhs) return lhs.address < rhs.address end) local sl = createStringList() for _,sym in ipairs(t) do sl.add(('%08X: %s'):format(sym.address, sym.name)) end local saveResult = sl.saveToFile(filename) sl.destroy() if not saveResult then showMessage('Could not save to file '..filename) end end local ExtractSymbolsName = 'miExtractSymbols' local ExtractSymbolsCaption = '&Extract Symbols' if not getMainForm().ComponentByName['Edit3'].Visible then getMainForm().ComponentByName['Edit3'].Visible = true end local miExtractSymbols = getMainForm().ComponentByName['Edit3'] or getMainForm().Menu.Items local function addMenuItem(MenuItem, caption, onClick) local newItem = createMenuItem(MenuItem) MenuItem.add(newItem) newItem.Caption = caption newItem.OnClick = onClick return newItem end addMenuItem(miExtractSymbols,translate('Extract Symbols'), function () createThread(function (thread) local Stats,err = pcall(exportMainSymbols,'f') if Stats then shellExecute(err) else print(showAutoMessage(err[1]:gsub('\r','')..'')) if not(err[2]=='' or err[2]==nil) then shellExecute(err[2]) end end thread.terminate() end) end)