Open script file externally from ctb Edit dialog
-
kiwichick
- Posts: 673
- Joined: 08 Aug 2012 04:14
- Location: Windows 10 Pro 22H2, 150% scaling
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
-
admin
- Site Admin
- Posts: 66094
- Joined: 22 May 2004 16:48
- Location: Win8.1, Win10, Win11, all @100%
- Contact:
-
LittleBiG
- Posts: 1848
- Joined: 08 Apr 2011 12:57
- Location: Win10x64
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:
You do not have the required permissions to view the files attached to this post.
-
kiwichick
- Posts: 673
- Joined: 08 Aug 2012 04:14
- Location: Windows 10 Pro 22H2, 150% scaling
Re: Open script file externally from ctb Edit dialog
Windows 10 Pro 22H2
-
kiwichick
- Posts: 673
- Joined: 08 Aug 2012 04:14
- Location: Windows 10 Pro 22H2, 150% scaling
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
-
LittleBiG
- Posts: 1848
- Joined: 08 Apr 2011 12:57
- Location: Win10x64
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";
}-
kiwichick
- Posts: 673
- Joined: 08 Aug 2012 04:14
- Location: Windows 10 Pro 22H2, 150% scaling
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
XYplorer Beta Club