Leo/Anyone I have found this facility
https://www.gpsoft.com.au/help/opus11/index.html#!Documents/CLI.htm
This is exactly what I need for testing but I am having trouble with it
Is this still a suported facility?
Grateful for any reply if it is I will post my problem....
Thanks..
Yes. It wouldn't be documented if it wasn't supported.
If you're using Opus 12, note that you're looking in the Opus 11 manual. Some things will be slightly different. Update your URL to use "opus12" in the middle, or use the F1 help within the program itself.
The screenshot shows a sample script which demonstrates a popup dialog.
It works.
When I press play form the CLI tool in script mode as shown though nothing happens.
Am I doing something wrong?
Thanks as ever for any reply.....
All the code is in a function (OnClick) but when run from the CLI nothing calls that function.
Thanks Jon
What should I replace OnClick() with for testing pruposes?
Remove the first and last line entirely, just leaving the code you want to run.
OnClick is only called by Buttons, and used to pass the script a clickData argument with context about where the button is being run. None of that applies in the CLI, which is just for quickly running bits of code to test things out.
If you use JScript for scripting, which you should do before diving any deeper into VBS, then you could make use of this in the CLI-Tool. It builds the required clickData object and calls the OnClick() function in one go. So with this, you actually can edit (most) button codes directly in the CLI-Tool without removing or adding code from your actual button function. Just put your complete onClick() function and the snippet below into the CLI tool.
Notice: The snippet/simulator is not a replacement for the context the button editor provides, and it is more on the educational side of things. Still a nice showcase of why JScript is so much to be prefered compared to VBS. It's so much more flexible.
//button click simulation
OnClick(
function () {
var cmd = DOpus.Create.Command();
var lst = DOpus.Listers.lastactive;
cmd.SetSourceTab(lst.activetab);
return { func: {
args : { got_arg:{} },
command : cmd,
sourcetab : lst.activetab,
desttab : lst.dual ? lst.desttab : null,
fromdrop : false,
fromkey : false,
qualifiers : '',
viewer : null,
Dlg : lst.activetab.Dlg
} };
}()
);
Very neat @tbone
@jon @leo @tbone @aussieboykie thank you gents your help empowers me
I will take a while to absorb all this wonderful thank you again