Macro to start new FAR window with the same panels

Here you can discuss any topic concerning Far macro commands.
Post Reply
KlepetoX
Posts: 102
Joined: Sun 08 Jan, 2012 08:23
Location: Czech Republic

Macro to start new FAR window with the same panels

Post by KlepetoX » Wed 20 Feb, 2013 19:38

I'm trying create macro to start new FAR window with the same panels as actual FAR. My macro is:

macro:post print("start %farhome%\\far ") Keys("Ctrl[ Space Ctrl] Enter")

But there's problem with "\" symbol at the end of folders between "" characters - new FAR ignore folders with this symbol at the end and starts with default folders in panels. I can use "BS" key in macro to delete "\". But it is not possible in simple way because folders may be between "" characters sometimes, sometimes not.

Example:

WORKS:
start %farhome%\far "C:\Program Files (x86)" "D:\#MUSIC\Rock\13th Floor Elevators\The Psychedelic Sounds Of.1966"

DOESN'T WORK:
start %farhome%\far "C:\Program Files (x86)\" "D:\#MUSIC\Rock\13th Floor Elevators\The Psychedelic Sounds Of.1966\"

BUT THIS WORKS ALWAYS:
start %farhome%\far C:\AMD\ D:\#MUSIC\Rock\
start %farhome%\far C:\AMD D:\#MUSIC\Rock

KlepetoX
Posts: 102
Joined: Sun 08 Jan, 2012 08:23
Location: Czech Republic

Re: Macro to start new FAR window with the same panels

Post by KlepetoX » Wed 27 Feb, 2013 07:53

Now I have this macro:

macro:post print("start %farhome%\\far ") Keys("Ctrl[ Space Ctrl] Space CtrlIns ShiftF4 c l o n e . t m p Enter CtrlV CtrlHome CtrlF7 \\ \" Tab Del \" Enter Tab Enter CtrlA CtrlC Esc N CtrlV Enter")

I call it from user menu (F2). I had to replace \" (with ") character in editor. But it is not the best solution. It clones (start new) FAR with standard panels only.

Is there any possibility to clone (start new) FAR with the same panels, even plugin panels (FTP, ArcLiete....)?

Shmuel
Posts: 5229
Joined: Thu 23 Mar, 2006 21:36
Location: Israel
Has thanked: 16 times
Been thanked: 151 times

Re: Macro to start new FAR window with the same panels

Post by Shmuel » Wed 27 Feb, 2013 11:28

Here is your macro made a little shorter:

Code: Select all

printf('start "" "%%farhome%%\\far.exe" %q %q',APanel.Path,PPanel.Path) Keys("Enter")
KlepetoX wrote:Is there any possibility to clone (start new) FAR with the same panels, even plugin panels (FTP, ArcLiete....)?
I don't know.

KlepetoX
Posts: 102
Joined: Sun 08 Jan, 2012 08:23
Location: Czech Republic

Re: Macro to start new FAR window with the same panels

Post by KlepetoX » Wed 27 Feb, 2013 13:29

Hello Shmuell, thank you, this is much more better.

I only had to edit macro this way:

Code: Select all

macro:post printf('start %%farhome%%\\far.exe %q %q',APanel.Path,PPanel.Path) Keys("Enter")
After this correction it starts with the same console parameters (Font, Height, Width) instead of defaults (80x25 and another font).

Shmuel
Posts: 5229
Joined: Thu 23 Mar, 2006 21:36
Location: Israel
Has thanked: 16 times
Been thanked: 151 times

Re: Macro to start new FAR window with the same panels

Post by Shmuel » Wed 27 Feb, 2013 13:36

OK. Probably, one more correction would be worthwhile:

Code: Select all

macro:post printf('start %%farhome%%\\far.exe "%s" "%s"',APanel.Path,PPanel.Path) Keys("Enter")

KlepetoX
Posts: 102
Joined: Sun 08 Jan, 2012 08:23
Location: Czech Republic

Re: Macro to start new FAR window with the same panels

Post by KlepetoX » Wed 27 Feb, 2013 15:01

Shmuel - one more question:

If I start this macro from right panel (right panel is APanel), then new FAR window has folder from the right panel in left panel and vice versa. Is there any possibility to use something like RPanel.Path and LPanel instead of APanel and PPanel?

Shmuel
Posts: 5229
Joined: Thu 23 Mar, 2006 21:36
Location: Israel
Has thanked: 16 times
Been thanked: 151 times

Re: Macro to start new FAR window with the same panels

Post by Shmuel » Wed 27 Feb, 2013 15:35

Code: Select all

macro:post printf('start %%farhome%%\\far.exe "%s" "%s"',APanel.Left and APanel.Path or PPanel.Path,APanel.Left and PPanel.Path or APanel.Path) Keys("Enter")

KlepetoX
Posts: 102
Joined: Sun 08 Jan, 2012 08:23
Location: Czech Republic

Re: Macro to start new FAR window with the same panels

Post by KlepetoX » Wed 27 Feb, 2013 16:06

Shmuel, thank you, solved completly :-)

2useven10
Posts: 3045
Joined: Mon 07 Sep, 2009 10:40
Has thanked: 2 times
Been thanked: 83 times

Re: Macro to start new FAR window with the same panels

Post by 2useven10 » Mon 25 Nov, 2013 11:41

It should work in the far manager 3.0 'stable' or nightly build.

Post Reply

Return to “Macro Commands Discussions”