Page 1 of 1
Commands in custom button are not working
Posted: 10 Dec 2016 07:12
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
Re: Commands in custom button are not working
Posted: 10 Dec 2016 07:46
by highend
Please read
"Advanced Topics - Scripting - Multi-line Scripts and Multi-Scripts"
Your indentation is wrong
Re: Commands in custom button are not working
Posted: 10 Dec 2016 21:43
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.

How can I edit a button which has scrolled off the toolbar like the "Test" button shown in the screenshot?
-Thanks
Capture.PNG
Re: Commands in custom button are not working
Posted: 10 Dec 2016 22:10
by highend
Hold Ctrl when you right click it
Re: Commands in custom button are not working
Posted: 10 Dec 2016 22:28
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
Re: Commands in custom button are not working
Posted: 11 Dec 2016 04:16
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.
Re: Commands in custom button are not working
Posted: 11 Dec 2016 10:34
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
Re: Commands in custom button are not working
Posted: 11 Dec 2016 17:38
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.
Re: Commands in custom button are not working
Posted: 11 Dec 2016 23:50
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.
Re: Commands in custom button are not working
Posted: 11 Dec 2016 23:51
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.