Nisus Writer Express Manuel d'utilisateur Page 272

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 316
  • Table des matières
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs
Vue de la page 271
252 Creating Macros with the Menu Command Dialect
Writing AppleScripts
Using AppleScripts you can create little “stand alone” applications that you can use to take
information from one “scriptable” program and manipulate it in a second one before passing it on to
yet another. You can also create little applications that you can share with other Nisus Writer
Express users.
AppleScripts are made up of AppleEvents. An AppleEvent is a single command such as Copy or
Print; analogous to a Nisus Writer Express macro command. Therefore, an AppleScript (an
accumulation of AppleEvents written to perform an action) is analogous to a Nisus Writer Express
macro. There are several levels of AppleEvent support an application can have.
Nisus Writer Express supports some of these.
Nisus Writer Express is Scriptable. That is, using the Script Editor application, to do any of the
required suite of AppleEvents such as Open - a document, Print - a document, Quit - the
application, Run - the application. Nisus Writer Express also supports part of the Text Suite and the
“Do Menu Macro” command.
Integrate AppleScript with Nisus Writer Express
The argument of the Do Menu Macro can be any Nisus Writer Express menu command (even the
name of a macro, style, etc.). In addition, you can put almost any Nisus Writer Express macro
programming dialect command in an argument. A few examples follow.
Write AppleScripts for use in Nisus Writer Express
1. Write AppleScripts in Script Editor.
You can find the Script Editor in the AppleScripts folder of the Applications folder.
Applications/AppleScripts/Script Editor
1. Save your AppleScripts as compiled scripts (with a “.scpt” extension) or plain text (with a
“.applescript” extension) in the folder
~/Library/Application Support/Nisus Writer/Macros
Have AppleScripts open a new file
" tell application "Nisus Writer Express"
Make at front of documents new document
end tell
Have AppleScript open a file and perform some tasks
This script tells Nisus Writer Express to open a new file and type “Hello World.” It then selects all
the text, applies the font Times, then makes it Bold and Red.
" tell application Nisus Writer Express
Activate
Set newDoc to make at front of documents new document
Set text of newDoc to "Hello World."
Do Menu Macro with macro "Select All"
Do Menu Macro with macro "FormatFontTimes"
Do Menu Macro with macro "FormatBold"
Set color of text of newDoc to "red"
end tell
See a list of all the AppleScripts commands that Nisus Writer Express
recognizes
" Drop the Nisus Writer Express application icon on the Script Editor application icon.
Plain text AppleScripts have an extension of 'applescript' and compiled scripts have 'scpt'
The two most useful commands supported Nisus Writer Express are:
getting and setting the text of a document
running Nisus Writer Express menu macros.
Get/Set Text
You can get the main body text of any open document, or any character, word or paragraph of that
text. You can also set the entire body text or any portion of it. You can also get or set the text color
of any piece of the text.
Vue de la page 271
1 2 ... 267 268 269 270 271 272 273 274 275 276 277 ... 315 316

Commentaires sur ces manuels

Pas de commentaire