Page 1 of 1
How to detect that button was right clicked in a script
Posted: 14 Mar 2021 15:16
by Horst
The subject says it all.
I have assigned the same script to the left and right click of a button.
In the script I want to check if there was a right click ?
Re: How to detect that button was right clicked in a script
Posted: 14 Mar 2021 15:43
by highend
<get trigger mousebtn>...
Re: How to detect that button was right clicked in a script
Posted: 14 Mar 2021 16:01
by klownboy
highend beat me to it, but a bit more on it...
Code: Select all
// determine if the action was initiated via CTB (or not like a User Defined Command) if you want the same script to be used for UDC you can make a distinction
// you can also use the newer Get('Trigger', 'context') to determine how the script was invoked see Help - Scripting Commands Reference - "get"
$inCTB = Get('Trigger', 'CTBIndex') > 0;
// determine if a modifier key is held down while clicking in case you want a different action if a modifier is held down
$mod = get("shift");
if ($inCTB) {
//determine if the click is right "2" or left "1" - see Help - Scripting Commands Reference - "get"
$trigger = get("trigger", "mousebtn");
}
else {
$trigger = "0";
}
if ($trigger == "2") {
state your Right click actions here;
}
if ($trigger == "1") {
state your left click actions here;
}
Re: How to detect that button was right clicked in a script
Posted: 14 Mar 2021 16:13
by Horst
highend wrote: ↑14 Mar 2021 15:43
<get trigger mousebtn>...
Thanks again for your always helpfull tips.
I made a script which uses the new Everything content search function.
The normal Everything search on left click and the content search on right click of a button.