-- edit by kinn scite_Command { 'maintain tools |ShowMaintain|Ctrl+F8' } --print('test========='..lua_LoadPath()) local my_path=lua_LoadPath() local len = string.len local dis_cmd_content={} local begcpyPos, endcpyPos, cmdStartcpyPos, cmdendcpyPos local function winrar_path() local cmd='reg query "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\WinRAR.exe" /v Path | find "Path"' local f=exe_command(cmd) local winrar_dir_tmp=f:read("*all") local winrar_dir=string.gsub(winrar_dir_tmp, '^.*%s+REG_SZ%s+(%S.+%S)%s*$', "%1") f:close() return winrar_dir end local cmd_name={} local cmd_count=0 local cmd_position={} local cmd_action={} local function updateCpyContent() if begcpyPos and endcpyPos then outputRemove(output,begcpyPos, endcpyPos) end begcpyPos = output.Length print() print('=====================================') cmdStartcpyPos=output.CurrentPos cmd_position[0]=output.CurrentPos local indx=1 while cmd_name[indx] do print(cmd_name[indx]) cmd_position[indx]=output.CurrentPos indx=indx+1 end cmd_count=indx cmdendcpyPos=output.CurrentPos print('-------------------------------') for k, t in pairs(dis_cmd_content) do if t then print(t) end end print('-------------------------------') endcpyPos = output.CurrentPos end local function init_command_tabl() cmd_name[1]=' ' cmd_name[2]=' ' cmd_name[3]=' ' -- cmd_action[1]={} cmd_action[1][1]='xcopy '..extman_Path():gsub('/','\\') ..'\\*.lua '..props['SciteDefaultHome']..'\\..\\scite1\\script\\ /s/e/y' cmd_action[1][2]='xcopy '..extman_Path():gsub('/','\\').. '\\*.lua '..props['SciteDefaultHome']..'\\..\\scite2\\script\\ /s/e/y' cmd_action[1][3]='copy '..extman_Path():gsub('/','\\') ..'\\spawner-ex.dll '..props['SciteDefaultHome']..'\\..\\scite1\\script\\ /y' cmd_action[1][4]='copy '..extman_Path():gsub('/','\\').. '\\spawner-ex.dll '..props['SciteDefaultHome']..'\\..\\scite2\\script\\ /y' cmd_action[1][5]='xcopy '..extman_Path():gsub('/','\\') ..'\\*.exe '..props['SciteDefaultHome']..'\\..\\scite1\\script\\ /s/e/y' cmd_action[1][6]='xcopy '..extman_Path():gsub('/','\\').. '\\*.exe '..props['SciteDefaultHome']..'\\..\\scite2\\script\\ /s/e/y' -- directoryToCreate='D:\\work\\tools\\Give\\scite' cmd_action[2]={} cmd_action[2][1]='xcopy '..extman_Path():gsub('/','\\') ..'\\*.* '..directoryToCreate..'\\script /s/e/y'..' && copy '..props['SciteDefaultHome'] ..'\\SciTE.exe '..directoryToCreate..' /y'..' && copy '..props['SciteDefaultHome'] ..'\\SciTEGlobal.properties '..directoryToCreate..' /y'..' && del '..directoryToCreate..'\\script\\tags /F/S/Q'..' && del '..directoryToCreate..'\\script\\scite_lua\\*.cnf /Q'..' && del '..directoryToCreate..'\\script\\scite_lua\\maintain\\*.cnf /Q'..' && set Path='..winrar_path()..';%Path% && cd /D '..parent_of(directoryToCreate)..' && winrar a scite.zip -m5 scite ' --cmd_action[2][2]= -- cmd_action[3]={} cmd_action[3][1]=updateCpyContent end scite_OnInit(function(order1,order2) if order1==0 and order2 ==0 then local f = io.open(my_path.."/maintain_tool.cnf", "r") if not f then return false end for line in f:lines() do local field,Value=line:match('^([^=]+)=(.*)$') if field == 'begcpyPos' then begcpyPos=tonumber(Value) elseif field == 'endcpyPos' then endcpyPos=tonumber(Value) elseif field == 'cmdStartcpyPos' then cmdStartcpyPos=tonumber(Value) elseif field == 'cmdendcpyPos' then cmdendcpyPos=tonumber(Value) else local indx=tonumber(field) if indx and indx >0 then cmd_position[indx]=tonumber(Value) end end end f:close() end init_command_tabl() return false end) scite_OnFinalise(function() local f = io.open(my_path.."/maintain_tool.cnf", "w") if not f then return false end if begcpyPos then f:write('begcpyPos='..begcpyPos..'\n') f:write('endcpyPos='..endcpyPos..'\n') f:write('cmdStartcpyPos='..cmdStartcpyPos..'\n') f:write('cmdendcpyPos='..cmdendcpyPos..'\n') local indx=1 while indx cmdStartcpyPos and output.CurrentPos < cmdendcpyPos then local indx=1 while indxoutput.CurrentPos and cmd_action[indx] then exe_command(cmd_action[indx],dis_cmd_content) break end indx=indx+1 end updateCpyContent() end return true end)