# Macro Language: Document Commands

`reset`

Reset all document properties to default.

`new`

Opens a new document.

`close`

Close the current document window.

`open <filename>`

Opens the document with the given filename.

`save`

Save the current document.

`saveas <filename>`

Save document to a new file.

`savepng <filename> [resolution]`

Save document as a PNG file. Resolution can be 0 (low), 1 (normal, default) or 2 (high).

`savejpg <filename> [resolution]`

Save document as JPG file. Resolution can be 0 (low), 1 (normal, default) or 2 (high).

`savepdf <filename>`

Save document as PDF file.

`saveeps <filename>`

Save document as EPS file.

`printdoc`

Print the current document.

`export <filename> <mode> <BUFFER>`

Export ASCII data to file.
`<filename>`: Export data to this file.
`<mode>`: Export mode (0=all columns, 1=X,Y,ErrorY, 2=X,Y,ErrorX, 3=X, 4=Y).
`<BUFFER>`: Exported data buffer (Only one data buffer can be exported).

`importcommasep <bool>`

Set default value for import command.
If true treat comma as field separator (possible values: yes/no).

`importperiodsep <bool>`

Set default value for import command.
If true treat period as field separator (possible values: yes/no).

`importnotime <bool>`

Set default value for import command.
If true don't try to import time values (possible values: yes/no).

`importfirstrowcomment <bool>`

Set default value for import command.
If true import treat the firest row as column titles (possible values: yes/no).

`importnoxcol <bool>`

Set default value for import command.
If true all columns will be interpreted as Y values and the X values will be generated as sequence number (possible values: yes/no).

`importxcol <column>`

Set default value for import command.
Defines the X column starting with 1 as the first column.

`import <filename> <mode> [separator] [xcol] [noxcol] [comment] [ignore] [comment sequence] [only number lines] [time format] [comma separator] [period separator] [timezone] [white spaces] [first row titles]`

Import an ASCII file
`<mode>`: Import mode (0=multicolumn, 1=error values).
`[separator]`: Defines the field separator for ASCII import.
`[xcol]`: Defines the X column starting with 1 as the first column.
`[noxcol]`: If true all columns will be interpreted as Y values and the X values will be generated as sequence number.
`[comment]`: Overwrites the default comment for the imported buffers.
`[ignore]`: Lines containing this string will be ignored.
`[comment sequence]`: Anything in a line behind this sequence will be ignored for import.
`[only number lines]`: If true import ignores all lines which not begin with a number.
`[no time]`: If true don't try to import time values
`[time format]`: custom time format for x column import.
`[comma separator]`: If true treat comma as field separator
`[period separator]`: If true treat period as field separator.
`[timezone]`: set the timezone for time values.
`[white spaces]`: If true import ignores leading white spaces in lines.
`[first row titles]`: If true import treat the firest row as column titles.

Example:

      import $file \       # filename
           0 \             # mode
           '' \            # separator
           1 \             # x col
           NO \            # no x col
           'comment' \     # comment
           '' \            # ignore
           '' \            # comment sequence
           YES \           # only num lines
           NO \            # notime
           'yyyy-MM-dd' \  # time format
           NO \            # comma separator
           NO \            # period separator
           '' \            # time zone
           NO              # whitespace
           NO              # first row titles

`binaryimport <filename> <type> <mode> <swap> <columns> [comment]`

Performs a binary import of data.
`<type>`: Defines the data type (0=double (64bit), 1=float (32bit), 2=integer (32 bit), 3=integer (16 bit)).
`<mode>`: Defines the import mode (0=column mode, 1=block mode).
`<swap>`: Enables or disables byte order swapping.
`<columns>`: The number of columns to import.

`mysqlimport <host> <db> <user> <password> <port> <sql>`

Import data from MySQL database.

`perlimport <filename> [name]`

This executes a Perl import filter for the given file. Look in the perl import section for detailed information.
If no `name` is given the inline Perl block will be used. This is a block in your macro starting with a line containing `PERL` and ending with a line containing `PERL`. The default timeout for Perl scripts is 10 seconds. After this time the Perl job will be killed to prevent never come back jobs. You can set the timeout individual with the `perltimout <sec>` macro command.

`perlfilter <BUFFER> [name]`

This executes a Perl filter for the given buffers. Look in the perl filter section for detailed informations.
If no `name` is given the inline Perl block will be used. This is a block in your macro starting with a line containing `PERL` and ending with a line containing `PERL`. The default timeout for Perl scripts is 10 seconds. After this time the Perl job will be killed to prevent never come back jobs. You can set the timeout individual with the `perltimout <sec>` macro command

`subview <width> <height> <x> <y>`

Add a subview to the document.

`sizeview <width> <height> <x> <y>`

Change the size and position of the current subview

`changeview <subview number>`

Change the current view where 0 ist the main view.

`deleteview <subview number | all>`

Delete one or all subviews