Hi
Is it possible in NWP to do something like the following?
I would like to include an in-line variable to hold for example, the current text's font name, something like this "This is the <current-font-name> font" but can't find much about built-in variables?
Thanks
Variable substitution
Re: Variable substitution
This type of thing can be done via the macro language. The detailed features of the macro language can be found in the Macro Language Reference which is in the Help menu. For example you can get the name of the current font like this:
If you want the macro to insert this info into the text at the current selection instead, you can replace the last line with the following:
Code: Select all
$sel = TextSelection.active
$currentFont = $sel.displayTypingAttributes.fontName
prompt $currentFont
Code: Select all
$sel.text.insertAtIndex $sel.bound, "This is the $currentFont font"
philip
-
- Posts: 4
- Joined: 2011-04-26 01:33:36
Re: Variable substitution
Thanks Philip, I'll give that a go.
Nick
Nick
- martin
- Official Nisus Person
- Posts: 5230
- Joined: 2002-07-11 17:14:10
- Location: San Diego, CA
- Contact:
Re: Variable substitution
Depending on what you're doing, you might also check out custom document properties, which can act like variables. They are simpler than macros (though of course are also more limited). You can view and edit custom properties using the menu File > Properties. Once you've established some properties you can insert their value into your document's text using the menu Insert > Document Property > Custom Property.