Skip to main content

SaveNotebook

SaveNotebook [flags ] notebookName [as fileNameStr ]

The SaveNotebook operation saves the named notebook.

Parameters

notebookName is either kwTopWin for the top notebook window, the name of a notebook window or a host-child specification (an hcSpec) such as Panel0#nb0. See Subwindow Syntax for details on host-child specifications.

If notebookName is an host-child specification, /S must be used and saveType must be 3 or higher.

The file to be written is specified by fileNameStr and /P=pathName where pathName is the name of an Igor symbolic path. fileNameStr can be a full path to the file, in which case /P is not needed, a partial path relative to the folder associated with pathName, or the name of a file in the folder associated with pathName. If Igor cannot determine the location of the file from fileNameStr and pathName, it displays a dialog allowing you to specify the file.

If you use a full or partial path for fileNameStr, see Path Separators for details on forming the path.

Flags

/ENCG=textEncodingSpecifies text encoding in which the notebook is to be saved.
This flag was added in Igor Pro 7.00.
This is relevant for plain text notebooks only and is ignored for formatted notebooks because they can contain multiple text encodings. See Plain Text File Text Encodings and Formatted Text Notebook File Text Encodings for details.
If omitted, the file is saved in its original text encoding. Normally you should omit /ENCG. Use it only if you have some reason to change the file's text encoding.
Passing 0 for textEncoding acts as if /ENCG were omitted.
See Text Encoding Names and Codes for a list of accepted values for textEncoding.
This flag does not affect HTML export. Use /H instead.
/H={encodingName, writeParagraphProperties, writeCharacterProperties, PNGOrJPEG, quality, bitDepth }
This flag affects writing an HTML file.
encodingNameSets the HTML file text encoding. The recommended value is "UTF-8".
writeParagraphProperties
Determines what paragraph properties SaveNotebook will write to the HTML file. This is a bitwise parameter with the bits defined as follows:
Bit 0:Write paragraph alignment.
Bit 1:Write first indent.
Bit 2:Write minimum line spacing.
Bit 3:Write space-before and space-after paragraph.
All other bits are reserved for future use and should be set to zero.
writeCharacterProperties
Determines what character properties SaveNotebook will write to the HTML file. This is a bitwise parameter with the bits defined as follows:
Bit 0:Write font families.
Bit 1:Write font sizes.
Bit 2:Write font styles.
Bit 3:Write text colors.
Bit 4:Write text vertical offsets.
All other bits are reserved for future use and should be set to zero.
If you set bit 2, SaveNotebook exports only the bold, underline, and italic styles because other character styles are not supported by HTML.
PNGOrJPEGDetermines whether SaveNotebook will write picture files as PNG or JPEG:
0:Write as PNG (default).
1:Write as JPEG.
2:Write as JPEG.
In Igor 7 and later, there is no difference between PNGOrJPEG=1 and PNGOrJPEG=2.
See below for details on HTML picture files.
qualitySpecifies the degree of compression or image quality when writing pictures as JPEG files. Legal values are in the range 0.0 to 1.0.
In Igor 7 or later, the quality used is always .9 regardless of what you pass for this parameter.
bitDepthSpecifies the color depth when writing pictures as JPEG files. Legal values are 1, 8, 16, 24, and 32.
In Igor 7 or later, the bit depth used is always 32 regardless of what you pass for this parameter.
/IThe save is interactive. A dialog is displayed.
/M=messageStrSpecifies prompt message used in save dialog.
/OOverwrites existing file without asking permission.
/P=pathNameSpecifies the folder to store the file in. pathName is the name of an existing symbolic path.
/S=saveTypesaveType =1:Normal save (default).
saveType =2:Save-as.
saveType =3:Save-a-copy.
saveType =4:Export as RTF (Rich Text Format).
saveType =5:Export as HTML (Hypertext Markup Language).
saveType =6:Export as plain text.
saveType =7:Export as formatted notebook.
saveType =8:Export as plain text with line breaks.

Details

Interactive (/I) means that Igor displays the Save, Save as or Save a Copy dialog.

The save will be interactive under the following conditions:

  • You include the /I flag and the saveType is 2, 3, 4, 5, 6, 7 or 8.

  • saveType is 2, 3, 4, 5, 6, 7 or 8 and you do not specify the path or filename.

If the saveType is normal and the notebook has previously been saved to a file then the /I flag, the path and file name that you specify, if any, are ignored and the notebook is saved to its associated file without user intervention.

The full path to the saved file is stored in the string S_path. If the save was unsuccessful, S_path will be "".

If you use /P=pathName , note that it is the name of an Igor symbolic path, created via NewPath. It is not a file system path like "hd:Folder1:" or "C:\\Folder1\\". See Symbolic Paths for details.

saveType=8 applies to formatted notebooks only. It exports the notebook as plain text with line breaks added where text wraps in the formatted notebook. This feature was added in Igor Pro 8.00. Special characters such as pictures are skipped. If the notebook is plain text then saveType=8 acts like saveType=6.

Exporting as RTF

For background information on writing RTF files, see Import and Export Via Rich Text Format Files.

Exporting as HTML

For background information on writing HTML files, see Exporting a Notebook as HTML.

You can pass "UTF-8" or "UTF-2" for the /H encodingName parameter. In virtually all cases, you should pass "UTF-8".

When creating an HTML file, Igor can write pictures using the PNG or JPEG graphics formats. PNG is recommended because it is lossless.

See Also

Notebooks

Setting Bit Parameters for details about bit settings.