Macro {
key ="CtrlAltO";
area ="Common";
description ="Run antother FAR instance with the same panels";
flags ="NoSendKeysToPlugins";
action=function()
local FarName='"'..win.GetEnv("FARHOME").."\\far.exe"..'"'
--local ConemuName=win.GetEnv("FARHOME").."\\conemu.exe"
local FarLeft,FarRight
if APanel.Left then FarLeft='"'..APanel.Path0..'"' FarRight='"'..PPanel.Path0..'"' end --.Path0 is real path (if plugin)
if PPanel.Left then FarLeft='"'..PPanel.Path0..'"' FarRight='"'..APanel.Path0..'"' end
if not APanel.Left then win.SetEnv('FarPanel','R') end
if APanel.Left and APanel.Prefix=='arc' then FarLeft ='arc:"\\"'..APanel.HostFile..'\\""' end
if not APanel.Left and APanel.Prefix=='arc' then FarRight='arc:"\\"'..APanel.HostFile..'\\""' end
if PPanel.Left and PPanel.Prefix=='arc' then FarLeft ='arc:"\\"'..PPanel.HostFile..'\\""' end
if not PPanel.Left and PPanel.Prefix=='arc' then FarRight='arc:"\\"'..PPanel.HostFile..'\\""' end
local Text=FarName..' '..FarLeft..' '..FarRight
far.Message(Text) -- remove after test
--win.ShellExecute(nil,nil,ConemuName,'-run '..Text,nil,nil) -- Far with ConEmu
win.ShellExecute(nil,nil,FarName,FarLeft..' '..FarRight,nil,nil) -- Far without ConEmu
end;
}
Macro {
key ="auto";
area ="common";
description ="Set active panel left or right after macro CtrlAltO - antother FAR instance";
flags ="RunAfterFARStart";
action=function()
local FarPanel=win.GetEnv('FarPanel')
if FarPanel=='R' then panel.SetActivePanel(nil,0) end
win.SetEnv('FarPanel',nil)
end;
}
FAR ingores command line paremeters if left panel is C:\ (root). Try this:
- run FAR
- then change path in right panel (left panel is C:\)
- run macro (Ctrl+Alt+O) command line parameters are ignored
- then change left panel anyway but root (ie. C:\Users)
- run macro command line parameters are accepted
What is wrong? Macro or FAR itself? The same is when I call another FAR from command line + Enter instead of win.ShellExecute. I'm trying this in plain FAR with default config and plugins only.
Last edited by KlepetoX on Thu 05 Dec, 2019 11:05, edited 1 time in total.
Macro {
key ="CtrlAltO";
area ="Common";
description ="Clone Far";
flags ="NoSendKeysToPlugins";
action=function()
local FarName='"'..win.GetEnv("FARHOME").."\\far.exe"..'"'
--local ConemuName=win.GetEnv("FARHOME").."\\conemu.exe"
local FarLeft,FarRight
if APanel.Left then FarLeft=APanel.Path0 FarRight=PPanel.Path0 end --.Path0 is real path (if plugin)
if PPanel.Left then FarLeft=PPanel.Path0 FarRight=APanel.Path0 end
--https://forum.farmanager.com/viewtopic.php?f=59&t=11918
if FarLeft:sub(-1)=='\\' then FarLeft=FarLeft..'\\' end
if FarRight:sub(-1)=='\\' then FarRight=FarRight..'\\' end
FarLeft='"'..FarLeft..'"'
FarRight='"'..FarRight..'"'
if not APanel.Left then win.SetEnv('FarPanel','R') else win.SetEnv('FarPanel',nil) end
win.SetEnv('FARAPanelPos',APanel.CurPos)
win.SetEnv('FARPPanelPos',PPanel.CurPos)
if APanel.Left and APanel.Prefix=='arc' then FarLeft ='arc:"\\"'..APanel.HostFile..'\\""' end
if not APanel.Left and APanel.Prefix=='arc' then FarRight='arc:"\\"'..APanel.HostFile..'\\""' end
if PPanel.Left and PPanel.Prefix=='arc' then FarLeft ='arc:"\\"'..PPanel.HostFile..'\\""' end
if not PPanel.Left and PPanel.Prefix=='arc' then FarRight='arc:"\\"'..PPanel.HostFile..'\\""' end
local Text=FarName..' '..FarLeft..' '..FarRight
--far.Message(Text)
---win.ShellExecute(nil,nil,ConemuName,'-run '..Text,nil,nil) -- Far with ConEmu
win.ShellExecute(nil,nil,FarName,FarLeft..' '..FarRight,nil,nil) -- Far without ConEmu
end;
}
Macro {
key ="auto";
area ="common";
description ="Set active panel left or right after macro CtrlAltO - clone FAR";
flags ="RunAfterFARStart";
action=function()
local FarPanel=win.GetEnv('FarPanel')
local FARAPanelPos=win.GetEnv('FARAPanelPos')
local FARPPanelPos=win.GetEnv('FARPPanelPos')
win.SetEnv('FarPanel',nil)
win.SetEnv('FARAPanelPos',nil)
win.SetEnv('FARPPanelPos',nil)
if FarPanel=='R' then panel.SetActivePanel(nil,0) end
Panel.SetPosIdx(0,FARAPanelPos)
Panel.SetPosIdx(1,FARPPanelPos)
end;
}