CtrlIns — копировать пароль в буфер обмена
F3 — показать пароль
F4 — редактировать пароль
Альтернативно можно использовать пункт в меню плагинов.
Его можно настроить на одно из трёх перечисленных действий, для этого необходимо в начале скрипта изменить значение переменной
F11Mode
.- --http://forum.farmanager.com/viewtopic.php?f=15&t=9684
- local F11Mode = "copy"--"copy"--"show"--"edit"
- local F,C = far.Flags,far.Colors
- local strCopy,strShow,strEdit,strInputTitle,strInputPrompt = "Copy pwd: ","Show pwd","Edit pwd","Edit password",""
- local copykey = "R?CtrlIns"
- local pwd,hDlg,CurPos
- local function getDI_PSWEDIT()
- hDlg = far.AdvControl(F.ACTL_GETWINDOWINFO).Id
- CurPos = hDlg:send(F.DM_GETFOCUS)
- local item = hDlg:send(F.DM_GETDLGITEM,CurPos)
- if item and item[1]==F.DI_PSWEDIT then
- pwd = hDlg:send(F.DM_GETTEXT,CurPos); return true
- end
- end
- local InputId = win.Uuid"589D1EEA-1C8D-4B85-80A8-A2377993A154"
- local delay = 300
- local actions = {
- copy=function() --------------------------------
- far.CopyToClipboard(pwd)
- end;
- show=function() --------------------------------
- local item = hDlg:send(F.DM_GETDLGITEM,CurPos)
- local X,Y = item[2],item[3]
- local r = hDlg:send(F.DM_GETDLGRECT)
- far.Text(r.Left+X,r.Top+Y,far.AdvControl(F.ACTL_GETCOLOR,C.COL_DIALOGEDIT),pwd)
- far.Text()
- local res = far.MacroExecute("return mf.waitkey()")
- if res then
- local key = res[1]
- if key:match(copykey) then
- far.CopyToClipboard(pwd)
- far.Text(r.Left+X,r.Top+Y,far.AdvControl(F.ACTL_GETCOLOR,C.COL_DIALOGEDITSELECTED),pwd)
- far.Text()
- win.Sleep(delay)
- else
- far.MacroPost(("if mf.eval('%s',2)==-1 then Keys'%s' end"):format(key,key))
- end
- end
- far.AdvControl(F.ACTL_REDRAWALL)
- end;
- edit=function() --------------------------------
- pwd = far.InputBox(InputId,strInputTitle,strInputPrompt,nil,pwd)
- if pwd then hDlg:send(F.DM_SETTEXT,CurPos,pwd) end
- end;
- }
- MenuItem { description="password: show/edit/copy";
- menu="Plugins"; area="Dialog";
- guid="61279036-42E9-4063-8C5A-714022F9BE3F";
- text=function()
- return getDI_PSWEDIT() and (F11Mode=="copy" and strCopy..pwd or F11Mode=="show" and strShow or strEdit)
- end;
- action=function()
- actions[F11Mode]()
- end;
- }
- Macro { description="password: copy";
- area="Dialog"; key="CtrlIns";
- uid="AF590D4C-C513-41A4-A8C9-0DC3F272CAB9";
- condition=getDI_PSWEDIT;
- action=actions.copy;
- }
- Macro { description="password: show";
- area="Dialog"; key="F3";
- uid="70501E5E-C0EE-41FD-8F96-9BC942F06586";
- condition=getDI_PSWEDIT;
- action=actions.show;
- }
- Macro { description="password: edit";
- area="Dialog"; key="F4";
- uid="B01D3DBD-E79E-40D8-93EA-3BDF25E089CF";
- condition=getDI_PSWEDIT;
- action=actions.edit;
- }
GeSHi © Codebox Plus Extension