Macro to start new FAR window with the same panels

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

Macro to start new FAR window with the same panels

Postby 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: 98
Joined: Sun 08 Jan, 2012 08:23
Location: Czech Republic

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

Postby 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: 4909
Joined: Thu 23 Mar, 2006 21:36
Location: Israel
Has thanked: 11 times
Been thanked: 118 times

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

Postby 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: 98
Joined: Sun 08 Jan, 2012 08:23
Location: Czech Republic

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

Postby 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: 4909
Joined: Thu 23 Mar, 2006 21:36
Location: Israel
Has thanked: 11 times
Been thanked: 118 times

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

Postby 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: 98
Joined: Sun 08 Jan, 2012 08:23
Location: Czech Republic

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

Postby 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: 4909
Joined: Thu 23 Mar, 2006 21:36
Location: Israel
Has thanked: 11 times
Been thanked: 118 times

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

Postby 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: 98
Joined: Sun 08 Jan, 2012 08:23
Location: Czech Republic

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

Postby KlepetoX » Wed 27 Feb, 2013 16:06

Shmuel, thank you, solved completly :-)

TomasGriffin
Posts: 1
Joined: Thu 21 Nov, 2013 07:54

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

Postby TomasGriffin » Mon 25 Nov, 2013 11:06

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

Were you able to create such FAR windows? Please share some more information as I need this FAR window.. Hope you will help.
Last edited by HaRT on Mon 25 Nov, 2013 12:04, edited 1 time in total.
Reason: [overquoting]

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

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

Postby 2useven10 » Mon 25 Nov, 2013 11:41

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


Return to “Macro Commands Discussions”

Who is online

Users browsing this forum: No registered users and 1 guest