Page 1 of 1

ToolBar Swap

Posted: 10 Aug 2012 17:08
by murdock01
This is my first upload to this community. I really love this file manager, nothing else comes close.
This is a simple set of scripts to allow one to define any number of toolbars and toggle between them via keys or the menu.
I really need more space for toolbar buttons. I define all kinds of things and I have started to utilize the catalog more but buttons, for me, are quick and easy.
I needed more toolbars but I do like the restriction, to some degree, that keeps XYplorer from becoming a wall of buttons. So I created this.

The attached file has everything you need. UNzip it to your scripts folder. A "TBSwap" folder, with the files, will be created.
Setup is pretty basic:
to assign a user button to the tbswap menu just add the following to the "On click" textbox in the "edit user button" dialog

Code: Select all

load "<xyscripts>\tbswap\tbswap_button.xys";
The Name field should be "TBSwap" (or whatever) and the icon field should be

Code: Select all

<xyscripts>\TBSwap\icons\TBSwap.ico
This will give you the little menu. I have it defined to user button 2 which is the first button on all the sample toolbars included in the zip file; you can modify for your needs.
Now you can assign the swaper scripts to user defined commands. In the "manage user defined commands" dialog under the category "Load Script File" create 2 entries; one for swap up and the other for swap down.
The captions can be what ever you want but an example could be "TBSwap Up" and "TBSwap Down"
The Down command needs to have the following in the "script file" field

Code: Select all

tbswap\tbswap_down.xys
An the UP

Code: Select all

tbswap\tbswap_up.xys
Now you can assign hot keys so you can toggle through the different toolbars.

I have included 3 toolbars for your enjoyment. The files are toolbar_1.xys to toolbar_3.xys. These scripts contain the following code:

Code: Select all

Toolbar("ctb2,-,ctb21,lstmgmt,dosbox,openwith,-,myco,mru,favs,-,back,fore,up,goprev,lasttarget,-,undo,redo,-,flatview,views,visualfilter,fvs,minitree,dp,syncscroll,calcfosi,-,qns,find,fp,ctb24,-,savesett");
Basically this swaper is just scripts calling scripts. You can modify the toolbar files to contain what ever config you like. See the help file for more information.
The ini file has 2 settings:
NumberOfToolbars=# the number of toolbar files you have setup. Toolbar file names are in the format "toolbar_#.xys" If you have 10 toolbar files this value will be 10, and so on.
ToolbarNumber=# the toolbar number of the currently loaded toolbar

Thats it. I hope you like it. If you dont, well I tried. I have never submitted anything before. I have plans for things like menu options to create, save, edit the toolbar files.
I know this is a rather simple "app" but I thought someone else might like it.

Enjoy

Re: ToolBar Swap

Posted: 10 Aug 2012 18:44
by SkyFrontier
Hot stuff, Murdock.
Thank you very much.
One small glitch may be the default placement of tbswap_down.xys, tbswap_up.xys files (they must be placed directly under <xyscripts> folder otherwise they won't run - and they're the core of the script...).
Of course this can easily fixed on your end or on an experienced user's end.
Already tweaked it to allow switching of my default toolbar. ;)

P.S.: is it just me or "load next toolbar" isn't working at all, even after using "use previous"...?
>>> 1st problem (tbswap_up.xys):

Code: Select all

$toolbarnumber = getkey("ToolbarNumber", "General", "<xyscripts>\tbswap\tbswap.ini"); 
and not

Code: Select all

$toolbarnumber = getkey("ToolbarNumber", "General", "<xyscripts>\tbswap.ini"); 
But there's something still wrong here and it seems to be related to the logic for the calculations/resets, but no time to check it deeply.
Hint: an IF should be followed by an ELSEIF - always!

Re: ToolBar Swap

Posted: 10 Aug 2012 19:58
by murdock01
Update number 1,
Thanks SkyFrontier. I have fixed the problems I hope.
I originally had all files under the scripts folder. Then I decided, while getting this post ready, to put everything under a sub folder - much more organized. I thought I caught all the path problems. I guess not.

Hope this fixes all the issues. If not just yell and I will try to fix.

Re: ToolBar Swap

Posted: 10 Aug 2012 20:14
by SkyFrontier
Seems perfect now. Thanks much!