Page 1 of 1

Scripts on buttons

Posted: 05 Mar 2022 16:47
by oblivion
I have a couple of user defined buttons that invoke scripts.

Since the most recent update, (22.90.0100) instead of the button just invoking the script , it displays the first line, you click on that, it shows the whole script and the line you click on gets run...

Have I done something, or is this a bug?

(As a specific example, I have a button for Opus-style dual pane activation / deactivation that's worked fine for years:

Code: Select all

if !get("#800") {  //checks Dual Pane status
 #810;}   // go to dual pane if not already or you could get the active pane first, $a_path = get("path", a) and use it instead of <curpath>
 else {#800;}   //goes back to single pane if already in Dual Pane
And now, it doesn't work. :(

Re: Scripts on buttons

Posted: 05 Mar 2022 16:52
by oblivion
...although the default dual pane button might now act the same way the script does, so maybe it's a bad example!

Re: Scripts on buttons

Posted: 05 Mar 2022 17:20
by jupe
Yeah there has been a heap of changes with CTB's, one way to fix it would be to edit each button and add this on the first line by itself: //S eg: here is how your example button script would look:

Code: Select all

//S
if !get("#800") {  //checks Dual Pane status
 #810;}   // go to dual pane if not already or you could get the active pane first, $a_path = get("path", a) and use it instead of <curpath>
 else {#800;}   //goes back to single pane if already in Dual Pane

Re: Scripts on buttons

Posted: 05 Mar 2022 17:50
by oblivion
Thanks!

Re: Scripts on buttons

Posted: 07 Mar 2022 10:40
by admin
Yep, there has been a heap of changes with CTB's. But full backward compatibility is still the goal, and we're coming nearer step by step. In the next beta your script will work again without any changes.

Re: Scripts on buttons

Posted: 07 Mar 2022 16:08
by jupe
Yeah I assumed that would be the goal, but what about using single CID's requires a closing semicolon now (or prefix), it has already come up a few times, and I can imagine it being asked about more in the future.

viewtopic.php?f=3&t=24280

Re: Scripts on buttons

Posted: 07 Mar 2022 16:48
by admin
Do they? I think I fixed that some days ago.

Re: Scripts on buttons

Posted: 07 Mar 2022 16:58
by jupe
Not fixed for me in .0106, it pops a menu like this:

viewtopic.php?p=196769#p196769

Re: Scripts on buttons

Posted: 07 Mar 2022 17:15
by admin
Ah, if it's the only item it indeed doesn't work yet.

Re: Scripts on buttons

Posted: 10 Mar 2022 02:06
by jupe
Was it an intentional change to make word wrap always enabled when editing multi-line CTB's scripts now?

Re: Scripts on buttons

Posted: 10 Mar 2022 08:46
by admin
Not really. On 20220221 I went for a nicer dialog with header and icon, and did not think much about the word wrap. Actually I recycled some code from "Customize Menu..." in the Breadcrumb Bar, which is also always with word wrap enabled (but here the checkbox is not even shown so you cannot turn it off).

So, I guess the way to go is: Show the "word wrap" checkbox in both instances, and remember the setting. I think it's ok to share that setting between Breadcrumb Bar "Customize Menu..." and CTB "Edit...".