Page 1 of 1

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

Posted: 09 Oct 2012 09:01
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.

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

Posted: 09 Oct 2012 09:29
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 :)