Перейти из форума на сайт.

НовостиФайловые архивы
ПоискАктивные темыТоп лист
ПравилаКто в on-line?
Вход Забыли пароль? Первый раз на этом сайте? Регистрация
Компьютерный форум Ru.Board » Компьютеры » Программы » FAR Manager (часть 4)

Модерирует : gyra, Maz

Maz (23-11-2017 18:57): FAR Manager (часть 5)  Версия для печати • ПодписатьсяДобавить в закладки
На первую страницук этому сообщениюк последнему сообщению

   

john_doe



Member
Редактировать | Профиль | Сообщение | Цитировать | Сообщить модератору

Код:
--http://forum.farmanager.com/viewtopic.php?p=102669#p102669
 
local F = far.Flags
 
local function InsertMacro()
  local Items =
  {
  --[[01]]  {F.DI_DOUBLEBOX,3,1,69,18,0,0,0,0,"Macro settings"},
  --[[02]]  {F.DI_TEXT,5,2,0,2,0,0,0,0,"Description:"},
  --[[03]]  {F.DI_EDIT,5,3,67,3,0,"MacroDescription",0,F.DIF_HISTORY,""},
  --[[04]]  {F.DI_TEXT,-1,4,0,4,0,0,0,F.DIF_SEPARATOR,""},
  --[[05]]  {F.DI_CHECKBOX,5,5,0,5,0,0,0,0,"Allo&w screen output while executing macro"},
  --[[06]]  {F.DI_CHECKBOX,5,6,0,6,0,0,0,0,"Execute after FAR &start"},
  --[[07]]  {F.DI_CHECKBOX,5,7,0,7,0,0,0,0,"Do not send &keys to plugins"},
  --[[08]]  {F.DI_TEXT,-1,8,0,8,0,0,0,F.DIF_SEPARATOR,""},
  --[[09]]  {F.DI_CHECKBOX,5,9,0,9,0,0,0,0,"&ActivePanel"},
  --[[10]]  {F.DI_CHECKBOX,7,10,0,10,2,0,0,{DIF_3STATE=1,DIF_DISABLE=1},"P&luginPanel"},
  --[[11]]  {F.DI_CHECKBOX,7,11,0,11,2,0,0,{DIF_3STATE=1,DIF_DISABLE=1},"Execute for &folders"},
  --[[12]]  {F.DI_CHECKBOX,7,12,0,12,2,0,0,{DIF_3STATE=1,DIF_DISABLE=1},"Se&lection present"},
  --[[13]]  {F.DI_CHECKBOX,37,9,0,9,0,0,0,0,"&PassivePanel"},
  --[[14]]  {F.DI_CHECKBOX,39,10,0,10,2,0,0,{DIF_3STATE=1,DIF_DISABLE=1},"P&luginPanel"},
  --[[15]]  {F.DI_CHECKBOX,39,11,0,11,2,0,0,{DIF_3STATE=1,DIF_DISABLE=1},"Execute for &folders"},
  --[[16]]  {F.DI_CHECKBOX,39,12,0,12,2,0,0,{DIF_3STATE=1,DIF_DISABLE=1},"Se&lection present"},
  --[[17]]  {F.DI_TEXT,-1,13,0,13,0,0,0,F.DIF_SEPARATOR,""},
  --[[18]]  {F.DI_CHECKBOX,5,14,0,14,2,0,0,F.DIF_3STATE,"Empty &command line"},
  --[[19]]  {F.DI_CHECKBOX,5,15,0,15,2,0,0,F.DIF_3STATE,"Selection &block present"},
  --[[20]]  {F.DI_TEXT,-1,16,0,16,0,0,0,F.DIF_SEPARATOR,""},
  --[[21]]  {F.DI_BUTTON,0,17,0,17,0,0,0,{DIF_DEFAULTBUTTON=1,DIF_CENTERGROUP=1},"OK"},
  --[[21]]  {F.DI_BUTTON,0,17,0,17,0,0,0,F.DIF_CENTERGROUP,"Cancel"},
  }
 
  local function DlgProc (hDlg,Msg,Param1,Param2)
    if Msg == F.DN_BTNCLICK then
      if Param1==9 or Param1==13 then
        local enable = hDlg:send("DM_GETCHECK",Param1)
        hDlg:send("DM_ENABLE",Param1+1,enable)
        hDlg:send("DM_ENABLE",Param1+2,enable)
        hDlg:send("DM_ENABLE",Param1+3,enable)
      end
    end
  end
 
  local guid = win.Uuid("7feed31e-ce59-4f94-9dd9-7da619b4ef00")
  if far.Dialog (guid,-1,-1,73,20,nil,Items,nil,DlgProc) ~= 21 then return end
 
  local tFlags = {}
  if Items[5][6]==1 then tFlags[#tFlags+1]="EnableOutput" end
  if Items[6][6]==1 then tFlags[#tFlags+1]="RunAfterFARStart" end
  if Items[7][6]==1 then tFlags[#tFlags+1]="NoSendKeysToPlugins" end
 
  local tCondition = {}
  if Items[9][6]==1 then
    if     Items[10][6]==0 then tCondition[#tCondition+1]="not APanel.Plugin"
    elseif Items[10][6]==1 then tCondition[#tCondition+1]="APanel.Plugin"
    end            
    if     Items[11][6]==0 then tCondition[#tCondition+1]="not APanel.Folder"
    elseif Items[11][6]==1 then tCondition[#tCondition+1]="APanel.Folder"
    end            
    if     Items[12][6]==0 then tCondition[#tCondition+1]="not APanel.Selected"
    elseif Items[12][6]==1 then tCondition[#tCondition+1]="APanel.Selected"
    end
  end
 
  if Items[13][6]==1 then
    if     Items[14][6]==0 then tCondition[#tCondition+1]="not PPanel.Plugin"
    elseif Items[14][6]==1 then tCondition[#tCondition+1]="PPanel.Plugin"
    end            
    if     Items[15][6]==0 then tCondition[#tCondition+1]="not PPanel.Folder"
    elseif Items[15][6]==1 then tCondition[#tCondition+1]="PPanel.Folder"
    end            
    if     Items[16][6]==0 then tCondition[#tCondition+1]="not PPanel.Selected"
    elseif Items[16][6]==1 then tCondition[#tCondition+1]="PPanel.Selected"
    end
  end
 
  if     Items[18][6]==0 then tCondition[#tCondition+1]="not CmdLine.Empty"
  elseif Items[18][6]==1 then tCondition[#tCondition+1]="CmdLine.Empty"
  end
 
  if     Items[19][6]==0 then tCondition[#tCondition+1]="not Selected"
  elseif Items[19][6]==1 then tCondition[#tCondition+1]="Selected"
  end
 
  local tResult = {}
  tResult[#tResult+1] = ("Macro { description=%q;"):format(Items[3][10])
  --tResult[#tResult+1] = "  area=\"Common\"; key=\"F1\";"
  tResult[#tResult+1] = "  area=\"Editor\"; key=\"\";"
  if #tFlags>0 then
    tResult[#tResult+1] = ("  flags=%q;"):format(table.concat(tFlags," "))
  end
  --tResult[#tResult+1] = "  --priority=50;"
  --tResult[#tResult+1] = "  --filemask=\"\";"
  tResult[#tResult+1] = ("  id=%q;"):format(win.Uuid(win.Uuid()):upper())
  if #tCondition>0 then
    tResult[#tResult+1] = "  condition=function()"
    tResult[#tResult+1] = ("    return %s"):format(table.concat(tCondition," and "))
    tResult[#tResult+1] = "  end;"
  end
  tResult[#tResult+1] = "  action=function()"
  tResult[#tResult+1] = "  end;"
  --tResult[#tResult+1] = "  action=function() colorer() end;"
  tResult[#tResult+1] = "}"
  tResult[#tResult+1] = ""
 
  mf.print(table.concat(tResult,"\r\n"))
end
 
Macro { description="Insert macro template";
  area="Editor"; key="CtrlF11"; filemask="*.lua";
  id="871F58BD-D24F-4A93-AFC3-E012C4697E74";
  action=InsertMacro;
}
 

Всего записей: 205 | Зарегистр. 03-02-2006 | Отправлено: 02:31 01-08-2016
   

На первую страницук этому сообщениюк последнему сообщению

Компьютерный форум Ru.Board » Компьютеры » Программы » FAR Manager (часть 4)
Maz (23-11-2017 18:57): FAR Manager (часть 5)


Реклама на форуме Ru.Board.

Powered by Ikonboard "v2.1.7b" © 2000 Ikonboard.com
Modified by Ru.B0ard
© Ru.B0ard 2000-2024

BitCoin: 1NGG1chHtUvrtEqjeerQCKDMUi6S6CG4iC

Рейтинг.ru