Open script file externally from ctb Edit dialog
Open script file externally from ctb Edit dialog
When using a custom toolbar button, more often than not, I'm loading a script file from one of the 'on click' fields as opposed to using multi-line script. But if I want to edit the script file, I have to open the button Edit dialog to see what the name of the script file is, close the Edit dialog, navigate to the script file and open it in a my text editor. What would be great is if there was the ability to open it in the text editor directly from the button Edit dialog (eg: a separate button, or maybe Ctrl-click on the Edit button). Would that be possible?
Windows 10 Pro 22H2
Re: Open script file externally from ctb Edit dialog
There could be a workaround.kiwichick wrote: ↑07 Aug 2022 07:17 When using a custom toolbar button, more often than not, I'm loading a script file from one of the 'on click' fields as opposed to using multi-line script. But if I want to edit the script file, I have to open the button Edit dialog to see what the name of the script file is, close the Edit dialog, navigate to the script file and open it in a my text editor. What would be great is if there was the ability to open it in the text editor directly from the button Edit dialog (eg: a separate button, or maybe Ctrl-click on the Edit button). Would that be possible?
Put the script file into the CTB name, and you will be able to refer it as ctbname() in the button scripts.
Then you can load it in the left click and open it by the run command in the middle click event.
Like this:
Re: Open script file externally from ctb Edit dialog
Thanks! What a neat idea. I'll definitely look into it.
UPDATE: I have my .xys files set to open in Notepad++ so all I needed to do was enter the open command for the script file into the click field. Easy peasy!
Code: Select all
open "<xyscripts>\MyScript.xys";
Windows 10 Pro 22H2
Re: Open script file externally from ctb Edit dialog
If you don't want to sacrifice anything, use this kind of structure. Click runs the script, Ctrl+Click opens it.
Code: Select all
//leftscript
$ctrl_pressed = get("shift") == 2;
if ($ctrl_pressed) {
open "<xyscripts>\MyScript.xys";
}
else {
load "MyScript.xys";
}
Re: Open script file externally from ctb Edit dialog
Oh my god, that is absolutely brilliant!!!!! I would never ever have thought of that. Thank you so muchLittleBiG wrote: ↑09 Aug 2022 07:58 If you don't want to sacrifice anything, use this kind of structure. Click runs the script, Ctrl+Click opens it.Code: Select all
//leftscript $ctrl_pressed = get("shift") == 2; if ($ctrl_pressed) { open "<xyscripts>\MyScript.xys"; } else { load "MyScript.xys"; }
Windows 10 Pro 22H2