Page 1 of 1

Custom User Button - trigger problems

Posted: 28 Jun 2015 19:37
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

Re: Custom User Button - trigger problems

Posted: 28 Jun 2015 21:15
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.

Re: Custom User Button - trigger problems

Posted: 28 Jun 2015 21:26
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.