active doc question

Get help using and writing Nisus Writer Pro macros.
Post Reply
js
Posts: 259
Joined: 2007-04-12 14:59:36

active doc question

Post by js »

I have an open document called "MYDOC". I would like to test whether it is active and if not make it active. I wrote

Code: Select all

$doc = Document.active
if $doc = "MYDOC"
	prompt "$doc is active"
else
	Document.setActive $doc
end
What's wrong with this? The macro doesn't complain. But whether MYDOC is actually active or not, I always get the answer that it is.
User avatar
phspaelti
Posts: 1313
Joined: 2007-02-07 00:58:12
Location: Japan

Re: active doc question

Post by phspaelti »

Two problems:
  1. "=" is an assignment, "==" is a comparison
  2. $doc is an object
Try

Code: Select all

if $doc.name == "MYDOC"
philip
js
Posts: 259
Joined: 2007-04-12 14:59:36

Re: active doc question

Post by js »

Glad to have you helping. Thank You.
Post Reply