-
Notifications
You must be signed in to change notification settings - Fork 35
The Console, Dialogs and Other Utilities
Phil Beauvoir edited this page Jul 20, 2018
·
15 revisions
Some script snippets assume that you run them on Archisurance.archimate. In this documentation, "object" is used for any type of information (ArchiMate concept or view, but also Canvas, Folders...).
Output can be sent to jArchi's Console window using the following functions:
console.show();
console.hide();
console.setText("Clear previous text and display this text");
console.log("Hello World");
console.log(object);
console.log("One thing: ", object, another, ...);
console.error(error);
console.clear();
console.setTextColor(redValue, greenValue, blueValue);
console.setDefaultTextColor();
window.alert("Hello World");
var response = window.confirm("Are you sure?");
var name = window.prompt("Please enter your name", "Default Name");
var filePath = window.promptOpenFile({ title: "Open Model", filterExtensions: [ "*.archimate" ], "default.archimate" });
var dirPath = window.promptOpenDirectory({ title: "Open Folder", "/defaultPath" });
var filePath = window.promptSaveFile({ title: "Save Model", filterExtensions: [ "*.archimate" ], "default.archimate" });
You can include other Archi script or JavaScript files:
load(absolute_path)
load(url)
There is no support for relative locations, so the following format is used:
load(__DIR__ + "path/file.js")
__DIR__ contains the absolute path of the directory containing the current script.
__FILE__ contains the absolute path of current script.
__LINE__ contains the line number in which __LINE__ is used.
If you value and use Archi please consider making a donation. Thanks!