Macro to start new FAR window with the same panels

Here you can discuss any topic concerning Far macro commands.
Post Reply
KlepetoX
Posts: 129
Joined: Sun 08 Jan, 2012 08:23
Location: Czech Republic
Has thanked: 2 times
Been thanked: 1 time

Macro to start new FAR window with the same panels

Post by KlepetoX »

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: 129
Joined: Sun 08 Jan, 2012 08:23
Location: Czech Republic
Has thanked: 2 times
Been thanked: 1 time

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

Post by KlepetoX »

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: 6815
Joined: Thu 23 Mar, 2006 21:36
Location: Israel
Has thanked: 41 times
Been thanked: 526 times

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

Post by Shmuel »

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: 129
Joined: Sun 08 Jan, 2012 08:23
Location: Czech Republic
Has thanked: 2 times
Been thanked: 1 time

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

Post by KlepetoX »

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: 6815
Joined: Thu 23 Mar, 2006 21:36
Location: Israel
Has thanked: 41 times
Been thanked: 526 times

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

Post by Shmuel »

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: 129
Joined: Sun 08 Jan, 2012 08:23
Location: Czech Republic
Has thanked: 2 times
Been thanked: 1 time

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

Post by KlepetoX »

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: 6815
Joined: Thu 23 Mar, 2006 21:36
Location: Israel
Has thanked: 41 times
Been thanked: 526 times

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

Post by Shmuel »

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: 129
Joined: Sun 08 Jan, 2012 08:23
Location: Czech Republic
Has thanked: 2 times
Been thanked: 1 time

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

Post by KlepetoX »

Shmuel, thank you, solved completly :-)
2useven10
Posts: 5192
Joined: Mon 07 Sep, 2009 10:40
Has thanked: 18 times
Been thanked: 309 times

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

Post by 2useven10 »

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

Return to “Macro Commands Discussions”