Book a Demo

Author Topic: Getting user input from a script  (Read 5338 times)

Rudi Claes

  • EA Novice
  • *
  • Posts: 11
  • Karma: +0/-0
    • View Profile
Getting user input from a script
« 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?

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Getting user input from a script
« Reply #1 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

Rudi Claes

  • EA Novice
  • *
  • Posts: 11
  • Karma: +0/-0
    • View Profile
Re: Getting user input from a script
« Reply #2 on: April 23, 2013, 09:05:33 pm »
Does the trick  :) Thx!