Page 1 of 2

Popup Menu Items

Posted: 11 Aug 2013 20:35
by CookieMonster
I'm in need of a script that is a pop-up menu, which I can add items/scripts to the pop-up menu, rearrange menu items, remove menu items, add separators, a custom context menu would be more helpful, then having to go to a menu item.

Re: Popup Menu Items

Posted: 12 Aug 2013 19:43
by totmad1
I cannot claim any of this as my own. It was all found on this forum and associated sites.
I have searched again but could not find.

Here is a template for a menu and a sub menu.
First off the menu template ($p_note is a permanent variable)

Code: Select all

"TestMenu-00 - TEST MENU TEMPLATE"    //change here
"Edit Button : editButton"   UserButton(19, 128);   //change here
"Customize Toolbar : custTB"   Button("ctb1", 256); //change here
"Edit script : edit"
            $ScriptFile= self ("file");
	    run $p_note $ScriptFile , w;
"-"
"<- TestMenu-00|:TestMenu-00|1 :"   Load("menus\TestMenu-00.xys");  //change here
"-"
"    ->"    load (-);
"    ->"    load (-);
"    ->"    load (-);
"    ->"    load (-);
"    ->"    load (-);
"    ->"    load (-);
"    ->"    load (-);
-
"CANCEL"
As you can see you can use "-" or - as a seperater
here is a sample with sub menus denoted by ____---->

Code: Select all

"Help" load (ShowHelpTopic);
-
"TestMenu-01 (txt)  ____---->"   load ("TestMenu-01.xys");
"TestMenu-02  ____---->"   load ("TestMenu-02.xys");
"TestMenu-03  ____---->"   load ("TestMenu-03.xys");
"TestMenu-04  ____---->"   load ("TestMenu-04");
"TestMenu-05  ____---->"   load ("TestMenu-05");
"-"
" goto SLEEP   ->"    run "nircmd standby";
//" Lock   ->"    run ("rundll32.exe user32.dll, LockWorkStation");
" Lockcomputer w nircmd ->|<xyicons>\Lock-closed.ico" run "nircmd lockws" ;
-
"renameSUB Menu ____---->" load("rename\renameSUB");
"Toolbar Manager|<xyicons>\ToolbarManager.ico" load toolbarMgr ;
"Layout Manager |:panellast" load("<xyscripts>\LayoutManager\LMMenu.xys") ;
"Tabsets Manager |:tabsets"  load tabsetMgr ;
" 0TEMPLATE   ->"    load ("<xyscripts>\test\0TEMPLATE.xys");
"MAINMENU     ____---->"    load (MAINMENU);
//zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz
"PowerFilter____---->|<xyicons>\PowerFilter.ico : Pf2ME"   Load("*","_PfMD;-;_Pf2L;_Pf2R;_Pf2A;_Pf2B");
"<- PowerFilter|:PowerFilter|1 : _Pf2MD"   Load("*");
"&load PowerFilter|:PowerFilter : _Pf2L"   load (PowerFilter);
"& PowerFilter Reset|: : _Pf2R"    load "PowerFilter.xys", "_PowerReset";
"&  PFilter   ->|: : _Pf2A"   load (PFilter);
"&test1 filter|: : _Pf2B" loadsearch "test1" ;
//zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz

" infoPanel   ____---->"    load (infoPanel);
Here is the template for the other type of sub menu

Code: Select all

"comm  ____--->|C:\.icons\16\203.ico : edME"   Load("*","_edMD;-;_edA;_edB;_edC;_edD;_edE;_edF;_edG;_edH;_edJ;_edK;_edL;_edN;_edP;_edQ;_edR;_edS;_edT;_edU;_edV;_edW;_edX;_edY;_edZ;_edA1;_edB1;_edC1;_edD1;_edE1;_edF1;_edG1;_edH1;_edJ1;_edK1;_edL1;_edN1;_edP1;_edQ1;_edR1;_edS1;_edT1;_edU1;_edV1;_edW1;_edX1;_edY1;_edZ1;_edA2;_edB2;_edC2;_edD2;_edE2;_edF2;_edG2;_edH2;_edJ2;_edK2;_edL2;_edN2;_edP2;_edQ2;_edR2;_edS2;_edT2;_edU2;_edV2;_edW2;_edX2;_edY2;_edZ2;");
"<- comm|:ed|1 : _edMD"   Load("*");
"comm _Ctrl+Z_|C:\.icons\16\203.ico : _edA"  #203 ; open "       ";
"comm |C:\.icons\16\203.ico : _edB" openwith "       ";
I hope that this is useful

Re: Popup Menu Items

Posted: 15 Aug 2013 15:32
by CookieMonster
If I understand correctly how this script works, I can only manually add XYS scripts ? I was hoping for a drag and drop of features, for example, miniTree in the drop down etc, from the looks of things, I have to find miniTree.xys and place it in manually ?

Re: Popup Menu Items

Posted: 15 Aug 2013 17:01
by totmad1
You are totally correct .
If you want drag and drop you could use the catalog.
For a seperator , in Caption place ---------------------- and in Location "-".

here is an images of my catalogs
Panorama.jpg

Re: Popup Menu Items

Posted: 16 Aug 2013 00:17
by CookieMonster
I never meant in the catalog, I meant in the toolbar. A menu that I can add icons so the toolbar is not cluttered.

Re: Popup Menu Items

Posted: 16 Aug 2013 19:40
by totmad1
Here is a method to use drag and drop but whatever you expect you have to do some work.
i.e you have to find any script you want to work with.

Code: Select all

"run"
      $file = <curitem>; 
      $ext= getpathcomponent( "$file", "ext");
      if ($ext == "xys") {
      writefile("<xyscripts>\menu\0MenuTemp.xys", "    ->" load ("<curitem>")<crlf>, "a");
      }
       else { 
        writefile("<xyscripts>\menu\0MenuTemp.xys", "    ->" open ("<curitem>")<crlf>, "a");
      } 
put this code in right click so that you can edit the menu.

Code: Select all

"edit Menu"
           open "<xyscripts>\menu\0MenuTemp.xys";

Re: Popup Menu Items

Posted: 17 Aug 2013 06:19
by CookieMonster
I tried running the script, just code shows, doesn't run, but shows !

Re: Popup Menu Items

Posted: 17 Aug 2013 13:31
by RalphM
Being a bit more specific in which code-fragment you tried to run as a script and which of the various methods to run a script you used might vastly improve the help you get on the problem.

I seem to recall that somebody once did a user button with all the available toolbar buttons underneath, which you could probably adapt for your needs, but AFAIK there's currently no way to drag&drop the buttons between the toolbar itself and that special button.

If you think that description sounds interesting, please search the forum for the thread with that UDF or User Defined Button.

Re: Popup Menu Items

Posted: 17 Aug 2013 16:38
by totmad1
I believe RalphM maybe talking about this http://www.xyplorer.com/xyfc/viewtopic. ... 4&start=15
If you look to the very bottom of the last page you will find menu scripts.

What I have done since is produce a script .

Menu Producer

extract "0MenuTemp.xys.zip" to "<xydata>\NewItems\" .
copy "MPlftclick.xys" and "MPrtclick.xys" to <xyscripts> folder
Right click your spare User Button
type load "MPlftclick" into On click:
type load "MPrtclick" into On right click:
The first time you run this script, XYplorer will prompt you to make menu folder.

OR

place following code into On click: via the edit button

Code: Select all

"run" 
      if (exists("<xyscripts>\menu\0MenuTemp.xys") == 0) {
          copyto "<xyscripts>\menu\", "<xydata>\NewItems\0MenuTemp.xys";
       }
      else{
      $file = <curitem>; 
      $base= getpathcomponent( "$file", "base");
      $ext= getpathcomponent( "$file", "ext");
      if ($ext == "xys") {
      writefile("<xyscripts>\menu\0MenuTemp.xys", "$base->|<xyicons>\???.ico" load ("<curitem>")<crlf>, "a");
      }
       else { 
        writefile("<xyscripts>\menu\0MenuTemp.xys", "$base ->|<curitem>" open ("<curitem>")<crlf>, "a");
      }
     }

place following code into On right click: via the edit button

Code: Select all

"Load menu ___--->|<xyicons>\0allmenu.ico" load "<xyscripts>\menu\0MenuTemp.xys";
"-"
"Edit Menu ->"
           open "<xyscripts>\menu\0MenuTemp.xys";
"open scripts folder"
           #340;goto "<xyscripts>";
"open menu folder"
           #340;goto "<xyscripts>\menu";
after you are happy with what you've achieved, all you need do is open menu folder and rename "0MenuTemp.xys".
You can then start again, even to the extent of dragging you're previous menu onto your user button.
Please note first item dragged or selected will cause "<xydata>\NewItems\0MenuTemp.xys" to be copied
across so the first item will have to be dragged to the button a second time.

The icons zip are mainly my own. bar clipboard1.ico which you can guess is the basis of a few others .
also taglabel.ico is a mix of XYplorer icons which I use for a menu of 26 items
MenuProducer.zip
icons.zip

Re: Popup Menu Items

Posted: 18 Aug 2013 04:09
by CookieMonster
Right Clicking the button, does bring up a menu list. Left clicking doesn't do anything ? Although when I right-click, I don't understand how I add menu items, for example a drive, or the mini-tree etc ?

Re: Popup Menu Items

Posted: 19 Aug 2013 14:21
by totmad1
I do apologise to not making it clear how to use.

I have written these instructions and updated MenuProducer.zip accordingly.

operation:
left click button
1/
if folder not found
will ask if you want to create folder (click OK)
will then copy 0MenuTemp.xys to this folder
If folder found
will then copy 0MenuTemp.xys to this folder

2/ select item i.e file, program or script. (right click will open script folder)
either drag item to button or left click button.
the script will then create an item in the menu.

right click button
1/ Load menu: loads the menu which has been created
2/ Edit Menu: opens the menu created so that if you want to change the order all you have to do
is cut and paste
3/ open scripts folder: opens new tab at the scripts folder
4/ open menu folder: opens new tab at the menu folder
MenuProducer1.zip
You could find mini tree entry in other topic as mentioned before (you will find it in Third page menu)
you could then copy to your own menu.

Re: Popup Menu Items

Posted: 20 Aug 2013 05:04
by CookieMonster
Below is the code for Left click. You mentioned, when I left click on the menu item, I'm suppose to get "if folder not found" I'm not getting nothing ? Also there is no prompt asking to create a folder ?

You can't drag an item, you can only add an item within "customize button" unless that is what you mean ?

Code: Select all

"run" 
      if (exists("<xyscripts>\menu\0MenuTemp.xys") == 0) {
          copyto "<xyscripts>\menu\", "<xydata>\NewItems\0MenuTemp.xys";
       }
      else{
      $file = <curitem>; 
      $base= getpathcomponent( "$file", "base");
      $ext= getpathcomponent( "$file", "ext");
      if ($ext == "xys") {
      writefile("<xyscripts>\menu\0MenuTemp.xys", "$base->|<xyicons>\???.ico" load ("<curitem>")<crlf>, "a");
      }
       else { 
        writefile("<xyscripts>\menu\0MenuTemp.xys", "$base ->|<curitem>" open ("<curitem>")<crlf>, "a");
      }
     }

Re: Popup Menu Items

Posted: 20 Aug 2013 17:22
by totmad1
No you do not see 'If folder not found' .
have you tried right click 'open menu folder'
you should see a file named '0MenuTemp.xys'
if you are not seeing this file I ask have you copied that file into 'NewItems'.

Re: Popup Menu Items

Posted: 21 Aug 2013 18:21
by CookieMonster
The Script is working. How to I find all the XYS file names for items in the XY MenuBar such as the MiniTree etc ? So I can add it to this menu and other menu items to shrink the amount of icons in the XY Top Menu Bar.

Re: Popup Menu Items

Posted: 21 Aug 2013 19:54
by totmad1
I suggest you read this topic as previously mentioned
http://www.xyplorer.com/xyfc/viewtopic. ... 4&start=15
and download the zip file
http://www.xyplorer.com/xyfc/download/file.php?id=3642