Some things don't come easy to my personality type, such as stepping away from the computer. I get easily hung up on a problem, always thinking I am really close - it's gotta be this or that - almost there, just one more try ...
And that's the real reason why you can't get it working. Do you sometimes forget a name, e.g. "damn, what was the name of the guy in avatar" sam, sam... mh, can't remember. Do something different. The less you think about it, the earlier it comes to you. You're brain is trying to solve that riddle anyway

"worthington"! That's his name...
Sometimes you need to view a problem (a programming problem) from a different angle, from a new perspective.
Other things I've been doing already, like calling my workbench script via UDC-shortcut
I use Sublime Text and my "build" script calls XY with the current script (and /flg=2) again with alt + x. So while I'm developing it I just press the same shortcut in ST which automatically switches to XY and executes my script in the editor.
the instant feedback cannot tell you why you failed - whether it was syntax, logic, wrong method
The debug window that you get when you use the step command shows you how what your line does, how a variable is resolved / changed, etc. Stepping through the code reveals logic errors. For example it's a valuable resource when it comes to quoting. Just use a step; right before a run / openwith command. You'll see what XY tries to execute and if the real quoting is correct or if something's missing / just plain wrong.
Which assumes you're being aware of things like trailing spaces etc.
Let your editor help you
I did NOT expect it to be a SKILL that gets better by practicing.
But it's exactly that. A skill. Write a hundred small scripts. For the next 100 you don't need any more documentation. All the small scripts help you to build a up a library of small code blocks that you can use in larger / more complicated scripts to solve all the small things you've had problems with before.
I was convinced of you guys scripting XY in an offhand manner along the way
I'm not far away from this. It's a whole lot easier now to put programming logic into real code. You know what tools you have, how to use them, etc. When I wrote a script that should compare two lists of files my first attempt was to use two foreach loops (inner and outer one) that would compare each line from one file with all lines from the second one. Yeah, this works. Sure. But it's slow as hell if you have hundreds / thousands of files. Now I do this with one while loop and regexmatch / replace which is the fastest way possible (at least inside XY; other languages have better ways to do such things efficiently). That's one of the reasons that I write some stuff in other languages than in XY itself. Speed. Some things are very easy and very fast in XY but because there is no threading you'll block XY while it's working. One of the reasons why Extractor was written in AHK. I'd need less code in XY to do the same (feature wise) but I can't work with it while it's running (at least not if I want to retain the "select a directory after the process has finished" and things like that).
A last note:
Many things look complicated at the beginning. For you one of the things is quoting. Over time you'll notice that you can solve it by a general rule. Use three double quotes at the beginning if you have any variables that need to be resolved or if you need command line parameters.
That works for run / openwith / runret commands. And you can use it for eval() as well.
An example:
Code: Select all
$hstart = ("%osbitness%" == 64) ? "<xypath>\@Tools\HStart\hstart64.exe" : "<xypath>\@Tools\HStart\hstart.exe";
run """$hstart"" /UAC ""<curitem>""", , 2, 1;
The first line uses a ternary conditional. Just a short form of an if - else construct. Less lines to use.
The second line uses a run command.
Three starting double quotes. The variable of $hstart, close it with two double quotes. Whenever you have to resolve a variable (<curitem> in this case), surround it by opening and closing two double quotes. At the end you have to end close it with the last double quote (because you started with three at the beginning).
Add a step command before the run line.
Execute the script. Look at what XY shows in the debug window (how it resolves the quotes). All items inside this run command are correctly quoted so that they can contain spaces in their paths.
More examples:
Code: Select all
run """C:\folder with spaces\arc.exe"" /a ""<curitem>""", , 2, 1;
Code: Select all
run """C:\folder with spaces\arc.exe"" ""<curitem>""", , 2, 1;
Code: Select all
run """C:\folder with spaces\arc.exe"" /a", , 2, 1;
Code: Select all
run """C:\folder with spaces\arc.exe""", , 2, 1;
Do you see how it works?