Reply to topic  [ 3 posts ] 
paragraph style as a condition 
Author Message

Joined: 2007-04-12 14:59:36
Posts: 229
In a document myfile I would like to check the paragraph style of the selection. This works fine like so:

Code:
Document.open  "~/Documents/myfile"
$doc = Document.active
$sel = $doc.textSelection
$parStyle = $sel.paragraphStyle
prompt $parStyle


Now let‘s say the prompt says
Quote:
Paragraph Style "Normal"

How must I formulate a condition: If Paragraph Style is "Normal" then do suchandsuch?
Code:
If $parStyle = "Normal"
do such and such
end
does not work.


2015-04-05 15:18:20
Profile

Joined: 2008-03-16 16:41:16
Posts: 20
Judging from my own code, what you want is $parStyle.name. TextSelection.paragraphStyle returns a style object; the property “name” on that object contains the style’s name as text. Getting the style’s name as text allows you to compare the style name to some text of your own.

Code:
$parName = $parStyle.name
If $parName == "Normal"
    do such and such
End


You can see this in the Nisus Macro Reference (under the Help menu) in the DOCUMENT OBJECTS section, Style Object, Style Object Properties. There are quite a few useful properties there for you to use in your macros.

_________________
Mimsy Were the Borogoves


2015-04-05 20:23:12
Profile WWW

Joined: 2007-04-12 14:59:36
Posts: 229
Perfect. Thank you.


2015-04-05 23:36:39
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 3 posts ] 

Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group
Designed by ST Software