-- edit by kinn scite_Command { 'log selet |log_selet|Ctrl+8' } local log_path local default_path local tmpfile local tmpDir local files = {} local function get_log(fuc,f) print(f .. ':0:') scite.Open(f) editor:Colourise(0,-1) local s,e = editor:findtext(fuc,SCFIND_MATCHCASE,0) while s do local style = editor.StyleAt[e-1] if style == SCE_C_IDENTIFIER then s2,e2 = editor:findtext(';',SCFIND_MATCHCASE,e) local log_txt = editor:textrange(s,s2) print('---------------------------------------') local lineno = editor:LineFromPosition(s) lineno=lineno+1 print(lineno .. ":" .. log_txt) s,e = editor:findtext(fuc,SCFIND_MATCHCASE,e2) else s,e = editor:findtext(fuc,SCFIND_MATCHCASE,e) end end print('') print('') scite.MenuCommand(IDM_CLOSE) end local function sub_dir(dir) tmpDir = default_path..'\\log_dir' local cmd = 'dir /ad-h /b '..dir..' > '..tmpDir print(cmd) os.execute(cmd) f = io.open(tmpDir) if not f then return end local subdirs = {} for line in f:lines() do table.insert(subdirs,dir..line..'\\') end f:close() for i,subdir in pairs(subdirs) do sub_dir(subdir) print(subdir..'---------------') end --cpp cmd = 'dir /aa /b '..dir..'*.cpp'..' > '..tmpfile print(cmd) os.execute(cmd) f = io.open(tmpfile) if not f then return end for line in f:lines() do table.insert(files,dir..line) end f:close() end function log_selet() log_path='D:\\temp\\branch_apl_src\\src\\' default_path = props['SciteDefaultHome'] tmpfile = default_path..'\\log_select' --[[ agwMngLogDebug agwMngLogInfo agwMngLogWarn agwMngLogError agwMngLogSys agwMngOpeSysLogInfo agwMngOpeSysLogWarn agwMngOpeSysLogError --]] local log_fuc= { "agwMngOpeSysLogError", "agwMngOpeSysLogWarn", "agwMngOpeSysLogInfo", "agwMngLogDebug", "agwMngLogInfo", "agwMngLogWarn", "agwMngLogError" } files = {} sub_dir(log_path) print('==========================') for i,fuc in pairs(log_fuc) do for j,file in pairs(files) do --get_log(fuc,file) print(file) end print('************************') end --[[ local s,e = editor:findtext('tun0 Link encap:Ethernet HWaddr ',SCFIND_MATCHCASE,0) while s do local arp = editor:textrange(e,e+17) s,e = editor:findtext('inet addr:\\d+\\.\\d+\\.\\d+\\.\\d+',SCFIND_REGEXP,e) local ip = editor:textrange(s+10,e) local str="arp -s "..ip.." "..arp print(str) s,e = editor:findtext('tun0 Link encap:Ethernet HWaddr ',SCFIND_MATCHCASE,e) end --]] end