4.72 FAQ-1195 Does Origin have a way to record macros and automate repetitive tasks?

Last Update: 6/12/2024

Note: Origin offers users the opportunity to automate repetitive tasks without the need for code. While coding is not necessary to enjoy the power of Origin's features, this page is for users who are interested in the programming features of Origin.

Programming in Origin

Origin allows users to run complex commands and functions without coding using GUIs and dialogs. However, it is designed to be a fully programmable software and includes built-in support for a variety of high-level languages.

Programming features allow users to customize, automate, and share their workflow. Some common applications include:

  • Creating new routines for the import, analysis, visualization, and export of data.
  • Automating repetitive tasks for large data sets or batch processing.
  • Performing numerical computations and simulations.
  • Building custom apps that can be shared with colleagues or on the Origin File Exchange.

Due to the number of languages running side-by-side in Origin, users have a variety of tools at their disposal to view the underlying code, command, and scripts in Origin. It should be noted that the features discussed on this page are primarily used to access LabTalk script, including X-Functions.

Control + Shift + Click

Users can click on most menu items, toolbar buttons, and Mini Toolbar features while holding Ctrl + Shift to (1) display the corresponding script in the Code Builder and (2) dump commands and other identifying information in the Script Window. A quick example of this can be found on our YouTube.

ECHO System Variable

Origin can use the Script Window to display commands, scripts and error messages that are processed when users change the value of the ECHO variable. By default, ECHO is set to zero to disable the display of commands.

To enable echo, type echo = Number in the Script window. Number can be one of the following:

Number Action
1 Display commands that generate an error
2 Display scripts that have been sent to the queue for delayed execution
4 Display scripts that involve commands
8 Display scripts that involve assignments
16 Display macros

ECHO can be set to any sum of these numbers to combine the options. For example, if echo = 7; Origin will display (1) commands that generate an error, (2) scripts that have been sent to the queue, and (4) scripts that involve commands. If echo = 31; Origin will display a combination of all five options listed in the table above.
Setting echo.gif

It is suggested for users to reset the variable so echo = 0; when they are finished.

A brief example showing how to use ECHO can be found in our documentation.

Generate Script

A very strong tool for automating processing and analysis is the Generate Script command, which can be found in most X-Function dialogs via the fly-out dropdown menu near the top of the window. This includes many of the actions performed on worksheets and graphs during analysis and visualization.
Generate script.gif

This feature is used to access underlying X-Functions in Origin.


The system variable @GAS controls how much information is displayed when using the Generate Script feature.
System Variable GAS Change.gif

A brief tutorial can be found in our documentation.

Automating with Code, Commands, and Scripts

Origin has multiple interfaces where users may enter code to automate or customize their work:

  • The Script Window offers an interactive textbox that runs only the highlighted script by pressing Enter.
  • The Command Window has a standard input panel and output panel and runs one line of code at a time by pressing Enter.
  • The Script Panel is used to apply code, commands, and scripts to a specific workbook or worksheet.
  • The Code Builder is the most robust code editor in Origin and allows files to be created and compiled, and includes debugging features.

Topics for Further Reading