Page 1 of 1

'Save Copy As…' in a macro

Posted: 2015-12-04 12:37:39
by pereelmagne
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

Re: 'Save Copy As…' in a macro

Posted: 2015-12-04 16:31:53
by phspaelti
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.

Re: 'Save Copy As…' in a macro

Posted: 2015-12-07 00:49:25
by pereelmagne
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.

Re: 'Save Copy As…' in a macro

Posted: 2015-12-07 06:19:46
by phspaelti
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?

Re: 'Save Copy As…' in a macro

Posted: 2015-12-22 12:56:05
by pereelmagne
Yes, you're right. The Save To command works perfectly well.

Thank you very much.

Re: 'Save Copy As…' in a macro

Posted: 2017-04-04 12:37:53
by Kino
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.