Code: Select all
sel [position/pattern], [count], [label]
Code: Select all
sel [position/pattern], [count], [label]
Yes, goto/labels will be part of S2.graham wrote:you mentioned before that scripting might have ability to branch or jump within a script so, added to this, I would like for sel command to have a parameter that branches if the selection was false.
so if a sel command fails then one can jump to a label within the script and thereby miss out some of the script commands.Code: Select all
sel [position/pattern], [count], [label]
Well, it's already been said that Don had functions in mind, so so commands could be turned into functions easily, and with conditions it will all be up to us/the script...PeterH wrote:...but I think, instead of providing something like error-labels on commands, it would be better if commands set a returncode. You can test it and branch where you want.
And, for example, if a cmd sets different RCs for (e.g.) AllDone, SomeDone, NothingDone, ParmError, FileNotFound, ..., you could select what to react on. Else you had to specify 10 error-labels for one command...
Of course, there's also this possibility:jacky wrote:Well, it's already been said that Don had functions in mind, so so commands could be turned into functions easily, and with conditions it will all be up to us/the script...PeterH wrote:...but I think, instead of providing something like error-labels on commands, it would be better if commands set a returncode. You can test it and branch where you want.
And, for example, if a cmd sets different RCs for (e.g.) AllDone, SomeDone, NothingDone, ParmError, FileNotFound, ..., you could select what to react on. Else you had to specify 10 error-labels for one command...
Yeah, of course if you don't want to wait there's always thatadmin wrote:Of course, there's also this possibility:
http://88.191.26.34/computers_are_fun/2 ... g-further/
Not sure what you need to do exactly, but adapting a little the example given there, you can do this :graham wrote:Bloody Hell! Very clever, but too clever for me - Regexp illiterate!
Code: Select all
"Example"
// script begins here...
// select next text file on List
sel "[*.txt]";
// now we check if it worked or not
regexreplace $next, <curname>, "^$", "_noItem";
regexreplace $next, $next, "^((?!_noItem).)*$", "_Item";
sub $next;
"_noItem"
// script continues here when sel "failed" (no file selected)
msg "Selection failed !";
"_Item"
// script continues here when a file was/is selected
msg "Selection success : <curname>";