JavaScript Home


What is JavaScript and Why Use It In LogicWorks?

JavaScript is a standard language widely used for creating interactive applications on the World Wide Web. The language is a scripting language based on Java, which is itself based on C++, so the general format and syntax will be familiar to anyone who has used any of those languages. As a scripting language, JavaScript has much more flexibility than an application programming language. This allows quick development of scripts for a wide variety of small to medium-sized applications.

As implemented in LogicWorks, JavaScript gives access to essentially every program data element and function, as well as access to the web-development facilities such as HTML, links, controls and images. This combination is extremely powerful, allowing quick user development of significant new functionality such as:

  • simple or extensive data display and entry boxes (“property sheets”) to allow users to view and display design data using the full power of HTML, including links to outside resources on the web
  • import and export of any type of design data using the power of a general-purpose programming language
  • new menu commands and functions, such as searching for and updating attribute values, saving and backing up files, creating symbols based on given parameters, organizing and updating libraries, etc.
  • linking design data to local or remote databases or web services
  • creating and connecting circuit and design elements using script facilities

Where are JavaScripts Used?

In LogicWorks, JavaScript code can be used in two different environments:

  • JavaScript can be stored in a standalone text file (with the file extension DWJ) and can be run on command by the user. Scripts can be run by either directly opening the script file and selecting the Run command, or they can be executed in response to custom menu items or started as a result of specific user actions, such as double-clicking on a device on the diagram. When used in this mode, JavaScript has access to all the objects and methods implemented by LogicWorks, but, since it is not running within Internet Explorer, it does not have access to the typical web objects, such as documents and controls.
  • JavaScript can also be used to add functionality to HTML pages that are displayed within LogicWorks. When used in this mode, JavaScript is running inside an instance of Internet Explorer, so it has access to the full range of objects designed for creating web pages, such as HTML structural elements and controls. In addition, scripts can access the objects implemented in LogicWorks.

Click here for more information on where scripts are stored and the various ways they can be invoked.

How Do You Get Started With JavaScript in LogicWorks?

The JavaScript language itself is standardized and various documents are available describing the basic structure and syntax. LogicWorks actually uses the script engine used by Internet Explorer, so the basic structure is guaranteed to be the same.

    NOTE: JavaScript is supported by Microsoft using the name JScript, so use the latter name when searching for Microsoft documentation on this subject.

For an introduction to the language, go to the User’s Guide or the Language Reference available on the Microsoft web site.

    NOTE: Pages on the Microsoft site are moved and renamed frequently. If this link doesn’t work, then search for “JScript User's Guide” or “JScript Language Reference”.

To get started with using JavaScript in LogicWorks:

  • See the section LogicWorks Object Model for an overview of the objects and methods available inside LogicWorks.
  • See the Examples section where we break down some sample scripts in detail.
  • See the How to Invoke a Script section for more information on the ways script execution can be integrated into the LogicWorks pacakge.
  • Refer to the example scripts provided with the package in the Utility Scripts folder.



[JavaScript Home] [LogicWorks Object Model] [Examples] [The Browser Panel & HTML Dialogs] [Invoking a Script]