Page 1 of 1

New to button sets.

Posted: 07 Nov 2026 14:22
by DixieCup48
For the first time a need has arisen to invoke a second button set.

The question is; There are only four buttons on this new button set. How do they get centered? So they are not all on the extreme left?

Re: New to button sets.

Posted: 07 Nov 2026 17:31
by WirlyWirly
There is no "centered" alignment option for button sets, so the best you can do is create "blank" buttons by setting the title to {spaces} and then enabling the Text button and Unclickable checkbox for them. This will pad the left side until you get your buttons into the position you want them... Though that might not look right after your resize the window...

-------------------------------------------------------

Alternatively, rather than have an entire second row with only 4 buttons, you can use a custom button to create a Hamburger menu (AKA, drop-down\popup menu). From there you can consolidate your buttons.

Simply add a custom button to your toolbar and then edit the On left-click: field with your list of commands, which can be either ID numbers or actual lines of script.

Here's an example of my own Hamburger menu that I use as a replacement for the XY menu bar...

Code: Select all

:men_file
:men_edit
:men_view
:men_go
:men_favorites
:men_tags
:men_user
:men_scripting
:men_panes
:men_tabsets
:men_tools
:men_window
:men_help
For more advanced Hamburger menus, you can also use separators, such as this Hamburger menu for my most commonly used settings...

The structure is
SEPARATOR>TITLE|COMMAND|ICON

Code: Select all

|>Configuration|#600|:conf
|>All Commands|#705
|>Manage User-Defined Commands...|#656|
|>Manage Folder Views...|#477|:fvs
|>Customize Keyboard Shortcuts|#602|:cks
|>Customize File Associations...|#604|:lstmgmt
|>Customize File Icons|#605|:cfi
-
|>Load Script File|#10|:steps
|>Run Script|#9|:steps
|>Permanent Variables|#756|:steps
-
|>Manage Favorite Folders...|#574|:favs
|>Toggle Favorite Folder|#566|
|>Manage Favorite Files...|#575|:favfiles
|>Toggle Favorite Files|#565|
-
|>Save Configuration|#193|
|>Save Settings|#182|:savedirty

Re: New to button sets.

Posted: 11 Nov 2026 16:18
by DixieCup48
Thank you. That was indeed an exemplary dissertation that you put together. It will take some time to assimilate all that code and information!

If I were still grading papers yours definitely rises to the level of an A.

Re: New to button sets.

Posted: 13 Nov 2026 17:32
by hermhart
Is there a way in this that you can load your own script files with this hamburger type menu? I've tried a bunch of ways, and I hope that I have just missed something. I'm also trying the popupnested with a HEREDOC.

My goal would be to have a menu.xys that my button points to and then I can have the indented structure and can call my script files. Right now I am using the method below, but it feels cumbersome trying to figure out all the "+1" things.

"Create Directory Structure|<xyicons>\shell32.dll_Icons\shell32.dll_I41a6_0409.ico||+1"
load "Windows_CreateNestedItems";
"|||+1"
"Directory Listing|<xyicons>\DirectoryListPrintLogo.png||+1"
load "Windows_DirectoryListing";
"|||+1"

Re: New to button sets.

Posted: 13 Nov 2026 18:54
by WirlyWirly
I don't fully understand your question, but you can definitely load scripts through a Hamburger menu, either by providing their #ID after registering them as a UserDefinedCommand (recommended) or through QuickScripting, which is what we call one-liners that start with :: and can be executed in various locations...

|>MyScript (UserDefiniedCommand)|#1234|icon.ico

|>MyScript|::load "<xyscripts>/path/to/script.xys";|icon.ico

Read the help file for a bit more info...

Code: Select all

Quick Scripting
Quick Scripting means: Scripts, when prefixed with "::" (double-colon), can be executed directly (i.e. quickly) through any interface in XYplorer that can process locations: Address Bar, Go To, Favorites, Catalog etc
If you want to chain commands through QuickScripting, simply separate them with a ;, the same as you would do in Multi-LineScripts...

|>MyScript|::$name = input("GreeterBot 3000", "What is your name?"); echo "Hello $name";|icon.ico

-----------------------------

If the CustomToolbarButton should load a .xys directly without displaying a Hamburger menu, there are a couple ways to do so...

1) [Recommended] Register the .xys as a UserDefinedCommand in the User > Manage Commands > Load Script File menu and then copy the #ID on the bottom-right of the window. Paste that ID number into the button field; On left-Click: #1234

2) Add a QuickScripting line directly to the button field; On left-Click: ::load "C:\path\to\script.xys";

-----------------------------

Using popupnested() instead of Hamburger menus allows you to get more complex with your menus, since you can set variables outside the menu, define\call functions, choose where in XY the menu is displayed, and whatever else you can do with Multi-LineScripts.

It's my preferred menu option when doing any kind of complex tasks, such as I did in my 7-ZipXY and ImageMagickConverter scripts, both of which use popupnested() to display the menu and then QuickScripting to perform the selected command. Both those scripts are fragments of a much larger popupnested() menu I use, but the structure is basically the same throughout.

Look through those files for examples of popupnested(), maybe you'll find some answers.

Re: New to button sets.

Posted: 13 Nov 2026 20:17
by klownboy
Hey WirlyWirly, thanks for the refresher course on hamburger menus. It's been some time since I've updated mine. :) :tup:

Re: New to button sets.

Posted: 13 Nov 2026 22:09
by hermhart
WirlyWirly, thank you so much for the added explanation. That helped me. For some reason, even though I was reading the manual, I was substituting the "::" with "load" and not doing it as "::load".

Re: New to button sets.

Posted: 14 Nov 2026 01:27
by eil
WirlyWirly wrote: ↑13 Nov 2026 18:54 If you want to chain commands through QuickScripting, simply separate them with a ;, the same as you would do in Multi-LineScripts...

|>MyScript|::$name = input("GreeterBot 3000", "What is your name?"); echo "Hello $name";|icon.ico
Damn! Surely i'm noob and only script simply stuff for myself, but it's been year and i didn't know popupmenu items could have multiple commands between name and icon.! :shock:

We need "a noob scripters guide" from WirlyWirly.! :kidding: