I've been trying to add both a kayword argument and a switch argument to my add-in script, but I must be doing something wrong. When I invoke my custom command without the switch argument, I can process the keyword argument just fine; when I add the switch, however, the keyword always comes up "undefined".
My command template looks like this:
cmd2.template = "ARTIST/K, REPLACE/S";
Here is the function code that processes the ARTIST argument:
var tag_to_add;
if (ScriptCommandData.func.args.got_arg.ARTIST) {
var tag_to_add = d.func.args.ARTIST;
DOpus.Output("Tag to add: " + tag_to_add);
}
else {
DOpus.output("ERROR: no artist argument found");
return;
}
When I call the function like this, it processes the argument correctly:
add_artist ARTIST=chet_baker
However, when I call the function like this:
add_artist ARTIST=chet_baker REPLACE
I get "ERROR: no artist argument found". I've tried different variations such as swapping the order of arguments, adding "/O" to the switch, removing the "=" -- nothing seems to work.