Commands in custom button are not working

Discuss and share scripts and script files...
Post Reply
zBernie
Posts: 179
Joined: 08 Dec 2016 17:20

Commands in custom button are not working

Post by zBernie »

I create a custom button, and pasted the code below into the left click box. The code was copied from this forum. However, when I click the button, instead of a message box being displayed, the variables are displayed over the button, like in the screen capture shown below. Not sure what I am doing wrong here. Any suggestions would be appreciated.

$var_file = "<curname>";
$var_User = "%USERNAME%";
$var_DATE = "<date>";
msg " $var_User has selected <crlf 2>$var_file<crlf 2>at $var_DATE";

Capture.PNG
Capture.PNG (13.66 KiB) Viewed 2323 times

highend
Posts: 13274
Joined: 06 Feb 2011 00:33

Re: Commands in custom button are not working

Post by highend »

Please read
"Advanced Topics - Scripting - Multi-line Scripts and Multi-Scripts"

Your indentation is wrong
One of my scripts helped you out? Please donate via Paypal

zBernie
Posts: 179
Joined: 08 Dec 2016 17:20

Re: Commands in custom button are not working

Post by zBernie »

Thank you, that was driving me nuts! So all lines after the first must be indented by at least one space.

One other issue related to the custom buttons, I placed the correctly indented code snippet into the "Test" button shown in the screenshot below. However, I found that after I edited and added the code snippet, I am unable to edit the button again. If I right click on "Test", there is no option to edit it. :arrow: How can I edit a button which has scrolled off the toolbar like the "Test" button shown in the screenshot?

-Thanks

Capture.PNG
Capture.PNG (14.7 KiB) Viewed 2307 times

highend
Posts: 13274
Joined: 06 Feb 2011 00:33

Re: Commands in custom button are not working

Post by highend »

Hold Ctrl when you right click it
One of my scripts helped you out? Please donate via Paypal

zBernie
Posts: 179
Joined: 08 Dec 2016 17:20

Re: Commands in custom button are not working

Post by zBernie »

Thanks again!

Despite a few growing pains, I am loving XYPlorer! I just purchased a license last night. I have evaluated several other file managers, and can honestly say XY is the best in it's class! It does everything I want in a file manager, and so much more. Once I become more proficient with scripting, the proverbial sky is the limit!

-Bernie

zBernie
Posts: 179
Joined: 08 Dec 2016 17:20

Re: Commands in custom button are not working

Post by zBernie »

highend wrote:Hold Ctrl when you right click it
It still does not let me edit the custom button when I hold the Ctrl key. Tried other key combinations as well. I have an HP Envy laptop with trackpad, and I'm using a two finger tap, which is a right click.

highend
Posts: 13274
Joined: 06 Feb 2011 00:33

Re: Commands in custom button are not working

Post by highend »

Maybe that's because of this "special click" which is translated to a (software) right click through your touchpad software. It does work with real mouse buttons though
One of my scripts helped you out? Please donate via Paypal

klownboy
Posts: 4109
Joined: 28 Feb 2012 19:27

Re: Commands in custom button are not working

Post by klownboy »

Control-right click also works on laptops with buttons for left and right clicks. Though I think many of the newer laptops don't have those buttons anymore.
Windows 11, 22H2 Build 22621.1555 at 100% 2560x1440

zBernie
Posts: 179
Joined: 08 Dec 2016 17:20

Re: Commands in custom button are not working

Post by zBernie »

klownboy wrote:Control-right click also works on laptops with buttons for left and right clicks. Though I think many of the newer laptops don't have those buttons anymore.

Thanks, I got it to work by using Ctrl then tapping one finger, not two.

zBernie
Posts: 179
Joined: 08 Dec 2016 17:20

Re: Commands in custom button are not working

Post by zBernie »

highend wrote:Maybe that's because of this "special click" which is translated to a (software) right click through your touchpad software. It does work with real mouse buttons though

Thanks, I got it to work by holding Ctrl then tapping with one finger, not two.

Post Reply