CTB left- and right-click scripts in the same script file?

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
kiwichick
Posts: 678
Joined: 08 Aug 2012 04:14
Location: Windows 10 Pro 22H2, 150% scaling

CTB left- and right-click scripts in the same script file?

Post by kiwichick »

Hi there, Is it possible? I have a few CTBs that use two scripts - one for the left-click and one for the right-click. Is it possible to have both in one script file. Can this been done with hidden scripts or will it only work if the left- and right-click execute a single script each? In my case the left-click executes a script, the right-click has a sub-menu of several other scripts.

For example, my Delete button:

left-click is the standard default action, it deletes the selected items.

right-click has submenu to:
delete everything
delete all files
delete all folders
delete all of the selected filetype
delete all but the selected filetype
delete all zip files

Cheers.
Windows 10 Pro 22H2

kiwichick
Posts: 678
Joined: 08 Aug 2012 04:14
Location: Windows 10 Pro 22H2, 150% scaling

Re: CTB left- and right-click scripts in the same script fil

Post by kiwichick »

OK, I've managed to get pretty close. My script my looks like this:

Code: Select all

"_delete"
   delete;
   
"Delete|:del : delete"
   sub "_delete";

"Delete everything|:nuke";
   Focus(List);
   sel a; 
   #169;

"Delete all of the selected FileType(s)|:del"
   Focus('List');
   #254;   // Select By Selected Type(s)
   delete(1 ,1 , ':list');

"Delete all except the selected FileType(s)|:del"
   Focus('List');
   #254;   // Select By Selected Type(s)
   sel i;
   delete(1 ,1 , ':list');
   
"Delete all Files|:del"
   Focus('List');
   sel f;
   delete(1 ,1 , ':list');   

"Delete all Folders|:del"
   Focus('List');
   sel f; sel i;
   delete(1 ,1 , ':list');   

"Delete all zip files|:del"   
   Focus('List');
   filter "*.zip";
   sel a;
   delete(1 ,1 , ':list');
   filter;
CTB on click:
load Delete, delete;

CTB on right-click:
load Delete;

But it means I have the left-click script visible in the right-click menu as well. Is there any way to avoid this?

Cheers again :)
Windows 10 Pro 22H2

Post Reply