nanoCAD Platform Help

Script Editor (JS, VBS, LSP, DCL, SCR)

CAD drafting Script Editor (JS, VBS, LSP, DCL, SCR) 0    Ribbon: Manage – Applications > CAD software Script Editor (JS, VBS, LSP, DCL, SCR) 1 Script Editor

CAD drawing Script Editor (JS, VBS, LSP, DCL, SCR) 2    Menu: Tools – Scripts > CAD drafting Script Editor (JS, VBS, LSP, DCL, SCR) 3 Script Editor…

CAD software Script Editor (JS, VBS, LSP, DCL, SCR) 4 Command line: SCRIPTED

The built-in script editor allows you to create, edit and run batch files of various formats: ActiveX (.JS, .VBS), LISP (.LSP), DCL, SCR.

The script editor window is a functional bar, the title of which contains the name of the file being edited.

CAD drawing Script Editor (JS, VBS, LSP, DCL, SCR) 5

By default, the editor opens with an empty text field. When saving to a file later, specify a particular script format from the list of available ones.

You can make it so that when you call the script editor, the last script edited in it automatically opens. To do this, set the option to automatically open the last script in the ScriptEd options dialog of the script editor, described below.

CAD drafting Script Editor (JS, VBS, LSP, DCL, SCR) 6

 

 

Buttons

CAD software Script Editor (JS, VBS, LSP, DCL, SCR) 7

New File. Select the type of script in the drop-down menu.

CAD drawing Script Editor (JS, VBS, LSP, DCL, SCR) 8

Open Script. When you click on the button while holding down Ctrl key, a menu will appear with the list of the most recently opened scripts and folders.

CAD drafting Script Editor (JS, VBS, LSP, DCL, SCR) 9

CAD software Script Editor (JS, VBS, LSP, DCL, SCR) 10

Save Script.

CAD drawing Script Editor (JS, VBS, LSP, DCL, SCR) 11

Save As.

CAD drafting Script Editor (JS, VBS, LSP, DCL, SCR) 12

Undo.

CAD software Script Editor (JS, VBS, LSP, DCL, SCR) 13

Redo.

CAD drawing Script Editor (JS, VBS, LSP, DCL, SCR) 14

Find Text. Opens the collapsed Search and Replace bar.

CAD drafting Script Editor (JS, VBS, LSP, DCL, SCR) 15

Replace Text. Opens the expanded Search and Replace bar.

CAD software Script Editor (JS, VBS, LSP, DCL, SCR) 16

Run Script.

CAD drawing Script Editor (JS, VBS, LSP, DCL, SCR) 17

Options.

CAD drafting Script Editor (JS, VBS, LSP, DCL, SCR) 18

Help.

Options

The CAD software Script Editor (JS, VBS, LSP, DCL, SCR) 19 button opens the scrip editor dialog box. The options dialog can also be opened by combination of Ctrl+T buttons in the process of editing the script code. In this case, the cursor should be in the text field of the script editor.

CAD drawing Script Editor (JS, VBS, LSP, DCL, SCR) 20

 

The Font tab of the Options dialog allows you to configure font settings for each category of a specific programming language.

CAD drafting Script Editor (JS, VBS, LSP, DCL, SCR) 21

The Options tab allows you to configure general options for displaying the code in the edit window.

CAD software Script Editor (JS, VBS, LSP, DCL, SCR) 22

Options:

Tab size

Tab Size in spaces: the number of spaces to be inserted into a line when the Tab button is pressed on the keyboard.

Autoident

Enables/disables automatic indentation of a new code line identically to the indentation of the previous line.

Brace highlight

Highlighting the opening and corresponding to it closing brackets when the cursor is on one of them.

CAD drawing Script Editor (JS, VBS, LSP, DCL, SCR) 23

Restore last script

Automatic loading of the latest script when opening the editor.

Folding

Enables/disables the text-block folding node. Text blocks are detected automatically.

CAD drafting Script Editor (JS, VBS, LSP, DCL, SCR) 24

Style

Folding Node Style: Arrows, Plus/Minus, Circles, Squares.

White space marker size

The size of the white space marker in pixels. To enable the display of the space character, press CTRL+W on the keyboard.

CAD software Script Editor (JS, VBS, LSP, DCL, SCR) 25

Preserve encoding

Preserves the original encoding of the script file.

By default, the script editor uses UTF-8 encoding. All new scripts created in the script editor will have this encoding.

When opening a script file in the script editor, the encoding is determined automatically. If the Preserve encoding box is checked, then the script will be saved after editing in the same encoding it was in before opening in the script editor. If the checkbox is cleared, then the script will be saved in ANSI encoding (the current user encoding) after editing.

Find and Replace in Scripts

The script editor has several tools to quickly find the right part of the code:

·         Find and replace bar;

·         Bookmarks;

·         Panel for jumping to a line by its number.

 

Find and Replace Bar

To search for text in scripts, you can open the search bar in one of the following ways:

·         By clicking the CAD drawing Script Editor (JS, VBS, LSP, DCL, SCR) 26 Find text button in the script editor;

·         By the CTRL+F keys combination on the keyboard. In this case, the cursor must be in the text field of the script editor.

The search bar will appear at the bottom of the script editor below the script text edit field:

CAD drafting Script Editor (JS, VBS, LSP, DCL, SCR) 27

CAD software Script Editor (JS, VBS, LSP, DCL, SCR) 28

Find/replace mode switch button. When you click on the button, additional fields are opened for setting up the replacement of the found text. Clicking again hides additional fields.

CAD drawing Script Editor (JS, VBS, LSP, DCL, SCR) 29

Search pattern input field. You can enter single text characters, character sets, and regular expressions in the field. When you click on the CAD drafting Script Editor (JS, VBS, LSP, DCL, SCR) 30 button located in the right part of the field, this opens a list of the latest requests entered.

CAD software Script Editor (JS, VBS, LSP, DCL, SCR) 31

Find next. Pressing the button moves the cursor to the next match of the script text with those entered in the search pattern input field.

CAD drawing Script Editor (JS, VBS, LSP, DCL, SCR) 32

Use regular expressions. Regular expressions will be used to search for text in the script.

CAD drafting Script Editor (JS, VBS, LSP, DCL, SCR) 33

Match case. The search will take into account the case of the characters entered in the pattern field.

CAD software Script Editor (JS, VBS, LSP, DCL, SCR) 34

Match whole word. The search results will only display exact matches with the text entered in the search pattern field.

CAD drawing Script Editor (JS, VBS, LSP, DCL, SCR) 35

Close the bar.

 

To automatically replace text in a script, open the replacement bar in one of the following ways:

·         By clicking the CAD drafting Script Editor (JS, VBS, LSP, DCL, SCR) 36 Replace text button in the script editor;

·         By the find/replace mode switching buttonCAD software Script Editor (JS, VBS, LSP, DCL, SCR) 37 on the search bar;

·         By the CTRL+H key combination on the keyboard.

CAD drawing Script Editor (JS, VBS, LSP, DCL, SCR) 38

Elements of replacement bar to set the text replacement:

CAD drafting Script Editor (JS, VBS, LSP, DCL, SCR) 39

Replacement pattern input field. The field is intended for the text with which you want to replace the found text according to the pattern from the text search field. Clicking on the CAD software Script Editor (JS, VBS, LSP, DCL, SCR) 40 button on the right side of the field opens a list of the most recently entered replacement patterns.

CAD drawing Script Editor (JS, VBS, LSP, DCL, SCR) 41

Replace. Clicking the button replaces the found text in the current fragment of the text file.

CAD drafting Script Editor (JS, VBS, LSP, DCL, SCR) 42

Replace all. Clicking the button replaces all matches found in the text file that match the text search pattern with the text specified in the text replacement pattern.

 

Regular Expressions

A regular expression is a text search pattern that uses special characters to search for multiple spellings of an expression in a single search query.

To search for text in scripts using regular expressions, click the CAD software Script Editor (JS, VBS, LSP, DCL, SCR) 43 Regular expressions button on the search bar. Repeated clicking the button disables regular expression search.

The following special regular expression characters are allowed:

.

Replaces any character.

For example, the expression Layout.. will find all entries of the format Layout01,Layout02, Layoutaa, etc. in the script.

\

Escapes the character following it from being read as a special character.

For example, the expression Layout\... will find in the script all entries of the format Layout.01, Layout.02, Layout.aa, etc., that is, the dot character after Layout will not be recognized as a special replacement for any character.

[  ]

Inside square brackets, a set of options is specified, either as single characters or as ranges. It is not necessary to separate options with a space. When specifying a range, the start and end values are separated by a – sign.

For example, the expression [1-9] will find in the script all the numbers from 1 to 9, the expression [a-z] will find in the script all the characters from a to z, and the expression [ab1] will find in the script individual characters either a, or b, or a number 1.

*

Applied to a character in the text and says that this character can either be absent or repeated from one to several times.

For example, the expression Layout0*. will find entries of the form both Layout1 and Layout01, Layout001, etc.

+

Applied to a character in the text and says that this character can be repeated from one to several times.

For example, the expression Layout0+. will find entries of the format Layout01, Layout001, etc.

?

Applied to a character in the text and says that this character can either be absent or repeated only once.

For example, the expression Layout0?. will find in the text records of the forms Layout1, Layout01.

^

Negative symbol. Applies to the character to be excluded from the search results.

For example, the expression Layout.[^a-z] will find all entries in the script that contain the word Layout, followed by any character, and then any character other than the English letters from a to z.

$

End of line character. Applied at the end of the regular expression so that nothing extra is included in the search results.

For example, the expression Layout.[^a-z] will show Layout001 as a search result that matches the conditions, despite the fact that there is an extra character - 1 at the end. The expression Layout.[^a-z]$ will not include this entry in the search results.

More information about regular expression syntax can be found here.

Bookmarks

To move quickly between lines, you can use bookmarks. Bookmarks are displayed as red flags on the left vertical bar of the script editor window next to the corresponding lines of code:

CAD drawing Script Editor (JS, VBS, LSP, DCL, SCR) 44

You can bookmark aline in two ways:

·         by clicking the left mouse button on the bookmarks bar opposite the required line;

·         by placing the cursor on the required line and pressing the Ctrl+F2 key combination on the keyboard.

You can delete a bookmark in the same ways:

·         by clicking the left mouse button on the bookmark flag;

·         by placing the cursor on the line with a bookmark and pressing the Ctrl+F2 key combination on the keyboard.

You can delete all bookmarks at once by pressing CTRL+L.

To quickly jump between lines marked with bookmarks:

·         to go to the next tab, press F2 on the keyboard

·         to go to the previous bookmark, press SHIFT+F2.

Move to a Line by Number

To move to a script line by its number, open the corresponding bar in the script editor by pressing CTRL+G on the keyboard.

The bar will appear at the bottom of the script editor:

CAD drafting Script Editor (JS, VBS, LSP, DCL, SCR) 45

The bar elements:

CAD software Script Editor (JS, VBS, LSP, DCL, SCR) 46

The field shows which line the cursor is on.

CAD drawing Script Editor (JS, VBS, LSP, DCL, SCR) 47

A field for entering the number of the line to move to.

CAD drafting Script Editor (JS, VBS, LSP, DCL, SCR) 48

The total number of lines in the script.

CAD software Script Editor (JS, VBS, LSP, DCL, SCR) 49

Button to move to the desired line.

CAD drawing Script Editor (JS, VBS, LSP, DCL, SCR) 50

Close the bar.

 

Shortcuts

Many actions in the Script Editor are available through keyboard shortcuts. However, they work only during script editing, that is, when the cursor is in the script editing text field.

CAD drafting Script Editor (JS, VBS, LSP, DCL, SCR) 51

Select All

Ctrl+A

Copy

Ctrl+C, Ctrl+Ins

Insert

Ctrl+V, Shift+Ins

Cut

Ctrl+X, Shift+Del

Undo

Ctrl+Z, Alt+BackSpace

Redo

Ctrl+Y

Go to String

Ctrl+G

Find

Ctrl+F

Find Next

F3

Find Selected

Ctrl+F3

Replace

Ctrl+H

Open

Ctrl+O

Save

Ctrl+S

Save As

Ctrl+Alt+S

Properties

Ctrl+P

Run

Ctrl+R

Find the Matching Pair Bracket

Ctrl+{

Display/hide space characters

Ctrl+W

Set/unset bookmark in the line

Ctrl+F2

Move to the next bookmark

F2

Move to the previous bookmark

SHIFT+F2

Delete all bookmarks

CTRL+L

 

CAD software Script Editor (JS, VBS, LSP, DCL, SCR) 52

In the same dialog, you can also configure general options for displaying the code in the edit window.

 

Info: NanoCAD is a user friendly, low cost, and yet powerful, CAD application for Windows, that allows an outstanding user experience by providing top-level performance, full capability, a classic interface and native.dwg format support. nanoCAD has been built to deliver design and project documentation for all industries. nanoCAD includes a full suite of basic and advanced CAD tools for 2D/3D drafting and creating industry-standard DWG-compatible CAD files. Our program provides groundbreaking, collaborative and customizable features to raise your efficiency, and includes a few API's, allowing anything from routine task automation to complex CAD app development. You may download nanoCad for free, using the links below, and buy later, if you like it.
We collect Cookies
We use cookies to ensure that we give you the best experience on our website. By clicking “Accept”, you agree to our website’s cookie use as described in our Privacy Statement.