Custom toolbar button (load script and menu ID)

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
tester
Posts: 2
Joined: 20 Mar 2017 20:07

Custom toolbar button (load script and menu ID)

Post by tester »

Within the help-file under the "Toolbar" chapter I read how to create a button.

Code: Select all

"Recent Locations|:mru" button "mru"
"Hotlist|:hotlist" button "hotlist"
-
"CKS|:cks" button "cks"
"UDC|:udc" button "udc"
-
"Exit no save|:exitnosave" button "exitnosave"
And

Code: Select all

load "test", "foo" //load script labeled "foo" from "test.xys"
But I could not achieve the below case.
For example, if I want a button with 2 items in it (see below, bold):
  • Config
    When this item is selected, I want the configuration dialog to be opened but using it's ID (Help >> Command ID's on menu)
  • Testscript
    When this item is selected, I want to run a test-script located in: c:\xy\test_123.xys
How would the button syntax would look like?
(When Config is selected I want to use the menu ID, if possible).

EDIT
An example of what I mean:

Code: Select all

Config|#600
Testscript|c:\xy\test_123.xys
But now in the correct syntax (if possible).
So when the custom button is pressed a menu folds out showing: "Config" and "Testscript" and executes/runs their corresponding action.

SkyFrontier
Posts: 2341
Joined: 04 Jan 2010 14:27
Location: Pasárgada (eu vou!)

Re: Custom toolbar button (load script and menu ID)

Post by SkyFrontier »

Code: Select all

   $a = popupmenu("Config;#600;:queue|Testscript;test;<xy>");
   if(substr("$a", 0, 1) == "#") { load $a, , s; } else { load "$a"; }
   
...assuming you have a 'test.xys' file under <xyscripts> folder.

Oh, new user! Welcome 2 the show!
New User's Ref. Guide and Quick Setup Guide can help a bit! Check XYplorer Resources Index for many useful links!
Want a new XYperience? XY MOD - surfYnXoard
-coz' the aim of computing is to free us to LIVE...

tester
Posts: 2
Joined: 20 Mar 2017 20:07

Re: Custom toolbar button (load script and menu ID)

Post by tester »

Hello, thank you for the welcome!
The script works, this will help a lot!

Post Reply