JavaScript scripts


You can save time by using a JavaScript script to automate a series of repetitive tasks. The Scripts docker (Tools Scripts Scripts) lets you load, run, rename, and delete scripts.

You can record scripts and save them for later use. You can also record temporary scripts for actions that you need to repeat only a few times. A temporary script is accessible until a new temporary script is recorded.

*

Before recording a script, make sure that you know exactly which actions you want to record and the order in which you want to record them. When you start recording, the script recorder captures every change that you make in a drawing. For example, if you create a shape, resize the shape, and then change its color, the script records all the changes. When you are done making the changes, you must stop recording the script.

You can perform the actions that are associated with a script by playing that script. You can also play a temporary script.

To load a script

Back to Top
In the Scripts docker, click Load, and then choose the folder where the script is located.

To record a script

Back to Top
1 Click Tools Scripts Start Recording.
The Record script dialog box appears.
2 In the Macro name box, type a name for the script.
3 In the Save Macro In box, click User Scripts.
4 Type a description of the script in the Description box, and then click OK.
5 Perform the actions that you want to record.
The application begins recording your actions. If you want to pause recording, click Tools Scripts Pause recording. Repeat this step to resume recording.
6 To stop recording, click Tools Scripts Stop Recording.

 

*

You can cancel recording a macro, and discard any commands recorded thus far, by clicking Tools Scripts Cancel Recording.

You can also record, pause, and stop recording a macro by using the Scripts docker (Tools Scripts Scripts).

 

To record a temporary script

Back to Top
1 Click Tools Scripts Record Temporary Script.
2 Perform the actions that you want to record.
The application begins recording your actions. If you want to pause recording, click Tools Scripts Pause Recording. Repeat this step to resume recording.
3 To stop recording, click Tools Scripts Stop Recording.

*

Not all actions can be recorded.

You can cancel recording a script, and discard any commands recorded thus far, by clicking Tools Scripts Cancel Recording.

You can also pause and stop recording a temporary macro by using the Scripts docker (Tools Scripts Scripts).

To play a script

Back to Top
In the Scripts docker, click the script in the list, and then click the Run button .

To play a temporary script

Back to Top
Click Tools Scripts Run Temporary Script.

*

This option is enabled only after you record a temporary script.

To edit a script

Back to Top
In the Scripts docker, click the script in the list, and then click the Edit button .
The script is usually displayed in Notepad. If the script fails to open, make sure to associate JavaScript files with Notepad. For more information, see To associate JavaScript files with Notepad.

To rename a script

Back to Top
In the Scripts docker, click the script name twice and type the new name.

To delete a script

Back to Top
In the Scripts docker, click the script in the list, and then click the Delete button .

To associate JavaScript files with Notepad

Back to Top
1 In File Explorer, right-click a JavaScript file, and click Properties.
2 On the General tab of the dialog box, click Change in the Opens with area.
3 Choose to open .js files in Notepad.

Was this page helpful? Send feedback.


Some features documented in the Help are available exclusively to subscribers. For more information about CorelDRAW subscription, visit coreldraw.com.