Sparx Systems Forum
Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: thais on January 10, 2011, 06:24:42 am
-
Hello,
I want to write a Project Browser script in JScript and therefore I need inputs from the user.
How is it possible to write a input dialog box?
thanks!!
-
Unfortunately JScript has no intrinsic input box. You can use this trick though:
function InputBox( promptText /* : String */, title /* : String */, defaultText /* : String */ ) /* : String */
{
// JScript has no intrinsic InputBox method, therefore we have to steal VBs
var vbe = new ActiveXObject("ScriptControl");
vbe.Language = "VBScript";
return vbe.eval( "InputBox(\"" + promptText + "\",\"" + title + "\",\"" + defaultText + "\")");
}
Which creates a temporary VBScript engine, calls InputBox and returns the result to your JScript.