The SetupWizard guides the user through the installation. It provides tools for several purposes.
Create
var setupWizard = SetupWizard(InstallationType.APPS, applicationName, miniature);
or
var setupWizard = SetupWizard(InstallationType.ENGINES, applicationName, miniature);
The miniature can be retrieved like:
var appsManager = Bean("repositoryManager");
var application = appsManager.getApplication(["Applications", "Development", "Notepad++"]);
var miniature = application.getMainMiniature();
Presentation
Shows a default script presentation with information about the installed application, its editor, application homepage and the author of the script.
setupWizard.presentation(application, editor, applicationHomepage, scriptAuthor);
License
Message + license file:
setupWizard.licenceFile(message, filePath);
Message + license text:
setupWizard.licence(message, licenseText);
Show a message
To show a message and wait until the user clicks “Next”:
setupWizard.message(message);
Query user input
Text
Query text:
var userText = setupWizard.textbox(message);
Query text with default value:
var userText = setupWizard.textbox(message, default);
File
Query file:
var userFilePath = setupWizard.browse(message);
Query file with default directory and allowed file extension:
var userFilePath = setupWizard.browse(message, directoryPath, ["txt", "pdf"]);
Menu
Show a menu with items to select from:
var userChoice = setupWizard.menu(message, ["option1", "option2"]);
var selectedText = userChoice.text;
var selectedIndex = userChoice.index;
Show a menu with a default option:
var userChoice = setupWizard.menu(message, ["option1", "option2"], "option2");
Show progress
For a spinning wheel:
setupWizard.wait(message);
For a progress bar:
var progressBar = setupWizard.progressBar(message);
progressBar.setText(text);
progressBar.setProgressPercentage(0.);
You can find an example for the progress bar usage in the corefonts verb.
Close
Don’t forget to close the SetupWizard when the installation is finished:
setupWizard.close();