Hide Table of Contents

Writing and Running Script Files

Use the LoadScript command to execute a sequence of commands from a script file.

Writing a Script File

You can write a script file with any text editor or word processing program that is able to store ASCII text format (without the addition of any formatting information).

To create a script file:

  1. Enter the commands and instructions and their corresponding input values into the file in the same order in that the instructions are to execute.
  2. Command execution takes place line-by-line or instruction-by-instruction when separated by a space. Either an end of line or space character is interpreted as confirmation of the previous entry.
  3. Save the file in plain text format as an .scr file.

Example

These lines define a script that sketches a Circle at the coordinates 5,5 with a radius of 10 drawing units:

Circle
5,5
10

An equivalent is (note the spaces):

Circle 5,5 10

Using the clipboard

You can write script files with the Copy and Copy History commands.

The command history window contains a list of program commands and data entries that you made during the program session. The history lets you reference and reconstruct the procedures you used.

To write script files by copying command history:

  1. Perform the command steps that you want to store.
  2. Type CommandHistory to open the separate command history window.
  3. Right-click and select Copy History.
  4. Open a text editor.
  5. Paste the command steps into the editor program.
  6. Save the file as an .scr file.

Running a Script File

To run a script file:

  1. Click Tools > Run Script (or type LoadScript).
  2. Select a script and click Open.

Access

Command: LoadScript

Menu: Tools > Run Script



Provide feedback on this topic

SOLIDWORKS welcomes your feedback concerning the presentation, accuracy, and thoroughness of the documentation. Use the form below to send your comments and suggestions about this topic directly to our documentation team. The documentation team cannot answer technical support questions. Click here for information about technical support.

* Required

 
*Email:  
Subject:   Feedback on Help Topics
Page:   Writing and Running Script Files
*Comment:  
*   I acknowledge I have read and I hereby accept the privacy policy under which my Personal Data will be used by Dassault Systèmes

Print Topic

Select the scope of content to print:




x

We have detected you are using a browser version older than Internet Explorer 7. For optimized display, we suggest upgrading your browser to Internet Explorer 7 or newer.

 Never show this message again
x

Web Help Content Version: 2024 SP05

To disable Web help from within SOLIDWORKS and use local help instead, click Help > Use SOLIDWORKS Web Help.

To report problems encountered with the Web help interface and search, contact your local support representative. To provide feedback on individual help topics, use the “Feedback on this topic” link on the individual topic page.