WEBLOAD (Command)

Loads a JavaScript file from a URL, and then executes the JavaScript code contained in the file.

Prompts you to enter the name of a URL and JavaScript file. For example:

Command: WEBLOAD
Enter name of URL to load: https://website/filename.js

The JavaScript file must contain a function definition and an invocation of the function as shown in the simple example below.

// Function definition
function pickPoint() {
    function onComplete(arg) {
        var resObj = arg;
        if (resObj) 
            alert('You picked: ' + resObj.value.x + "," + resObj.value.y + "," + resObj.value.z);
    }

    function onError(arg) {
        alert('Error picking point: ' + arg);
    }

    var optionsFirst = new Acad.PromptPointOptions('Pick a point', new Acad.Point3d(0, 0, 0));
    Acad.Editor.getPoint(optionsFirst).then(onComplete, onError);
}

//Invocation of function
pickPoint();
Note: Any JavaScript function or AutoCAD JavaScript API function can be called. The one exception is the JavaScript prompt function, prompt(msg,defaultText).