Current document values, Current nisus writer application values, Current system version – Nisus Writer Pro User Manual

Page 426: Current home folder, Modifying text

Advertising
background image

406

The Nisus Writer Pro Macro Language

Macros, the Deeper Workings

This is the complete path, starting with the disk name.

User Property "macros folder path"

This returns the full path to the folder where the user’s macros are stored (in their home
directory).

Current document values

The following examples illustrate how to obtain the current document’s properties (that is, the
document whose window is frontmost).

$pathToCurrentDocument = Document Property "file name"
$bare_file_name = Document Property "file name without extension"
$relative_file_path = Document Property "file path"
$path_to_document = Document Property "absolute file path"

Current Nisus Writer application values

The following examples illustrate how to obtain the currently running Nisus Writer Pro application.

$where_am_I = Application Property "file path"
$version_number = Application Property "version"
$detailed_version_number = Application Property "long version"

The following returns the full path to the folder where Nisus Writer Pro’s Document Manager stores
files.

User Property "document manager folder path"

Current System version

The following example illustrates how to obtain the system version number.

$system_version_number = System Property "version"

Current Home folder

The following returns the full path to the user’s Home folder.

User Property "home folder path"

Modifying text

In addition to allowing bare menu commands such as Format:Bold, you can also use the Menu
instruction to explicitly invoke a menu:

Menu menuItemPath

This allows for variable menu paths as for example:

$myPath = "Bold"
Menu $myPath

These two lines when executed are equivalent to using the Bold command from the menu.

$myText = "testing text insertion"
Insert Text $myText

Replaces the currently selected text with the text "testing text insertion". The inserted text
uses the attributes that were applied to the selected text. The inserted text remains selected
so you can apply other attributes and styles to it.

Insert Newline

Replaces the currently selected text with a newline (Return character). The inserted newline
remains selected so you can apply paragraph styles to it.

Insert Attributed Text text

Replaces the currently selected text with the text provided. The inserted text will have the
attributes that are applied to the text defined in the macro itself. See “Advanced macro
notes
” on page 411 for some details on attribute handling in strings. The inserted text
remains selected so you can apply other attributes and styles to it.

Selection note

In all three of the above Insert commands, if in the command you substitute the word Insert with
the word Type, the inserted text or newline is not selected and the insertion point is at the end of
the inserted text. (That is for the commands Type Text, Type Newline, and Type Attributed
Text.)

Read Selection

Advertising