# Executing Scripts

Scripts written in the In-Sight 3D IDE may be executed in the vision system or in a web browser. Depending on where the script is executed, the following conditions and properties apply to scripts.

Script Type | Description
WebPage HMI Scripts | WebPage HMI scripts are based on WebPages HMI Scripting. These can include, for example, the On Click event handler script of a Button web page element. Such scripts share the following common properties: Their code is edited in the Script Editor. Tags are stored at the beginning of the script; if the tag value is updated by another component of the system while the WebPage HMI script is being executed, that change will not affect the tag’s value within the WebPage HMI script. After the WebPage HMI script completes, the updated tag value will be written back to the tag, and will overwrite any other changes to the tag while the WebPage HMI script was executing. The use of Promises within the code is supported, and can be used to get the return value of a script and execute any dependent script code. Note: Currently, the Script Editor will not raise compile errors when JavaScript code uses Promises in vision system scripts. Likewise, the editor will not raise warnings in HMI Web Scripts where the use of $ Functions with a Promise may be preferred. For more information on Promises see the WebPages JavaScript Promises topic. The execution of $ Functions and the updating of tags within WebPage HMI scripts are asynchronous to the project being run on the vision system. There are two different mechanisms for handling asynchronous script execution: For processes that are tied to controlling parts of the application, bundle the commands in scripts that execute on the vision system. Promises can be used to not only force an order of execution, but can also be used to handle values returned from commands executed on the vision system. For example, if you wanted to perform a diagnostics check on the vision system before displaying a message which is dependent on the returned diagnostic status, or performing an action on the vision system that must be completed before operators are allowed to interact with the HMI.