'Save Copy As…' in a macro

Get help using and writing Nisus Writer Pro macros.
Post Reply
pereelmagne
Posts: 10
Joined: 2015-06-27 01:38:22

'Save Copy As…' in a macro

Post by pereelmagne » 2015-12-04 12:37:39

After opening a document, I want to run the actions File:Save Copy As… However, the macro stops at 'File'. What am I missing?

Code: Select all

$docActive = Document.active
If $docActive
	File
	Save Copy As…
Else
	Exit
End

User avatar
phspaelti
Posts: 916
Joined: 2007-02-07 00:58:12
Location: Japan

Re: 'Save Copy As…' in a macro

Post by phspaelti » 2015-12-04 16:31:53

pereelmagne wrote:After opening a document, I want to run the actions File:Save Copy As… However, the macro stops at 'File'. What am I missing?
Well, if you want to run "File:Save Copy As…" you should write "File:Save Copy As…". If you break the command across two lines, you end up with a command "File", which doesn't make any sense to anyone.
philip

pereelmagne
Posts: 10
Joined: 2015-06-27 01:38:22

Re: 'Save Copy As…' in a macro

Post by pereelmagne » 2015-12-07 00:49:25

Thanks, but I had already tried the 'File:Save Copy As…' line, and the macro stopped there as well. Now I have just tried the "Save As…" command and it has worked. Here is the macro that works:

Code: Select all

$docActive = Document.active
If ! $docActive
	New
Else $docActive
   File:Save As…
End
Conclusion: the "Save Copy As…" command is not working.

User avatar
phspaelti
Posts: 916
Joined: 2007-02-07 00:58:12
Location: Japan

Re: 'Save Copy As…' in a macro

Post by phspaelti » 2015-12-07 06:19:46

Actually "Save Copy As" and "File:Save Copy As" will work, if you leave out the ellipsis. (This is a general rule for Nisus Menu commands, by the way).

But I am sort of wondering what you are trying to do. Is this part of some larger macro? Usually if you want to do "Save Copy (As)" in a macro, you could use the macro language "Save To" command which, I think, would behave better. As far as I can tell, the macro won't actually stop when you do "Save Copy As" in a macro, whereas for "Save To" it will. Even better, if you already know what name you want to give the copy, you can add that as an argument, and then you won't have to bother with the dialog at all.

For more info on the macro language command(s) see the "Macro Language Reference" in the "Help" menu.

Also:
pereelmagne wrote:

Code: Select all

$docActive = Document.active
If ! $docActive
	New
Else $docActive
   File:Save As…
End
What is the $docActive doing after the Else?
philip

pereelmagne
Posts: 10
Joined: 2015-06-27 01:38:22

Re: 'Save Copy As…' in a macro

Post by pereelmagne » 2015-12-22 12:56:05

Yes, you're right. The Save To command works perfectly well.

Thank you very much.

Kino
Posts: 400
Joined: 2008-05-17 04:02:32

Re: 'Save Copy As…' in a macro

Post by Kino » 2017-04-04 12:37:53

pereelmagne wrote:After opening a document, I want to run the actions File:Save Copy As… However, the macro stops at 'File'. What am I missing?
This one works for me.

Code: Select all

$docActive = Document.active
If $docActive
   Save Copy As... # Here '...' is not an ellipse but three fullstops.
Else
   Exit
End
As far as I have observed, this kind of deviation is rather common. You can never know “...” following :ApplicationName:Preferences— for example, TextEdit’s Preferences… command— is an ellipse or three fullstops.

That said, I think it would be more convenient if the macro language of a future version of NWP will treat three fullstops as equivalent of a single ellipse as far as menu command name is concerned.

As Philip said, Save Copy As does work but the current behaviour might be confusing for some users, I think.

Post Reply