local Mask="/.+\\.(t(bz|bz2|gz|lz|rz|xz|z)|tar\\.(gz|bz2|lz|lzma|rz|xz|z))/i"; local Msk="/.+(tar)/i"; Macro{ area="Shell"; key="ShiftF2"; priority=60; description="Unpack tarball"; condition=function() return APanel.Selected or mf.fmatch(APanel.Current,Mask) == 1 end; action=function() Far.DisableHistory(-1); local ArcID,m1,nm,var,tm = "65642111-AA69-4B84-B4B8-9249579EC4FA","/.+\\.(tbz|tbz2|tgz|tlz|trz|txz|tz)/i","","",""; local function fnm(fn) if mf.fmatch(fn,m1)==1 then nm = mf.fsplit(fn,4)..".tar" else nm = mf.fsplit(fn,4) end return nm end if APanel.Selected then local ic,lst = Panel.SetPosIdx(0,0),"" for i=1,APanel.SelCount do Panel.SetPosIdx(0,i,1) if not APanel.Folder then if mf.fmatch(APanel.Current,Mask) == 1 then if var == "" then var = Panel.Item(0,APanel.Current,0) else var =var.." "..Panel.Item(0,APanel.Current,0) end if tm == "" then tm = win.GetEnv("TEMP").."\\"..fnm(APanel.Current) else tm = tm.." "..win.GetEnv("TEMP").."\\"..fnm(APanel.Current) end else if lst == "" then lst = ""..Panel.Item(0,APanel.Current,0).."" else lst = lst..""..Panel.Item(0,APanel.Current,0).."".."\\n" end end else i = i + 1 end end Panel.SetPosIdx(0,ic) if var ~= "" then Plugin.Command(ArcID,"x -ie:y -o:o -da:n -sd:n "..var.." "..win.GetEnv("TEMP")) Plugin.Command(ArcID,"x -ie:y -o:o -da:y -sd:y "..tm.." "..PPanel.Path) elseif mf.fmatch(APanel.Current,Mask)==1 then local cmda = "x -ie:y -o:o -sd:n " Plugin.Command(ArcID,cmda.."-da:n "..APanel.Current.." "..win.GetEnv("TEMP")) Plugin.Command(ArcID,cmda.."-da:y "..win.GetEnv("TEMP").."\\"..fnm(APanel.Current).." "..PPanel.Path) end if lst ~= "" then Panel.Select(0,1,2,lst) Keys("ShiftF2") end else Keys("ShiftF2") end end; } |