If I select multiple files and combine a script command and a regular command in a button like this:
MyScriptCommand "{f}"
SetAttr ATTR=+a "{f}"
The script command runs only once, while the internal will be called multiple times.
Is there a way to make the script command also run as often as there are selected items (so {f} will be resolved new each time)?
No response yet. I guess you think: "What weird and useless request is that?" o) So I'll explain some more..
I use the "Say" add-in quite often e.g., to debug buttons and print affected items to the script console.
But as said, whenever multiple items are selected, only the first item will be printed to the console by "Say".
The reason is, that only one fully resolved command-line gets through to the script command and its .cmdline property.
Say Processing file: {f}
SetAttr ATTR=+a "{f}" Yesterday I got an idea to get around that and whoop, it works! o)
By creating a simple "ForEach" user-command and using that to invoke the script command..
the latter will be called multiple times and each call to it results in a properly resolved .cmdline and all the codes contained.
I use it like this, just prefix the regular call to the script command with "ForEach CMD=".