Examples, Do menu macro, Other examples – Nisus Writer Pro User Manual
Page 439

Customizing & Automating Solutions
419
Examples
•
tell application "Nisus Writer Pro"
get text of document 1
end tell
•
tell application "Nisus Writer Pro"
get character 3 of word 1 of paragraph 1 of text of document 1
end tell
•
tell application "Nisus Writer Pro"
set word 1 of text of document 1 to "Modified Text"
end tell
•
tell application "Nisus Writer Pro"
set color of words 1 through 4 of text of document 1 to "green"
end tell
Nisus Writer Pro 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 Pro"
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 Pro"
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