Do menu macro, Examples, Other examples – Nisus Writer Express User Manual

Page 273

Advertising
background image

Customizing & Automating Solutions

253

Examples

tell application "Nisus Writer Express"

get text of document 1

end tell

tell application "Nisus Writer Express"

get character 3 of word 1 of paragraph 1 of text of document 1

end tell

tell application "Nisus Writer Express"

set word 1 of text of document 1 to "Modified Text"

end tell

tell application "Nisus Writer Express"

set color of words 1 through 4 of text of document 1 to "green"

end tell
Nisus Writer Express has a limitation when setting the text in that the changes caused by the
AppleScript are not undoable and may cause problems with existing Undo/Redo actions.

Do Menu Macro

You can run any string of text as a Nisus Menu Macro

Examples

set macroString to "FormatSizeIncrease" & return & "FormatFontApple Chancery"

tell application "Nisus Writer Express"

activate

Do Menu Macro with macro "EditSelect All"

Do Menu Macro with macro macroString

end tell

Other Examples

This script will insert the path to the front document at the end of the document

tell application "Nisus Writer Express"
if exists (path of document 1) then
set thePath to path of document 1
else
set thePath to "No Path"
end if
make new paragraph at end of text of document 1 with data (return &

thePath)

end tell

Advertising