How to enable CEA_ListRightClickOnWhite=6 ?

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
CookieMonster

How to enable CEA_ListRightClickOnWhite=6 ?

Post by CookieMonster »

klownboy wrote:The purpose of this script is to call out specific menus when the user right clicks on the list panel white space. The menu which comes up is dependent on the file type of the current file. So you could set it up such that if you had a jpg or png file selected (i.e <curitem>), a menu with 4 or 5 different programs to select from would display, you'd choose one and the file would be opened in that program. So it similar to a right clicking on the file itself to bring up a context menu, but in this case the user is clicking the white space. I mentioned coming up with something similar to this here http://www.xyplorer.com/xyfc/viewtopic. ... 15#p122111 If no file is selected, the script brings up a default menu which can be anything the user wants (i.e, it could be as simple as bringing up the Favorite Files, Favorite Folders, call your own menu, or something more elaborate). Remember if a file is currently selected, but you'd rather just bring up the default menu rather than the specific file-type menu of a highlighted file, you can simply normal left click on white and then right click. You can also easily set the menu up such that some file types programs would immediately be run in a program of choice. For example, you could have it set such that if you have a single GIF file selected, it would bring up all the folder's GIFs in TheQwerty's 'HTMLImagePreview.xys' viewer. You could even set it up such that the script does something special if a folder is selected.

3 examples of the menus which surface if you right clicked with a certain file types selected along with an example default menu:
WhiteSpace_cap.jpg
No, it's nothing new as far as scripting goes, but setting up a script to run when you right click on white space is quite easy and can be very handy. So, why not improve it, make it a bit smarter by expanding its capabilities. I call the script "WhiteSpaceCtxMenu.xys". To use, the 2 lines in the XYplorer.ini file which have to change are:

Code: Select all

CEA_ListRightClickOnWhite=6
CEA_ListRightClickOnWhite_Script=load "<xyscripts>\WhiteSpaceCtxMenu.xys"
Obviously this is not the type of script a user can simply plop into his script folder and use. This is more of an idea and skeleton script you can use to arrive at your own. You have to take a few minutes an substitute your own programs to run based on the file types and any new files types as you wish. What I show here are just examples and certainly not my final script. I'm finding it easier than using the 'real' context menu or even PFAs since it it seems to be less clicking in many cases. If the file you'd like to run a program on is currently selected simply right click on white to bring up the the specific file type menu. If the file isn't currently selected you simply select with the left click and then move the mouse slightly and right click. If you'd rather bring up the default menu when there's a file currently hi-lighted, just left click on white (to un-select) and then follow with a right click.

Code: Select all

/*** image file menu ***/
  $image = <<<IMAGE
"Thumbnails in new Instance|:conf";
  $jpgPath = getpathcomponent("<curitem>", "path");
  run """<xy>"" /new ""$jpgPath"" /win=normal,10,10,1900,1050 /script=""::if(get('View') != '6') {#308};loadlayout('thumbs');open 'D:\Tools\AutoHotkey\AHK scripts\TB_XY_hide.ahk';"""; end(1); }
"ImageEye|D:\Graphics\Image Eye\Image Eye.exe";
  Openwith "D:\Graphics\Image Eye\Image Eye.exe"; end(1);
"Irfanview|D:\Graphics\IrfanView\i_view32.exe";
  openwith "D:\Graphics\IrfanView\i_view32.exe";end(1);
"Greenfish Icon Editor|D:\Graphics\Greenfish Icon Editor Pro\gfie64.exe" openwith "D:\Graphics\Greenfish Icon Editor Pro\gfie64.exe";
IMAGE;

/*** video file menu ***/
   $vid = <<<VID
"BD Rebuilder|D:\DVD\BD Rebuilder\BDRB.exe" open "D:\DVD\BD Rebuilder\BDRB.exe";
"ConvertXtoDvd|D:\DVD\ConvertX\ConvertXtoDvd.exe" open "D:\DVD\ConvertX\ConvertXtoDvd.exe";
"EMDB|D:\DVD\EMDB\EMDB.exe" open "D:\DVD\EMDB\EMDB.exe";
"ImgBurn|D:\DVD\ImgBurn\ImgBurn.exe" open "D:\DVD\ImgBurn\ImgBurn.exe";
"MPC-HC|D:\DVD\MPC HomeCinema (x64)\mpc-hc64.exe" openwith "D:\DVD\MPC HomeCinema (x64)\mpc-hc64.exe";
"TMPGEnc|C:\Program Files (x86)\Pegasys Inc\TMPGEnc Authoring Works 4\TMPGEncAuthoringWorks4.exe" open "C:\Program Files (x86)\Pegasys Inc\TMPGEnc Authoring Works 4\TMPGEncAuthoringWorks4.exe";
"Video Joiner|D:\DVD\Boilsoft Video Joiner\EZMerge.exe" open "D:\DVD\Boilsoft Video Joiner\EZMerge.exe";
"VLC|D:\DVD\VLC\vlc.exe" openwith "D:\DVD\VLC\vlc.exe";
VID;

/*** text file menu ***/
   $txt = <<<DOC
"NotePad++|D:\Tools\NotePad++\notepad++.exe" openwith "D:\Tools\NotePad++\notepad++.exe";
"PSPad|D:\Tools\PSPad\PSPad.exe" openwith "D:\Tools\PSPad\PSPad.exe";
"Notepad|C:\Windows\notepad.exe" openwith "C:\Windows\notepad.exe";
DOC;

/*** Folder menu ***/
   $dir = <<<FOLDER
"Open Folder in new instance Thumbnail view|:viewthumbs"
   run """<xy>"" /new ""$folder"" /win=normal,10,10,1900,1060 /script=""::if(get('View') != '6') {#308};loadlayout('thumbs');""", , 0, 0;
"Favorite Folders|:favs";
  #550; end(1);
"Favorite Files|:favfiles";
  #564; end(1);
FOLDER;

/*** Copy/Move menu ***/
   $CopyMove = <<<COMO
"&COPY across|:syncbrowse" #804;
"&MOVE across|:syncbrowse" #803;
"&Dumpster|:moveto" moveto "V:\Repository\Misc\Dumpster";
COMO;

     if (exists("<curitem>") == 1) {
	     if(gettokenindex("<curext>", "jpg|gif|png|ico", '|', 'i')) {load "$image;<crlf>-<crlf>$CopyMove", ,s; end(1)}   //load Image and CopyMove menus together
	     if(gettokenindex("<curext>", "avi|mp4|wmv", '|', 'i')) {load "$vid", , s; end(1)}    //load video menu
	     if(gettokenindex("<curext>", "ini|txt|nfo|inf|reg|ps1|vbs", '|', 'i')) {load "$txt", , s; end(1)}   //load textfile menu
        if(getpathcomponent("<curitem>", "ext") == "xys") {load("<curitem>"); end(1);}  //no menu - example showing how you can automatically run an XY script on a right click on white
        if(getpathcomponent("<curitem>", "ext") == "ahk") {openwith "D:\Tools\NotePad++\notepad++.exe"; end(1);}   //no menu - example to open an AHK file for editing
		}
	  elseif(exists("<curitem>") == 2) {
	     perm $folder = "<curitem>";
        load "$dir", , s; end(1)
     }
	  #564; end(1);      //load Favorite Files, Favorite Folders, or whatever script you want here if the above conditions/comparisons are not met
 
"_Terminate";
  unset $folder;  //you don't need this line or "_Terminate"; if you don't use variable $folder above
I hope you can get some use out of it or maybe some new, additional or better ideas will spawn from it. Once set-up, I'm finding easier to use than the normal context menu.
Thanks,
Ken

Edit1: Modified the script to use SC gettokenindex rather than LikeI comparisons as per PeterH suggestion.
Edit2: Modified the "load" statement that uses the variable '$image' to show how to display 2 menus together (i.e., the Image menu and Copy move menu) as one menu with a separator between them

I don't have those two lines that are suppose to be edited in the xyplorer.ini file, in my xyplorer.ini file ?

This is great because I always wanted to take the custom toolbar and all the default buttons and put them in a context menu such as this. :)

klownboy
Posts: 4403
Joined: 28 Feb 2012 19:27
Location: Windows 11, 25H2 Build 26200.7171 at 100% 2560x1440

Re: [Script] WhiteSpaceCtxMenu

Post by klownboy »

Hey CookieMonster, if you look or search through XYplorer.ini make sure you search for CEA_ListRightClickOnWhite because the value assigned after the = sign is probably different. I should also ask, are using the full version (i.e., not the free version)?

CookieMonster

Re: [Script] WhiteSpaceCtxMenu

Post by CookieMonster »

klownboy wrote:Hey CookieMonster, if you look or search through XYplorer.ini make sure you search for CEA_ListRightClickOnWhite because the value assigned after the = sign is probably different. I should also ask, are using the full version (i.e., not the free version)?
The value was 6, BTW, what is 6, before I change it ? :)

bdeshi
Posts: 4256
Joined: 12 Mar 2014 17:27
Location: Asteroid B-612
Contact:

Re: [Script] WhiteSpaceCtxMenu

Post by bdeshi »

6 means run a script. All values are explained in the comment above the tweak key.
Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]

CookieMonster

Re: [Script] WhiteSpaceCtxMenu

Post by CookieMonster »

Sorry, the tweak key ?
SammaySarkar wrote:6 means run a script. All values are explained in the comment above the tweak key.

bdeshi
Posts: 4256
Joined: 12 Mar 2014 17:27
Location: Asteroid B-612
Contact:

Re: [Script] WhiteSpaceCtxMenu

Post by bdeshi »

klownboy wrote:Hey CookieMonster, if you look or search through XYplorer.ini make sure you search for CEA_ListRightClickOnWhite because the value assigned after the = sign is probably different. I should also ask, are using the full version (i.e., not the free version)?
CEA_ListRightClickOnWhite is the key, and it's also a tweak. And if you find it in XYplorer.ini, the line above it describes possible values and what each value does.
Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]

CookieMonster

Re: [Script] WhiteSpaceCtxMenu

Post by CookieMonster »

It only shows up to 4, not 5, or 6 or higher, if higher exists ?

Code: Select all

Tweak: 0=Favs, 1=Favs Full, 2=Drives, 3=Drives+Special, 4=Tabs
CEA_TreeRightClickOnWhite=0

Code: Select all

; Tweak: 0=Edit menu, 1=Folder's shell menu, 2=Favorites, 3=reserved, 4=Tabs
CEA_ListRightClickOnWhite=0

bdeshi
Posts: 4256
Joined: 12 Mar 2014 17:27
Location: Asteroid B-612
Contact:

Re: [Script] WhiteSpaceCtxMenu

Post by bdeshi »

download the latest beta, [install and] open it, and save settings at least once.
Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]

CookieMonster

Re: [Script] WhiteSpaceCtxMenu

Post by CookieMonster »

I don't like to use beta :(
Can't I copy and paste a xyplorer.ini file from someone else and place it into my xyplorer.ini ?

bdeshi
Posts: 4256
Joined: 12 Mar 2014 17:27
Location: Asteroid B-612
Contact:

Re: [Script] WhiteSpaceCtxMenu

Post by bdeshi »

Your XYplorer version has to support the feature don't you think?

btw, wait for the next beta version to be released.
Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]

TheQwerty
Posts: 4373
Joined: 03 Aug 2007 22:30

Re: [Script] WhiteSpaceCtxMenu

Post by TheQwerty »

The script CEA was added in v14.80.0242 so it is in the current stable.

If your INI file does not include the
CEA_TreeRightClickOnWhite_Script or CEA_ListRightClickOnWhite_Script keys
or
The comments for CEA_TreeRightClickOnWhite and CEA_ListRightClickOnWhite do not list the '6=Script' option

Then one of the following is true:
1) You're running a version earlier than v14.80.0242.
2) You have XY configured to not save on exit and haven't saved the INI file since upgrading to v14.80.0242 or newer.

If #1 then you can't use this until you upgrade to v14.80.0242 or newer.
If #2 then you can add the key/value yourself or save your configuration in XY to see them.

CookieMonster

Re: [Script] WhiteSpaceCtxMenu

Post by CookieMonster »

If #2 then you can add the key/value yourself or save your configuration in XY to see them.
When you say, save your configuration in XY to see them, do you mean, simply saving the xyplorer.ini files then re-loading xyplorer.ini in an editor and I should see all the way up to, including option=6, if there is not more ? If this is the case, I have done just that, using save settings, and reloaded the xyplorer.ini file in an editor and it continues to list up to only 4 ?

TheQwerty
Posts: 4373
Joined: 03 Aug 2007 22:30

Re: [Script] WhiteSpaceCtxMenu

Post by TheQwerty »

Under Help select Various Information.
In the resulting dialog select Copy.
Paste the results in a reply.

CookieMonster

Re: [Script] WhiteSpaceCtxMenu

Post by CookieMonster »

You want me to post, the help menu commands ? :?

RalphM
Posts: 2047
Joined: 27 Jan 2005 23:38
Location: Cairns, Australia

Re: [Script] WhiteSpaceCtxMenu

Post by RalphM »

No!
"Help/Various Information" lists the version of your XY and some other info which might be helpful in solving your problem!
Ralph :)
(OS: W11 24H2 Home x64 - XY: Current x32 beta - Office 2024 32-bit - Display: 1920x1080 @ 125%)

Post Reply