Reply to topic  [ 4 posts ] 
Macro language syntax or bug? 
Author Message
User avatar

Joined: 2007-02-07 00:58:12
Posts: 876
Location: Japan
Today I was experimenting with macros in NW 2.0. I thought I remembered that one should be able to write something like this:
Code:
$docname = Document.displayName

But this kept giving me errors. I know that one can write the following
Code:
$doc = Document.active
$docname = $doc.displayName

and this works fine, but I am still wondering about the above. Am I misremembering this, or does NW 2.0 have a bug?

I should note also that the manual contains the following:
Code:
Document.selectedFloatingContent

but this also gave me an error when I tried to use it. So is the manual in error?

_________________
philip


2011-05-21 07:10:06
Profile

Joined: 2008-05-17 04:02:32
Posts: 400
phspaelti wrote:
Today I was experimenting with macros in NW 2.0. I thought I remembered that one should be able to write something like this:
Code:
$docname = Document.displayName
That has never worked.

Quote:
I should note also that the manual contains the following:
Code:
Document.selectedFloatingContent

but this also gave me an error when I tried to use it. So is the manual in error?
“Document” stands for Document object as the cross-reference shows (double click on “Document”). Try something like this.
Code:
$doc = Document.active
exit $doc.selectedFloatingContent.anchorTextRange


2011-05-21 07:24:25
Profile
User avatar

Joined: 2007-02-07 00:58:12
Posts: 876
Location: Japan
Thanks, Kino

_________________
philip


2011-05-21 19:28:30
Profile
Official Nisus Person
User avatar

Joined: 2002-07-11 17:14:10
Posts: 4251
Location: San Diego, CA
Kino is exactly right. To clarify, something like this is an object type command:
Code:
$doc = Document.active

It's a way of getting a specific object, which is then assigned to "$doc". Once you have that specific object, you can start using its properties.

Ideally it should be possible to write something like:
Code:
$docname = Document.active.displayName

But right now the intermediate step of assigning "$doc" is needed when using the object type commands. Though you can chain specific object properties/commands, eg:
Code:
$doc = Document.active
$ext = $doc.filePath.filePathExtension


2011-05-23 09:09:07
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 4 posts ] 

Who is online

Users browsing this forum: No registered users and 3 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:  
Powered by phpBB® Forum Software © phpBB Group
Designed by ST Software