When hacking around in Try Script when you finally get something working there is no mechanism to save a script file from that dialog..
Regards.
m
Try Script - no mechanism to save script
-
admin
- Site Admin
- Posts: 65315
- Joined: 22 May 2004 16:48
- Location: Win8.1, Win10, Win11, all @100%
- Contact:
Re: Try Script - no mechanism to save script
Try Script is the same as Run Script, only with "step mode" enabled. Both interfaces are meant for throw-away scripts.
FAQ | XY News RSS | XY X
Re: Try Script - no mechanism to save script
I get your point, Granted "Try Script" is a pain to develop scripts, but its the only way to do it i.e. REPL. As "Run Script" has no real development benefit when creating / testing scripts. The "Try Script" dialog has the instruction "Enter Script to Try" i.e. start typing or copy / paste into the text box.
Its a multi step process because you either have to use a source for the commands webpage / notepad and create something to copy / paste or you start typing commands into the text box which you then have to copy out to notepad to be able to save it as .xys to save it to the folder C:\Users\marti\AppData\Roaming\XYplorer\Scripts if you can remember where it is or save it to a local folder and copy / move the .xys to the scripting folder via goto scripting folder.
I hope you can see my point.
Regards.
m
Its a multi step process because you either have to use a source for the commands webpage / notepad and create something to copy / paste or you start typing commands into the text box which you then have to copy out to notepad to be able to save it as .xys to save it to the folder C:\Users\marti\AppData\Roaming\XYplorer\Scripts if you can remember where it is or save it to a local folder and copy / move the .xys to the scripting folder via goto scripting folder.
I hope you can see my point.
Regards.
m
-
WirlyWirly
- Posts: 306
- Joined: 21 Oct 2020 23:33
- Location: XY 64-Bit | Win 10 @ 100% (3440x1440)
Re: Try Script - no mechanism to save script
Considering how limited that editor is, if you're writing complex scripts in there I think you're doing it wrong. That text-area is pretty much the equivalent of using notepad.
You can use the
Better yet, call the script directly from your editor through the command line
Scripts don't need to be in the
p.s
One of the best parts about XY is that it's portable, so you can keep the install and all your data in a single directory. Makes it a lot easier to find things and do backups, no digging through appdata and all that nonsense.
You can use the
step and unstep commands to add breakpoints from within your script. Run that .xys with a variety of options, such as a toolbar button with #751 or ::load(<selitem>) function. I have such a button, even made a fun little icon for it, which I've attached for anyone interested...Better yet, call the script directly from your editor through the command line
xyplorer.exe /script="C:\path\to\script.xys"Scripts don't need to be in the
<xyscripts> directory, that's just where XY will check if you don't provide a path when calling one.p.s
One of the best parts about XY is that it's portable, so you can keep the install and all your data in a single directory. Makes it a lot easier to find things and do backups, no digging through appdata and all that nonsense.
-
PeterH
- Posts: 2826
- Joined: 21 Nov 2005 20:39
- Location: DE W11Pro 24H2, 1920*1200*100% 3840*2160*150%
Re: Try Script - no mechanism to save script
Just to say: for often used scripts I directly use the XY-script folder.
For tests I created a subfolder \test there.
(More subfolders like \sub etc. can help on organization.)
For a test I create a file, say tst1.xys in <xyscript>\test.
Select this file in one pane - 'Enter' starts an editor on it.
(If not: assign one!)
When ready for a test: save the file,
then (with file still selected): exec Scripting/Load Selected Script File
To debug you can add as much step; commands as you want,
insert as much Echo as you need,
...
As you save the file for each test the last version is always available...
If a script is ok and often used: move it one level up.
Sometimes make a cleanup
I never need Try Script etc.
Have fun on scripting
For tests I created a subfolder \test there.
(More subfolders like \sub etc. can help on organization.)
For a test I create a file, say tst1.xys in <xyscript>\test.
Select this file in one pane - 'Enter' starts an editor on it.
(If not: assign one!)
When ready for a test: save the file,
then (with file still selected): exec Scripting/Load Selected Script File
To debug you can add as much step; commands as you want,
insert as much Echo as you need,
...
As you save the file for each test the last version is always available...
If a script is ok and often used: move it one level up.
Sometimes make a cleanup
I never need Try Script etc.
Have fun on scripting
Re: Try Script - no mechanism to save script
I find Try Script extremely helpful when coding. For one thing, I can access variable values without having to add and then remove "echo" commands.
Adding a "Save script" command would be hard because comments are not kept in this environment.
More valuable to me would be a live (always visible and updated each step) "Variables" window. I'm constantly re-opening that.
I think Don himself doesn't script much beyond 1-liners; which is understandable since he's coding 25/7. That's why these tools have gotten comparatively little attention. I doubt they have changed much since being introduced. When I was actively scripting, years ago, I often found them clunky for one small reason or another; though always adequate.
FYI in the AkelPad editor you can create a plugin (toobar button) which will feed the current script to XY and run it. Mine looks like this:
Of course you would change the XY path to match where you've got it.
Akelpad is great for XY coding, especially since FluxTorpedoe here has created a syntax highlighting add-on for it:
viewtopic.php?p=102360#p102360
Adding a "Save script" command would be hard because comments are not kept in this environment.
More valuable to me would be a live (always visible and updated each step) "Variables" window. I'm constantly re-opening that.
I think Don himself doesn't script much beyond 1-liners; which is understandable since he's coding 25/7. That's why these tools have gotten comparatively little attention. I doubt they have changed much since being introduced. When I was actively scripting, years ago, I often found them clunky for one small reason or another; though always adequate.
FYI in the AkelPad editor you can create a plugin (toobar button) which will feed the current script to XY and run it. Mine looks like this:
Code: Select all
"XYplorer..." Exec('"C:\XYplorer_p\XYplorer.exe" /flg=2 /script="%f"') Icon("C:\XYplorer_p\XYplorer.exe")Akelpad is great for XY coding, especially since FluxTorpedoe here has created a syntax highlighting add-on for it:
viewtopic.php?p=102360#p102360
XYplorer Beta Club