Sparx Systems Forum

Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: Rudi Claes on April 23, 2013, 08:25:26 pm

Title: Getting user input from a script
Post by: Rudi Claes on April 23, 2013, 08:25:26 pm
Hi,

is it possible to get user input from a script? I would like to get confirmation from a user to start a script.

In VBA this looks like:

iRet = MsgBox("Continue Y/N", vbYesNo, "Title")

In JavaScript, Session.Prompt works well for output, but I can't seem to get a response from Session.Input.

Any ideas on this one?
Title: Re: Getting user input from a script
Post by: Geert Bellekens on April 23, 2013, 08:46:32 pm
There's a Jscript example (Restore Baselines.js) that contains this:
Maybe it also works for JavaScript?

Code: [Select]
// This is a long operation and running it while testing is being done
// may have unexpected consequences.  So prompt the user before beginning.
if(Session.Prompt("Are you sure you want to restore all test data to baseline?", promptYESNO) == resultYes)
{
      Repository.ClearOutput("Script");
      RestoreBaselinesInCollection(Models);
}

Geert
Title: Re: Getting user input from a script
Post by: Rudi Claes on April 23, 2013, 09:05:33 pm
Does the trick  :) Thx!