local function process(f) local res,efbbbf,fffe,feff = 0,'\239\187\191','\255\254','\254\255' local h=io.open(f,"rb") if h then local s=h:read(3) or '' h:close() if s==efbbbf then res=3 else s=string.sub(s,1,2) if s==fffe then res=2 elseif s==feff then res=1 end end end return res end Macro { description="BOM Files select"; name="BOM"; area="Shell"; key=""; action=function() local Items=panel.GetPanelInfo(nil,1).ItemsNumber for Item=1,Items do local GPItem=panel.GetPanelItem(nil,1,Item) if GPItem.FileAttributes:find("d") or process(GPItem.FileName)==0 then panel.SetSelection(nil,1,Item,false) else panel.SetSelection(nil,1,Item,true) end end panel.RedrawPanel(nil,1) end } |