3.3.2.64.3 Options to Create/Duplicate


-d

Syntax: window -d winName

Create a duplicate of the active window, then make the new window active.
If the winName is not specified, the new window is named Bookn or Graphn, etc. where n is the lowest available number.
This is similar to the -da option, but the new window becomes active. %H indicates the new window name.

-da

Syntax: window -da winName

Create a duplicate of the active window keeping the current window active.
If the winName is not specified, the new window is named Bookn or Graphn, etc. where n is the lowest available number.
This is similar to the -d option, but the original window stays active. User may find this option useful for example when a window should be duplicated for backup.

-dg

Syntax: window -dg winName

Duplicate the current graph window and convert to OpenGL:
Create a duplicate of the graph window with winName, or the active graph window if winName is not specified. In the new window, the 3D graph is converted to be OpenGL-based.

This is an example to duplicate and convert all graph window in the current project explorer folder:

doc -ef P //Execute for the given script for all graph objects in the current folder
{
 if(!layer.IS3DGL) // layer.is3dgl is used to determine whether current graph is 3d opengl graph
   {
	win -dg; //Duplicate and convert the current graph window to OpenGL
  }
}

-n

Syntax: window -n winType [winName]

Create a new window from scratch (not from a template) and name it winName.

  • If winType is data or wks, open a worksheet.
  • If winType is plot, open a graph window.
  • If winType is n, open a Notes window.
  • If winName is not specified, use the next available default name. (Graph1, Graph2, Book1, Book2, etc.)
Note 1:

This option is not recommended for creating graph windows.

Use the win -t command option instead. Because you can save most of the graph settings in the template. Default graph template is Origin.otp.

win -t plot MyTemplate Test;

Most of the layer commands in your script will be unnecessary.

Note 2:

After creating a worksheet with the win -n command, you must set the number of rows for the worksheet using the set -er command.

For more control over creating worksheets, use the win -t command or the create command and object.

-t

Syntax: window -t winType template [winName]

Create a new window from the template file.

  • If winType is p, open a graph (plot) window.
  • If winType is d or wks, open a worksheet window.
  • If winType is m, open a matrix window.
  • If winType is t, open the window type specified by the template file (requires file extension in template).

The window is named winName, or named by default (Graph1, Graph2, etc.) if winName is not given.
If winType, template, and winName are omitted, Origin opens a Bookn worksheet based on ORIGIN.OTW.

This command checks for a path in template and will use this path if specified.
If the path includes spaces, you must surround the path with quotation marks (" ").
For example, use win -t winType c:\MyDir\MyTemp winName to open a winType window based on the MyTemp template in the c:\MyDir directory. Name this window winName.

Use win -t winType MyDir\MyTemp winName to open a winType window based on the MyTemp template in the MyDir subdirectory of the User Files Folder (UFF) or EXE folder. Name this window winName. Whenever loading, it will search first on the UFF and then on the EXE folder.

Note1:

If you close the winName worksheet with the win -c command and then use this win -t command option to open a winName worksheet (where winName is the same with both command options), Origin's behavior is dependent on the value of the @wd system variable.

When @wd = 1, Origin deletes the datasets that remain from the win -c command and then opens the winName window.

When @wd = 0, #Command Error! prints to the Script window.

Origin does not delete the datasets that remain from the win -c command. Additionally, Origin does not open the winName window.


Note2: To open a "master page" from the Master.OTP template, use this command like the following:

win -t plot master master

More Examples:
This example opens a new worksheet from the FFT template (in the software directory) and names it by default (Book1, Book2, etc.).

win -t data FFT;

This example opens a graph window from the MASTER template located in the C:\MYOWN directory and names the window Master.

win -t plot c:\MyOwn\MASTER Master;

This example opens a graph window from the MASTER template located in the MYOWN subdirectory of the software directory and names the window Master.

win -t plot MyOwn\MASTER Master;

-t WF

Syntax: window -t WF template [winName]

Create a window from a named worksheet template file. If [winName] is omitted, the window is assigned a default name (BookN). In either case, window short name is automatically enumerated.

The -t WF switch can be used to create workbooks from the func2d.otw template and enumerate the window short name, as needed. Use in conjunction with the LabTalk copy -w command to paste a dataset copy of a 2D function plot to a workbook created from func2d.otw.

-th

Syntax: window -th winType template [winName]

Create a hidden new window from the template file.

-ti

Syntax: window -ti winType template [winName]

Create a minimized new window from the template file.
This is same with -t option except -ti creates a minimized window.

-tu

Syntax: window -tu winType template [winName]

Create a new window from the template file and add the window to the undo buffer.

This is identical to the win -t option but it supports "Undo Create".

-tx

Syntax: window -tx wks excel

Open a new Excel workbook. See also Set -ui