local fread = function(f) local h,x = io.open(f,"rb") if h then x=h:read("*all") io.close(h) end return x end local fwrite = function(s,f) s = s or "" local h,x = io.open(f,"wb") if h then x=h:write(s) io.close(h) end return x end Macro { area="Shell"; flags=""; description="! selected files HEX"; key="ваш шоркат для HEX"; action=function() if not APanel.Selected then Panel.Select(0,1,1,0) end while APanel.Selected do Panel.SetPosIdx(0,1,1) local fname=APanel.Path0.."\\"..APanel.Current local s=fread(fname) s=string.gsub(s,".",function(x) local function d2c(x) if x<10 then x=x+48 else x=x+55 end return string.char(x) end x=string.byte(x) return d2c(math.floor(x/16))..d2c(x%16) end) fwrite(s,fname..".hex") Panel.Select(0,0,1,0) end end; } Macro { area="Shell"; flags=""; description="! selected files unHEX"; key="ваш шоркат для unHEX"; action=function() if not APanel.Selected then Panel.Select(0,1,1,0) end while APanel.Selected do Panel.SetPosIdx(0,1,1) local fname=APanel.Path0.."\\"..APanel.Current local s=fread(fname) s=string.gsub(s,"%x%x",function(x) return string.char(tonumber(x,16)) end) fwrite(s,fname:gsub("%.hex$","")) Panel.Select(0,0,1,0) end end; } |