DO11 Scripting - Support For Forms/Controls?

Does the VB scripting capability in v11 include support for popping up forms and responding to the user's action(s)? If so, a simple example script button would probably be enough to get me going.

Regards, AB

There's a Dialog object for requesting user input. It's near the bottom of Opus 11 Scripting Reference.xlsx

A very simple example of using it is in the example Paste File List script, although it just uses it for simple error reporting and doesn't take any user input (but the script shows how to get at the Dialog object):

ClickData.Func.Dlg.Request "Clipboard does not contain files or text.", "OK"

Thanks for the pointer. I should have spotted that myself.

Preliminary monkeying shows a positioning problem when more than 2 buttons are used in a dialog.



Test button code as follows..

[code]@script vbcript

' Just testing...

Function OnClick(ByRef ClickData)

Dim i

With ClickData.Func.Dlg
	.message = "Please click a button."
	.title = "Funky Dialog Title"
	.buttons = "Go|Stop|Quit"
	i = .show
	.message = "Button " & i & " was clicked."
	.buttons = "OK|Quit"
	i = .show
End With

End Function[/code]
Regards, AB

Further testing reveals another oddity. Maybe a VBScript thing?



I tried this with 2, 3, 4, 5 buttons. In each case, clicking the last button is reported as button 0 rather than 2, 3, 4, or 5. Other buttons are reported correctly as 1, 2, etc..

The relevant code..

[code]@script vbcript

' Just testing...

Function OnClick(ByRef ClickData)

Dim i

With ClickData.Func.Dlg
	.message = "Please click a button."
	.title = "Funky Dialog Title"
	.buttons = "One|Two|Three"
	i = .show
	.message = "Button " & i & " was clicked."
	DOpus.Outputstring .message
	.buttons = "OK|Quit"
	i = .show
End With	

End Function[/code]
Regards, AB

Yes this is by design, the last button is always designated "cancel" and as such returns 0.

Thanks Jon. The exception to that rule is when there is only a single button in which case it returns 1, not 0.

You didn't comment on the left shifted button positioning when there are more than 2 buttons. Bug?

Regards, AB

The convention (and this comes from Windows) is that if there's only one button then it's the OK button, which returns 1. If there are two then they are OK and Cancel (1 and 0), etc.

The layout problem when the buttons are wider than the text should be fixed in the next beta.