Run macro at startup but before opening panels

Here you can discuss any topic concerning Far macro commands.
Post Reply
nnobody
Posts: 15
Joined: Sun 05 Feb, 2012 15:33

Run macro at startup but before opening panels

Post by nnobody » Mon 15 May, 2017 17:20

Is it possible to run a macro at Far startup, but before panel folders will be opened?
The problem: check saved panel path and change it if necessary, but before Far attempts to open it.

siberia-man
Posts: 98
Joined: Sat 28 Jun, 2014 23:07
Has thanked: 1 time
Been thanked: 3 times

Run macro at startup but before opening panels

Post by siberia-man » Mon 15 May, 2017 17:39

I guess this can help you

Code: Select all

Macro {
	description = "Display date/time of Far invocation";
	area = "Shell";
	key = "";
	flags = "RunAfterFARStart";
	action = function()
		-- http://forum.farmanager.com/viewtopic.php?p=138007#p138007
		-- Скрыть "вводимую" команду при старте FAR
		-- Hide an "entered" command at starting of FAR
		panel.GetUserScreen()
		win.system("echo:Started Far3")
		win.system("echo:[ %DATE% %TIME% ]")
		panel.SetUserScreen()
	end;
}

nnobody
Posts: 15
Joined: Sun 05 Feb, 2012 15:33

Run macro at startup but before opening panels

Post by nnobody » Mon 15 May, 2017 17:49

I've already tried RunAfterFARStart flag and such a macro runs after the panels are opened (GetUserScreen() just hides them).

nnobody
Posts: 15
Joined: Sun 05 Feb, 2012 15:33

Run macro at startup but before opening panels

Post by nnobody » Mon 15 May, 2017 18:08

The actual problem that I'd like to solve is slow Far startup if previous session ends up on opened network path (Network plugin, which i like) of currently unavailable host (Windows SMB timeout is about 30 seconds). I'd like to Far somehow save panel folders, but only for local drives.
Last edited by nnobody on Mon 15 May, 2017 18:09, edited 1 time in total.

User avatar
Xerox
Posts: 221
Joined: Sun 20 Oct, 2019 15:50
Has thanked: 217 times
Been thanked: 1 time

Run macro at startup but before opening panels

Post by Xerox » Fri 01 Nov, 2019 15:49

You may try using "%FARPROFILE%\luafar_init.lua"
It run before everything else, ther is example script:

Code: Select all

print "Hello World!?"
win.system ("notepad.exe")
win.SetEnv("abc123", "blah-blah-blah")
Last edited by Xerox on Fri 01 Nov, 2019 15:50, edited 1 time in total.

buniak_a_h
Posts: 1230
Joined: Sat 20 Apr, 2013 00:17
Location: Питер
Has thanked: 88 times
Been thanked: 68 times
Contact:

Run macro at startup but before opening panels

Post by buniak_a_h » Fri 01 Nov, 2019 19:31

You can specify start folders in command line for Far so:
far.exe C:\ C:\
and then open desired folders in RunAfterFARStart-macro. And save last folders in ExitFAR-Event.
Sorry for my English …
Last edited by buniak_a_h on Fri 01 Nov, 2019 20:56, edited 2 times in total.

Post Reply

Return to “Macro Commands Discussions”