I'm writing a Script Add-in which defines an internal script command so it can be used with a button. Unfortunatly, when I click the button the command only runs on the first of all selected files. I've tried several options (@async / @sync), but nothing works. To test if this is some kind of bug, I've created a bare script called "ScriptTest.js" in the users "AppData\Roaming\GPSoftware\Directory Opus\Script AddIns" directory:
function OnInit(initData) {
var cmd = initData.AddCommand();
cmd.name = "ScriptTest";
cmd.method = "OnScriptTest";
cmd.template = "FILE/K";
}
function OnScriptTest(funcData) {
DOpus.OutputString(funcData.func.args.file);
}
When I create a button with the function "ScriptTest FILE {f!}", it only logs the name of the first file, the function isn't called for all the other files which are selected...
I'd really appreciate it if someone can explain to me how to fix this?