Something is missing in Far Manager? You have a great idea that should be heard? Write here.
Mauro72
Posts: 220 Joined: Wed 11 Aug, 2010 00:23
Location: Rosario, Argentina
Been thanked: 9 times
Post
by Mauro72 » Wed 07 Aug, 2013 16:13
Hi,
A option to save the last folders/DIRs used before exit FAR!!!
Not the Autosave option, only save the last DIRs. Because i change the panels width, format,
working with far, and i don't want to save the panels changes. Only the last used DIRs.
May be a plugin?
Thanks.
Mauro72
Mauro72
Posts: 220 Joined: Wed 11 Aug, 2010 00:23
Location: Rosario, Argentina
Been thanked: 9 times
Post
by Mauro72 » Wed 07 Aug, 2013 17:16
The last used folders in the two panels. Not only one show in the history.
Mauro72
Shmuel
Posts: 6820 Joined: Thu 23 Mar, 2006 21:36
Location: Israel
Has thanked: 41 times
Been thanked: 528 times
Post
by Shmuel » Wed 07 Aug, 2013 19:33
Mauro72 wrote: A option to save the last folders/DIRs used before exit FAR!!!
The following macros will do what you want provided you exit Far via F10.
local F = far. Flags
Event {
group= "DialogEvent" ;
description= "Save panel directories on exit" ;
action= function ( Event, FarDialogEvent)
if Dlg. Id == "72E6E6D8-0BC6-4265-B9C4-C8DB712136AF" and
Event == F. DE_DLGPROCINIT and
FarDialogEvent. Msg == F. DN_CLOSE and
FarDialogEvent. Param1 == 4
then
mf. msave( "setup" , "passivepanel" , panel. GetPanelDirectory( nil , 0 ) )
mf. msave( "setup" , "activepanel" , panel. GetPanelDirectory( nil , 1 ) )
mf. msave( "setup" , "activepanelleft" , APanel. Left)
end
end ;
}
Macro {
description= "Restore panel directories on start" ;
area= "Shell" ; key= "auto" ; flags= "RunAfterFARStart" ;
action= function ( )
local p0 = mf. mload( "setup" , "passivepanel" )
local p1 = mf. mload( "setup" , "activepanel" )
if p0 then panel. SetPanelDirectory( nil , 0 , p0) end
if p1 then panel. SetPanelDirectory( nil , 1 , p1) end
if APanel. Left ~= mf. mload( "setup" , "activepanelleft" ) then
Keys( "CtrlU" )
end
end ;
}
Shmuel
Mauro72
Posts: 220 Joined: Wed 11 Aug, 2010 00:23
Location: Rosario, Argentina
Been thanked: 9 times
Post
by Mauro72 » Wed 07 Aug, 2013 19:50
Thanks Shmuel... works excellent!
But i have error window after exit FAR. Always!!!
Last version, Far Manager v3.0 build 3597 x86
Mauro72
Shmuel
Posts: 6820 Joined: Thu 23 Mar, 2006 21:36
Location: Israel
Has thanked: 41 times
Been thanked: 528 times
Post
by Shmuel » Wed 07 Aug, 2013 20:06
I don't have error window (same Far). Could you show a screenshot of that window?
Shmuel
Mauro72
Posts: 220 Joined: Wed 11 Aug, 2010 00:23
Location: Rosario, Argentina
Been thanked: 9 times
Post
by Mauro72 » Wed 07 Aug, 2013 20:32
far_error.jpg (167.37 KiB) Viewed 21388 times
Mauro72
Mauro72
Posts: 220 Joined: Wed 11 Aug, 2010 00:23
Location: Rosario, Argentina
Been thanked: 9 times
Post
by Mauro72 » Wed 07 Aug, 2013 20:34
Windows XP SP3...
Mauro72
Shmuel
Posts: 6820 Joined: Thu 23 Mar, 2006 21:36
Location: Israel
Has thanked: 41 times
Been thanked: 528 times
Post
by Shmuel » Wed 07 Aug, 2013 20:39
I really have no idea (same Windows, same Far, no error). Maybe try it on stable 3525 build?
Here is the modification of the macros which minimizes the number of mf.msave() calls (they take a noticeable time).
local F = far. Flags
Event {
group= "DialogEvent" ;
description= "Save panel directories on exit" ;
action= function ( Event, FarDialogEvent)
if Dlg. Id == "72E6E6D8-0BC6-4265-B9C4-C8DB712136AF" and
Event == F. DE_DLGPROCINIT and
FarDialogEvent. Msg == F. DN_CLOSE and
FarDialogEvent. Param1 == 4
then
mf. msave( "setup" , "panelsdata" , {
passivepanel = panel. GetPanelDirectory( nil , 0 ) ,
activepanel = panel. GetPanelDirectory( nil , 1 ) ,
activepanelleft = APanel. Left,
} )
end
end ;
}
Macro {
description= "Restore panel directories on start" ;
area= "Shell" ; key= "auto" ; flags= "RunAfterFARStart" ;
action= function ( )
local t = mf. mload( "setup" , "panelsdata" )
if type ( t) ~= "table" then return end
panel. SetPanelDirectory( nil , 0 , t. passivepanel)
panel. SetPanelDirectory( nil , 1 , t. activepanel)
if APanel. Left ~= t. activepanelleft then Keys( "CtrlU" ) end
end ;
}
Shmuel
Mauro72
Posts: 220 Joined: Wed 11 Aug, 2010 00:23
Location: Rosario, Argentina
Been thanked: 9 times
Post
by Mauro72 » Wed 07 Aug, 2013 21:27
Fixed the error: Deleting plugincache32.db
Thanks for your help Shmuel
Mauro72
Mauro72
Posts: 220 Joined: Wed 11 Aug, 2010 00:23
Location: Rosario, Argentina
Been thanked: 9 times
Post
by Mauro72 » Wed 07 Aug, 2013 22:02
mmmm, again the error!!! oops
Mauro72
Shmuel
Posts: 6820 Joined: Thu 23 Mar, 2006 21:36
Location: Israel
Has thanked: 41 times
Been thanked: 528 times
Post
by Shmuel » Thu 08 Aug, 2013 07:08
Again, no idea what's wrong, on my machine it never fails.
Try the following version, it saves data to a file rather than database.
local F = far. Flags
local filename = win. GetEnv( "farprofile" ) .. "\\ Macros\\ panels.txt"
Event {
group= "DialogEvent" ;
description= "Save panel directories on exit" ;
action= function ( Event, FarDialogEvent)
if Dlg. Id == "72E6E6D8-0BC6-4265-B9C4-C8DB712136AF" and
Event == F. DE_DLGPROCINIT and
FarDialogEvent. Msg == F. DN_CLOSE and
FarDialogEvent. Param1 == 4
then
local fp = io.open ( filename, "w" )
if fp then
local passivepanel = panel. GetPanelDirectory( nil , 0 )
local activepanel = panel. GetPanelDirectory( nil , 1 )
local activepanelleft = tostring ( APanel. Left)
if passivepanel and activepanel then
fp: write ( passivepanel. Name, "\n " , activepanel. Name, "\n " , activepanelleft, "\n " )
end
fp: close( )
end
end
end ;
}
Macro {
description= "Restore panel directories on start" ;
area= "Shell" ; key= "auto" ; flags= "RunAfterFARStart" ;
action= function ( )
local fp = io.open ( filename)
if fp then
panel. SetPanelDirectory( nil , 0 , fp: read ( "*l" ) )
panel. SetPanelDirectory( nil , 1 , fp: read ( "*l" ) )
if tostring ( APanel. Left) ~= fp: read ( "*l" ) then Keys( "CtrlU" ) end
fp: close( )
end
end ;
}
Shmuel
2useven10
Posts: 5211 Joined: Mon 07 Sep, 2009 10:40
Has thanked: 18 times
Been thanked: 310 times
Post
by 2useven10 » Thu 08 Aug, 2013 11:32
Shmuel
The following macros will do what you want provided you exit Far via F10.
What is wrong with Event ExitFAR? Why not use it?
2useven10
Shmuel
Posts: 6820 Joined: Thu 23 Mar, 2006 21:36
Location: Israel
Has thanked: 41 times
Been thanked: 528 times
Post
by Shmuel » Thu 08 Aug, 2013 11:43
2useven10 wrote: Shmuel
The following macros will do what you want provided you exit Far via F10.
What is wrong with Event ExitFAR? Why not use it?
Because it is called too late, when most of the Plugins API functions do not work.
For example, FCTL_GETPANELDIRECTORY won't work from ExitFARW.
Shmuel