-- Extend Panel (Shift)?F[56] Dialog -- v1.1 -- FAR3 build >= 5467 local TGuid={ [win.Uuid("FCEF11C4-5490-451D-8B4A-62FA03F52759")]="F5", [win.Uuid("431A2F37-AC01-4ECD-BB6F-8CDE584E5A03")]="F6", [win.Uuid("502D00DF-EE31-41CF-9028-442D2E352990")]="SF5", [win.Uuid("89664EF4-BB8C-4932-A8C0-59CAFD937ABA")]="SF6" } local btnOK=17 -- dialog execution button local re=regex.new("^(Copy|Clone|Rename or move|Rename|Move)") local F=far.Flags local key local Proc=function(hDlg,txt) local Slash=txt:find("[\\/]") local Act="" if key.F5 then Act=(Slash or panel.GetPanelInfo(nil,1).SelectedItemsNumber>1) and "Copy" or "Clone" elseif key.F6 then Act=(Slash or panel.GetPanelInfo(nil,1).SelectedItemsNumber>1) and "Move" or "Rename" elseif key.SF5 then Act=Slash and "Copy" or "Clone" elseif key.SF6 then Act=Slash and "Move" or "Rename" end hDlg:send(F.DM_SETTEXT,1,(key.F5 or key.F6) and Act or "[Shift] "..Act) txt=hDlg:send(F.DM_GETTEXT,2) hDlg:send(F.DM_SETTEXT,2,re:gsub(txt,Act)) hDlg:send(F.DM_SETTEXT,btnOK,(key.F5 or key.SF5) and "&"..Act or Act:gsub(".$","&%0")) return Slash end Event { group="DialogEvent"; description="Extend Panel (Shift)?F[56] Dialog"; action=function(Event,Param) if Event==F.DE_DLGPROCINIT then local id=Param.hDlg:send(F.DM_GETDIALOGINFO) id=id and id.Id or "" local ret=TGuid[id] if ret then key={F5=false,F6=false,SF5=false,SF6=false} key[ret]=true local APC,PPP = APanel.Current,PPanel.Path if Param.Msg==F.DN_INITDIALOG then Param.hDlg:send(F.DM_SETTEXT,3,Proc(Param.hDlg,PPP) and PPP or APC) elseif Param.Msg==F.DN_EDITCHANGE and Param.Param1==3 then Proc(Param.hDlg,Param.hDlg:send(F.DM_GETTEXT,3)) elseif Param.Msg==F.DN_CLOSE and Param.Param1==btnOK and Param.hDlg:send(F.DM_GETTEXT,3)=="" then far.Message("Path or FileName don't specified","Warning!",nil,"w") Param.hDlg:send(F.DM_SETFOCUS,3) return 0 end end end return false end } |