Page 1 of 1

active doc question

Posted: 2014-05-03 06:53:40
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.

Re: active doc question

Posted: 2014-05-03 15:36:39
by phspaelti
Two problems:
  1. "=" is an assignment, "==" is a comparison
  2. $doc is an object
Try

Code: Select all

if $doc.name == "MYDOC"

Re: active doc question

Posted: 2014-05-04 06:23:28
by js
Glad to have you helping. Thank You.