Page

 

Perform various operations on the current page.

Contents

Syntax:

page [option]

Options:

no option; Open the page tabs of Plot Details dialog

Open the Plot Details dialog box with the page tabs active.

-ada; Arrange layers in cells using some default gap

Syntax: page -ada

Arranges the eligible layers (all those whose size is neither a percentage of page nor linked to another layer) in the cells, with some default gap between so-arranged layers.

-add; Dump the values set by the page -ads

Syntax: page -add

-adr; Reset dividers and change layer sizes

Syntax: page -adr

Can be used to reset the positions of dividers and it will also change layer sizes accordingly (but not rearrange layers).

-ads; Create a grid of n x m cells on the graph page

Syntax: page -ads [options] (firsthorizdiv|secondhorizdiv|etc) (firstvertdiv|secondvertdiv|etc)

It sets into the graph page the positions of the dividers in each dimension. The values are all assumed to be in percentages of the page dimensions in the corresponding direction. All values must be greater than 0 and less than 1, and must be passed in increasing order. The command works both on Page View and on the New Window View. If no dividers are needed in one of the two dimensions, put nothing between parentheses for that dimension.

Option Description
-b Arranges the layers from bottom to top.
-c Arranges the layers as column-major (by default it is row-major).
-gh value Sets the value of the horizontal (inner) gaps between neighboring layers as a percentage of the page width. If not set, it uses the default (0%).
-gv value Sets the value of the vertical (inner) gaps between neighboring layers as a percentage of the page height. If not set, it uses the default (0%).
-mb value Sets the value of the bottom (outer) margins as a percentage of the page height. If not set, it uses the default (0%).
-ml value Sets the value of the left (outer) margins as a percentage of the page width. If not set, it uses the default (0%).
-mr value Sets the value of the right (outer) margins as a percentage of the page width. If not set, it uses the default (0%).
-mt value Sets the value of the top (outer) margins as a percentage of the page height. If not set, it uses the default (0%).

Example: Create a new empty graph page. Then execute the Labtalk script below. It first sets the number of layers in the graph page to 6. Then it sets the units in each layer to "cm" and changes the background colors to make them all different. Then it sets the page areas dividers: two horizontal (at 30% and 65% height from the top of the page) and one vertical (at 60% from the left edge of the page). It also sets the left margin to 15% of page width, the top margin to 12% of page height, the inner horizontal gaps to 10% of page width, and the inner vertical gaps to 0. Then it dumps the set divider positions. Finally it rearranges all the layers in the cells delimited by the dividers.

int nLayersToHave = 6;
int nLayersToAdd = nLayersToHave - page.nlayers;
if ( 0 < nLayersToAdd )
{
        repeat nLayersToAdd { page -l Origin; };
}

int ncolor = 2;
doc -e LW { layer -u 3; layer.color = ncolor; ncolor++; };

page -ADS -B -GV 0 -GH 0.1 -ML .15 -MT .12 (0.3|.65) (0.6);
page -ADD;
page -ADA;

-af; Change Scale Factor of all layers in a graph page to a specified value

Syntax: page -af value

Change Scale Factor of all layers in a graph page to a specified value, if not already so. This change will apply the scale change to all objects of the layers, including the axes, axes labels, legend, data plots, and other objects attached to the Layer Frame or Layer and Scales. And it will affect elements including text font size, line width of lines and arrows, dimensions of arrow heads and tails and line width of drawn objects such as Rectangles, Polylines, etc.

-afu; Change Scale Factor of all layers in a graph page to a specified value, Undo Supported

Syntax: page -afu value

Change Scale Factor of all layers in a graph page to a specified value. The difference between -af and -afu is that -afu supports undo.

-c; Open the Page Color dialog box

Syntax: page -c

Open the Page Color dialog box.

-f; Adjust the page dimensions according to the current windows aspect ratio

Syntax: page -f

Adjust the page dimensions to fit the current window aspect ratio.

-fls; Fit layers to page

Syntax: page -fls [-m [marginsvalue]] [-l [gapvalue]] [-a] [-u]

Adjust layer dimensions to fit page size, with the following options:

Option Description
-m marginsvalue Specifies the margin around the edges of the page. The value marginsvalue is a decimal -- not a percentage (e.g. 0.05 not 5) -- of page size in the shorter dimension. The marginsvalue can be omitted, in which case, it will be assumed to be 0 (i.e. margin = "tight").

Beginning with Origin 2023, each margin can be specified separately using LabTalk -ml marginsvalue (left), -mt marginsvalue (top), -mr marginsvalue (right) and -mb marginsvalue (bottom) . Additionally, marginsvalue can now be negative.

example:

page -fls -u -c 3 -ml -0.005 -mt 0.001 -mb -0.005 -mr 0.001
-l gapvalue Place legend to the right side of the graph, outside of the layer, adjusted by optional gapvalue. The value gapvalue is a decimal -- not a percentage (e.g. 0.05 not 5) -- of page size in the shorter dimension. The gapvalue can be omitted, in which case, it will be assumed to be 0.
To use the -l option, the following must be true:
  • Graph contains a single layer.
  • There is one (and only one) legend object.
  • Scale Elements (Format: Layer > Display tab) must be Fixed Factor.
-a specifies to preserve the aspect ratio. If not present, the aspect ratio is not preserved.
-u Adjust layer dimensions without UNDO.

-fit; Fit Page to all Objects

Syntax: page -fit [-m [marginsvalue]] [-b [bordervalue]] [-u] [-d [directionvalue]]

Adjust page(including "graph" and "layout") size to encompass all objects, with the following options:

Option Description
-m marginsvalue Specifies the margin around the edges of the page. The value marginsvalue is a decimal -- not a percentage (e.g. 0.05 not 5) -- of page size in the shorter dimension. The marginsvalue can be omitted, in which case, it will be assumed to be 0 (i.e. margin = "tight").
-b bordervalue Specify the border to add for the page. It is only available if Margin Control -m is 1. The border value is percentage of the page size, the default setting is 0.
-u Adjust layer dimensions without UNDO.
-d Specify the direction to adjust the page size. 0: Both directions (default), 1: Vertical only, 2: Horizontal only.

Example:

page -fit -u -m 1 -b 5 -d 2; ///Fits the page horizontally only, with undo, and with the border margin of 5%.

Note: This command works similar with the tool Fit Page to Layers (X-Function "pfit2l"), which can be accessed from the menu Format: Fit Page to Layers/Fit Page to All Objects.

-j; Convert each layer of a multiple layer graph into a graph window

Syntax: page -j

Convert a multiple layer graph into multiple graph windows in which each layer displays in its own graph window.

-l; Add the specified template to the active graph window

Syntax: page -l templateName

Read the specified template file and add all of its layers to the page in the active graph window.

-lt; print the current protection bits

Syntax: page -lt

Minimum Origin Version Required: 9.1 SR0

-lw; Turn on protection on workbook level

Syntax: page -lw hex(hex value)

Minimum Origin Version Required: 9.1 SR0

Hex value Description
-- Turn on all protection bits.
0 Remove all the protections on active workbook.
2 Data Protection: This include all cells in a worksheet (data cells and label cells).
80 Structure Protection: Keep the columns in the sheet unchanged. Prevent insert/delete of columns or moving of columns. However, allow rows to be changed. Prevent insert/delete of worksheets or moving of worksheets.
400 Delete Protection: Prevent the workbook from being deleted. The book can only be hidden.
Note: Multiple protection flags can be applied (values are additive).
newbook;
page -lw hex(482); //Prevent editing of data, modifying of structure or deletion of the active workbook.

-mg Origin_modified_state; Get the modified state of the active window

Syntax: page -mg Origin_modified_state

Get the modified state of the active window and output into variable Origin_modified_state, Origin_modified_state = 1 if modified, 0 if not modified.

-ms; clear the modified state

Syntax: page -ms

Clear the modified state for active window.

-o; Set the page to portrait, landscape, or rotate the page

Syntax: page -o type, where

  • portrait, type = p
  • landscape, type = l
  • rotate the page, type = r

Set the page to portrait, landscape, or rotate the page.

Note: When used to change Master Template orientation, this command also changes the Master Template window Short Name (portrait = "Portrait", landscape = "Master").

-pg; Get page related parameters

Syntax: page -pg type varName

Get page related parameters to varName.

type Description
allow

turn on allowing read-protected data to draw.

page -p a 1;//turn on allowing read-protected data to draw
page -pg a v1;v1=;//get current state of the graph
raster

varName = 1, indicates that Edit: Copy Page will put a raster image of the active graph on the clipboard.

page -pg raster;v1=; 
v1=1; // raster image put to clipboard

Note that placing a raster image is the default for Density Dots and Color Dots graph types.


For other type, please see the table in next option.

-ps; Set page related parameters

Syntax: page -ps type value

Set page related parameters.

Note on type

C -- Closing flags: 0 = normal, 1 = no close, and 2 = no warning.

D -- Document closing method. When value = 1, set the active window as a system window which remains open when the project is closed. In addition, this window is not saved with the project. For related information on the page.syswin object property, see the page object.

H -- Height of the page in dots. For a graph window, this value is the number of dots from the top to the bottom of the page. For a worksheet window, this number is the vertical screen resolution in pixels.

P -- Maximum show points: 0 = show all data points.

S -- Search flags.

bit(n) value(2^n) disable search on
0 1 axis
1 2 data plot
2 4 label
3 8 graphical object
4 6 layer frame
5 32 tick labels

W -- Width of the page in dots. For a graph window, this value is the number of dots across the page. For a worksheet window, this number is the horizontal screen resolution in pixels.

-rc; Convert existing graph colors to Auto

Syntax: page -rc 1

Convert existing graph colors to Auto. This convert should happen only if page virtual color is not white and Origin is in dark mode. If we have polymorphic pointer, then we convert the colors if black to auto. For Style Holder, we first handle line color if black and consider other cases later.

For example, for legend, we convert both text color and border color.

-rcp; Make Current Dynamic Color Permanent

Syntax: page -rcp[u] 0

Apply color reverse and change page background color to current global auto color. The letter 'u' is to make it with undo.

-rrt; Connect the table objects on an active graph page

Syntax: page -rrt

Connect the table objects on an active graph page after loading a project. You have to manually refresh graphs after this to see table objects.

-s; Select the specified object on the page

Syntax: page -s object

Select the specified object on the page. If no object is given, this command clears the current selection.

-sa; Select the specified object on the page and preserve the status of all current objects

Syntax: page -sa object

Select the specified object on the page, leaving the status of other current objects.

-sps; Set splitter to the active page

Syntax: page -sps [script]

Set splitter to the active page or hide the current splitter.

page -sps;//hide the current splitter
page -sps "r[MatObjChooser]{10%}r";//show Image Slider at the top of the page
page -sps "r{50%}r[WkbookSplitter]";//show Workbook Organizer at the bottom of the page
page -sps "c{60%}c[ScriptPanel]";//show Script Pane at the right of the page

-t; Open the specified template using the active graph window

Syntax: page -t templateName

Replace the page in the active graph window with the template templateName, without closing the active graph window.All current layers are deleted. Similar to the document -t and window -t commands (document -t lets you specify a complete path).

-tbb; Add Labtalk Button to Window Title Bar

Minimum Origin Version Required: 9.0 SR0

This command adds a small system button to the active window, in front of the minimize button. This allows a LabTalk script to be attached to a window/page.

SynTax: page -tbb n [script [tooltip]]

where n can be 0,1,2,3

n Meaning
0 Remove the button, subsequent script etc is ignored
1,2 Add a button with the right-arrow icon
3 Add a button with the Home icon

script and tooltip must both be quoted. Example:

page -tbb 3 "run.section(%XMyTest.ogs,Main)" "Run my Labtalk code to do something";

-uo; Update Operations

Syntax: page -uo

(SR1) Dirty all the operations which input intersects with the active page.

-us; Update active Excel book to recreate all hidden Origin sheets with all the Excel data copied over

Syntax: page -us

(SR1) Update active Excel book to recreate all hidden Origin sheets with all the Excel data copied over. This is similar to the layer -s command which acts only on the active Excel sheet.

-v; Set the page to the specified view mode

Syntax: page -v n

Set the page to the specified view mode: 0 = Print view, 1 = Page View, 2 = Old Window View (See note below), and 3 = Draft View.

Note: To switch page to the new Window View, please use the page.viewmode property instead.

-vnw; Set the page to the new Window View mode

Syntax: page -vnw

Set the page to the new Window View mode (see Note above).

You can also use -vnw to verify that the active window is in the new Window View mode.

page -vnw varName; //get new Window View status to varName
varName=; // if View Mode = new Window View, dumps =1

-vx; Switch the view mode for the active Excel workbook

Syntax: page -vx

Switch between the workbook view and the hidden Origin worksheet layer view for the active Excel workbook in Origin.

-w; Plot each column in the worksheet to separate graph layers

SynTax: page -w wksName c1 r1 c2 r2 [ID]

Plot each column in the worksheet to separate graph layers.Same as the layer -wcommand but put each dataset (column) into separate layers in the page. When the last layer is passed, cycles back to the first layer. Note: An active graph window with the correct number of layers must already exist.

-x; Add the active window as shortcut to Favorites folder

Syntax: page -x

Add a shortcut to the window, to the project Favorites folder (example, below). If the folder does not exist, create it.

-yt; Draw the tight rectangles for each layer

Minimum Origin Version Required: 2019

Syntax: page -yt

Draw the tight rectangles for each layer as these tight rectangles are used during the layer arrangement. You can also add the switch -d to dump the numeric values:

page -yt -d;

Examples:

The following script disables the search on axes and labels for the page.

page -ps search 1;

Note: You can also use: page.noclick = 5;

The next script doubles the maximum display points for the page.

page -pg p npts; page -ps p (npts*2);

Note:

You can also use: page.maxpts *= 2;

The next script adds the layer from the scatter template to the page

page -l Scatter;

The following script makes graph1 the active window. It saves graph1 as a system window which remains open when the project is closed. However, graph1 will not be saved with the project.

win -a graph1;
page -ps d 1;

This script loops through all workbooks in the project, searches for those with "CC" in the name and adds those as shortcuts to a Favorites folder.

doc -e W {
                if (search(page.name$,"CC")>0) 
                {
                        page.name$=;
                        page -X;
                }
        }