В F5/F6 вводим "плохое" имя файла (уже есть, запрещенные символы и т д). Хотелось бы среди всех возможных вариантов действий иметь и возможность вернуться назад к вводу имени файла и отредактировать его.
local hDlg, CurPosId, CurrentPosition
local rename=""
local pos=1
Macro { area="Dialog"; key="Esc Enter NumEnter"; flags="EnableOutput"; description="Save data in Copy/Rename Dialog";
condition = function()
return Dlg.Id == far.Guids.MoveCurrentOnlyFileId or Dlg.Id == far.Guids.CopyFilesId
end;
action = function()
if Dlg.ItemType ~= 4 then Dlg.SetFocus(3) end
hDlg = far.AdvControl(F.ACTL_GETWINDOWINFO).Id
CurPosId = hDlg:send(F.DM_GETFOCUS)
local item = hDlg:send(F.DM_GETDLGITEM,CurPosId)
if item and item[1] == F.DI_EDIT then CurrentPosition = hDlg:send(F.DM_GETCURSORPOS,CurPosId) end
pos = CurrentPosition.X
rename = Dlg.GetValue()
if akey(1) == 'Esc' then Keys("Esc") end
if akey(1) == 'Enter' or akey(1) == 'NumEnter' then Keys("Enter") end
end;
}
Macro { area="Dialog"; key="ShiftF12"; description="Recovery data in Copy/Rename Dialog";
condition = function()
return Dlg.Id == far.Guids.MoveCurrentOnlyFileId or Dlg.Id == far.Guids.CopyFilesId
end;
action = function()
if Dlg.ItemType ~= 4 then Dlg.SetFocus(3) end
Keys('CtrlY')
mf.print(rename)
Keys('Home')
Keys(('Right '):rep(pos))
end;
}
Last edited by Zeroes on Mon 08 Sep, 2025 23:07, edited 5 times in total.