Custom User Button - trigger problems

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
Papoulka
Posts: 455
Joined: 13 Jul 2013 23:41

Custom User Button - trigger problems

Post by Papoulka »

This is with v15.40.003.

I'm trying to create a User Button on the toolbar that will have two possible actions:
  • If left-clicked it will insert "0" at the beginning of currently selected filenames.
    If right-clicked it will insert "0 " (that is 0 followed by a blank).
My button script is:

Code: Select all

$trig = get("Trigger");
 if ($trig == 1) {
  rename r, "^ > 0";
  }
  elseif ($trig == 2) {
   rename r, "^ > 0 ";
  }
And I have set the tweak:

Code: Select all

CTBNoRClickDefaultCommands=1
However - despite the tweak, a right-click on the button opens the "Click / Edit / Customize" menu. So I can't even get started with the right-click action.

This tweak worked for me a few weeks ago, but not now. Others have also occasionally found this tweak not working, but there was no resolution. Is there another setting or tweak that could be confusing the issue?

And I want to renew my wish for get("Trigger") to return more conditions such as "Shift" and "Alt"" at least. That would multiply the usefulness of the User buttons.

Thanks
Last edited by Papoulka on 28 Jun 2015 21:26, edited 1 time in total.

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

Re: Custom User Button - trigger problems

Post by klownboy »

Hi Papoulka, the little script worked fine for me. Did you put the script in both the "On left click" and "On right click " fields? Another way to do it would be to make a script file (e.g., prependZero.xys) with your script contents and then put, load("<xyscripts>\prependZero.xys"); in both the left and right click fields. I like that wish as well, at least for shift and alt. Control could be a problem to get at the CTB edit dialog.

Papoulka
Posts: 455
Joined: 13 Jul 2013 23:41

Re: Custom User Button - trigger problems

Post by Papoulka »

Did you put the script in both the "On left click" and "On right click " fields?
No, I hadn't... :oops: Worked fine when I did... Thanks for thinking of such an obvious mistake because I make lots of those.

I agree with your point that detecting a "Ctrl" click would only raise problems so I'll edit my post to remove that.

Post Reply