This command creates, opens, closes, activates, and performs several actions on graph and worksheet windows.
window option
Syntax: window -a winName
Set winName as the active window.
This option also has the effect of a Windows Restore if the active window is maximized or minimized.
repeat 5 {newbook;}; // Create 5 new workbooks. window -a book3; // activate Book3 window
Syntax: window -af [n] [millisecond]
Flash active window n times with millisecond timeout.
win -af;//flash 4 times, use timeout set by @AWF, if @AWF = 0, no flashing win -af 5;//flash 5 times, use 200ms timeout win -af 5 300;//flash 5 times, use 300ms timeout win -af -5;//flash 5 times, follow @AWF for timeout, if AWF=0 no flashing
Syntax: window -an winName
Activate (restore) the winName notes window.
Syntax: window -aw URL
Go to the URL web page.
View htm files from the local computer (note the use of quotation marks).
For example:
// example 1: Go to the OriginLab home page. win -aw "http:\\www.originlab.com";
// example 2: Open htm from the Users Files folder (held in %Y) win -aw "file://%YmyHelp.htm";
Syntax: window -b winName
Open or set as active, the specified window.
This command option is obsolete. Use the GetNamedWin macro instead.
Syntax: window -c <winName>
Delete the window named winName.
In this line of script, the Graph1 window is deleted without prompting the user:
window -c Graph1;
While the window is deleted, the datasets may remain as loose datasets. If you wish to destroy the datasets when the window is destroyed, you can use create -cd/-dd/-nd/-xd.
Also, see the @WD LabTalk System Variable.
Syntax: window -cw <winName>
Delete the window named winName. This command supports wildcard. For example:
window -cw Graph*;
Syntax: window -ca winName
Close the winName window as if the user selected the Close menu command from the child window system menu.
This option prompts the user with a dialog box.
Syntax: window -cwa <winName>
Close the winName window as if the user selected the Close menu command from the child window system menu.
This option prompts the user with a dialog box.This command supports wildcard. For example:
win -cwa Book*;
Syntax: window -cd winName
Close the workbook and delete all the data.
Syntax: window -cwd winName
Close the workbook and delete all the data. This command supports wildcard. For example:
win -cwd Book*;
Syntax: window -ch n
Hide the active window (window's Project Explorer view mode changes).
For example, if the window was in Normal view, it changes to Hidden view (Project Explorer View column) when n = 1. See also, win -h.
newbook name:=Test option:=lsname; // Create a new workbook named "Test", it is //activated automatically after created. window -ch 1; // Hide workbook Test. window -a Test; // Restore it.
Syntax: window -cn winName
Close the winName notes window without prompting.
Syntax: window -cwn <winName>
Close the winName notes window without prompting. This command supports wildcard. For example:
win -cwn Notes*;
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.
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.
Syntax: window -dg winName
Origin Version: 9.0 SR0
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 } }
Syntax: window -e winName [template]
Activate a graph window and delete all data plots.
If the window does not exist, create a new window based on a named template and name it winName.
If template isn't provided, then open the window based on the winName template, otherwise open the ORIGIN.OTP template.
Syntax: window -g
If the active window was opened from a template file, put the path and the template file name into %A.
Syntax: window win -h n
Hide the active window (window's Project Explorer view mode is not changed).
The window's Project Explorer view mode remains set to its current view (for example, Normal or Maximized), but it does not display. See also, win -ch.
Syntax: window win -hc n [windowName]
This is the same as win -ch, but supports the windowName option.
// Hide Book2, even if it is not the active window: win -hc 1 Book2; // Functions just like 'win -ch 1' would: win -hc 1;
Syntax: window win -hn n NotesWindowName
Hide or show a notes window, where
Minimum Origin Version Required: 8.5.1
Syntax: window -i
Minimize the active window.
Syntax: window -ia
Minimize the active window and force activation of the previously active window.
Syntax: window -in winName
Minimize the winName notes window.
Syntax: window -l 0
Put the active window to the end of the Window menu window list.
Syntax: window -m
Merge all graph windows.
Syntax: window -ma
Prompt with a dialog box before merging all graph windows.
Syntax: window -n winType [winName]
Create a new window from scratch (not from a template) and name it winName.
Note 1:
This option is not recommended for creating graph windows. Use the
Most of the layer commands in your script will be unnecessary. |
Note 2:
After creating a worksheet with the For more control over creating worksheets, use the |
Syntax: window -o winName {script}
Execute (operate) the specified script for the named window.
winName is temporarily set internally as the active window, the script is executed, then the original active window is re-established.
Most commands operate on the active window. The %H system variable can be used by commands that require a window name.
Note: The window -o is especially useful when user wants to customize the embedded graphs or customize a window which is not active.
//Rescale one layer in the embeded graph win -o Graph1 { Graph1!page.active=2; Rescale; } |
Syntax: window -oa winName {script}
Execute (operate) the specified script for the named hidden window.
winName is temporarily set internally as the active window, the script is executed, then the original active window is re-established.
Most commands operate on the active window. The %H system variable can be used by commands that require a window name.
Syntax: window -ppc
Call graph preview cleanup function to clean graph preview in Project Explorer. When this command is executed, hovering over the graph window in the sub-panel of Project Explorer will not show graph preview.
doc -e p {win -ppc} // Clean all the graph previews from an OPJ
Syntax: window -r windowName newName
Rename windowName with the given newName.
Syntax: window -ra
Open the Rename dialog box.
Syntax: window -rl windowName "labelContents"
Specify a window label for the windowName window, and set the window to display the label in the window title.
This is equivalent to:
windowName!page.title = 1; windowName!page.label$ = "labelContents";
Syntax: window -rn notesWindowName newName
Rename notesWindowName Notes window with the given newName.
Minimum Origin Version Required: 2017 SR0
Syntax: window -rp windowName [strNewName]
If the graph window windowName is created from a template with ShortName and/or LongName preset, this command will update windowName with the preset name and save the updated ShortName in the strNewName variable if present.
Supposed you save a cloneable template "mytemplate" to UFF with Short Name preset. Then activate workbook with prepared data and run the following script to create a graph from the cloneable template and set the graph Short Name.
worksheet -pa ? mytemplate.otp; win -rp %H strNewName$; //The updated short name is saved in strNewName$
Syntax: window -s C;
Window system call to cascade all windows.
Minimum Origin Version Required: 2015 SR1
Syntax: window -s chn, cvn;
Tile windows horizontally (ch) or vertically (cv) in a certain sequence and then cascade each column. The tile sequence is determined by n:
Minimum Origin Version Required: 2015 SR1
Syntax: window -s ctn;
Tile and cascade windows. The tile sequence is determined by n, see -s ch/cv above for options of n.
Syntax: window -s T
Window system call to tile all windows by window activated order. The sequences of the activated order is that the latest active window will be tiled first and the first activated window the last.
Minimum Origin Version Required: 2015 SR1
Syntax: window -s thn, -s tvn;
Tile windows horizontally (TH) or vertically (TV) in a certain sequence. The tile sequence is determined by n, see -s ch/cv above for options of n.
Syntax: window -t winType template [winName]
Create a new window from the template file.
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 When @wd = 1, Origin deletes the datasets that remain from the When @wd = 0, #Command Error! prints to the Script window. Origin does not delete the datasets that remain from the |
Note2: To open a "master page" from the Master.OTP template, use this command like the following:
|
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.
Syntax: window -th winType template [winName]
Create a hidden new window from the template file.
This feature was broken since Origin 7.5 and fixed in Origin 8 SR2.
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.
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".
Syntax: window -tx wks excel
Open a new Excel workbook. See also Set {-ue, -ui}(command)
Syntax: window -w winName
Temporarily set the active window to winName.
This allows commands that work with the active window to apply to winName.
You must eventually execute win -w
to restore normal operation before using the command again.
Syntax: window -w
Restore normal operation before using the command again.
Syntax: window -z
Maximize the active window.
Syntax: window -z0
Fit page to window size, same as this method:
page.zoomwhole=1
Syntax: window -zn winName
Maximize the winName Notes window.
Example 1
This example opens a graph window from the MASTER template (in the software directory) and names the window Master.
win -t plot MASTER Master;
Example 2
The next script opens a new worksheet from the FFT template (in the software directory) and names it by default (Book1, Book2, etc.).
win -t data FFT;
Example 3
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;
Example 4
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;
Example 5
This example finds the first window in the Window menu window list that begins with graph and sets it as the active window.
If no window is found, it creates a Graph1 window.
win -b graph;
The following script rescales the Graph2 window's X axis from -10 to 10.
win -o graph2 { x1=-10; x2=10; };
Example 6
This example closes the current worksheet together with all associated datasets.
Page.CloseBits=2; // uses the closebits page property win -ca;
Example 7
This example produces two graphs tiled horizontally while all other windows made iconized.
newbook;wks.nCols=3; //new wkbook with 3 cols col(1)=data(1,10); col(2)=normal(10); col(3)=col(1)+col(2);// fill some data range aa = (1,2); // define XYRange range bb = (1,3); string strG1$, strG2$; // local string to receive new plot names plotxy aa ogl:=[<new>];strG1$=%H; plotxy bb ogl:=[<new>];strG2$=%H; doc -e o {win -i}; // iconized all windows win -a %(strG1$); // opens the two graphs win -a %(strG2$); win -s tv; //and tile vertically