A reasonable way to switch sets of toolbars on/off

Discussion, questions and support.
Post Reply
Message
Author
W4tch3r
Posts: 10
Joined: 04.10.2007, 05:47

A reasonable way to switch sets of toolbars on/off

#1 Post by W4tch3r » 20.05.2010, 06:17

I use different sets of toolbars on my FC depending on location (different network shares etc), monitor size (on my htpc I turn off all but essentials). I got tired of turning 6 toolbars on and off (using toolbars --> customize, toggle 12 checkboxes). So today I sat down and compared the freecommander.ini files and found a nice regex tool with a batch search and replace mode. Now I can switch all 6 toolbars on and off by running freecommander.ini through this program (TextCrawler v2.0 Beta). I did try multiple ini files but found it a lot of work to propagate changes whenever I tweaked the main setup.

There's a few clicks involved (load TextCrawler, load batch script, run it etc) so its probably not worth it if you only have 1 or 2 toolbars to toggle. But if you are like me and have several, it works out a fair bit quicker. I have posted in the authors forum begging for some command line options to run the script and pass in the target file (freecommander.ini). If the whole job could be done with a single batch file it would be very fast indeed (even for just 1 or 2 toolbars). Here are the 3 x regex commands I used to do the job (the file itself is generated by TextCrawler).

W4tch3r

---------------------------------------------------------------------------------------
//TextCrawler Script File 1.0

!Find
(\[Tools20(49|50|52|53|56|60|51|61|62|63|64|65)_TBarSettings\]\r\nShowToolbar)=1
!Replace
$1=3
!Options


!Find
(\[Tools20(49|50|52|53|56|60|51|61|62|63|64|65)_TBarSettings\]\r\nShowToolbar)=0
!Replace
$1=1
!Options


!Find
(\[Tools20(49|50|52|53|56|60|51|61|62|63|64|65)_TBarSettings\]\r\nShowToolbar)=3
!Replace
$1=0
!Options


!End
---------------------------------------------------------------------------------------
W4tch3r ‹•¿•›

W4tch3r
Posts: 10
Joined: 04.10.2007, 05:47

Re: A reasonable way to switch sets of toolbars on/off

#2 Post by W4tch3r » 20.05.2010, 23:48

ok Textrawler still remains my favorite tool for file search/replace, but for the time being, I found this CLI search and replace tool (rxfind) that supports regex. Its easy now to switch the toolbars and restart FC by pressing one button in the FC toolbar. It works nicely even for switching just 1 or 2 toolbars on/off. Hopefully the next version of FC will capture toolbar settings within the Layouts. Here is the batch file I attach to a button on the toolbar. Copy rxfind, this batch file (and maybe sysinternals pskill if you want to roll the restart into the batch file). Note all that I have the FC option "Auto Save Settings" turned OFF. Things get messy if it is on (you have to run this, save the ini file before closing FC ...etc)

W4tch3r

----------------------
pause "Are you sure you want Toggle the FreeCommander Toolbars?"
rxfind %1 /B:2 /Q /P:"(\[Tools20(49|50|52|53|56|60|51|61|62|63|64|65)_TBarSettings\]\r\nShowToolbar)=1" /r:"$1=3"
rxfind %1 /B:2 /Q /P:"(\[Tools20(49|50|52|53|56|60|51|61|62|63|64|65)_TBarSettings\]\r\nShowToolbar)=0" /r:"$1=1"
rxfind %1 /B:2 /Q /P:"(\[Tools20(49|50|52|53|56|60|51|61|62|63|64|65)_TBarSettings\]\r\nShowToolbar)=3" /r:"$1=0"
"_Apps\_Wscc\Data\Sysinternals Suite\pskill.exe" "FreeCommander.exe"
"FreeCommander.exe"
----------------------
W4tch3r ‹•¿•›

granny
Posts: 111
Joined: 03.12.2007, 04:46

Re: A reasonable way to switch sets of toolbars on/off

#3 Post by granny » 21.05.2010, 05:51

This is very intriguing. I intend to try this out on the weekend. and I know I will be back with questions.

I still occasionally think about your post about using AutoIt scripts to load different layouts, but never got up the gumption to cram a new scripting language into my tired old head. < I only ever learned VBA, and use it to make specialized Excel and Word mini-apps for our office to use >

Thank you for this.

W4tch3r
Posts: 10
Joined: 04.10.2007, 05:47

Re: A reasonable way to switch sets of toolbars on/off

#4 Post by W4tch3r » 24.05.2010, 07:11

AutoIt has really enabled me to expand the functionality of the FC toolbars. It's not a pretty solution (sometimes you can see the buttons being pressed as the script runs for example). But I'll take it warts and all while we wait for future versions which hopefully will make at least some of these tricks obsolete.

With AutoIT its fairly easy to make toolbar buttons that allow single click layout changes, file filters and favorites that open in new tabs. If you've ever programmed before in ANY lanuage then you won't have any problem with this level of AutoIT. I'm not really getting too far past the basics. All the scripts are just a few lines. Lately I've been using it to make little program launchers for apps that don't support command line parameters so I can use a toolbar button to launch an app that then opens the file(s) highlighted in the active pane. For example, I have a script called "Run and Open AltF+O.exe". I put this in the FC toolbar on a button, and using the script parameters, it launches the app, focuses in it, types "Alt-F" followed by "O", then types in the %ActivSel% filename and presses Enter. It just saves me from finding the file twice (once in FC and then again in the application).

FYI here is another recent tweak I started using. For dual monitors, I have copied freecommander.exe to "freecommander left.exe" and "freecommander right.exe". Marek has cleverly made the program so the ini file follows the exe name (so they use "freecommander left.ini" and "freecommander right.ini" straight up without any modification). Again FC amazed me with this feature. So now I can keep different sets of default layouts for each monitor. I also used IconFX to extract the icons and modify them a little by superimposing a "L" and a "R" over the orange "FC" icon (my favorite). Merged those 2 icons back into the 2 exe's (again with IcoFX) and now I don't confuse the side by side FC's in the taskbar.

W4tch3r
W4tch3r ‹•¿•›

User avatar
JohnFredC
Posts: 123
Joined: 17.10.2007, 02:08
Location: Sarasota Florida

Re: A reasonable way to switch sets of toolbars on/off

#5 Post by JohnFredC » 06.06.2010, 16:11

Now that is a very good tip! Thanks for it!
Mouse-centric

Post Reply

Who is online

Users browsing this forum: No registered users and 29 guests