nisus.com
https://www.nisus.com/forum/

'Save Copy As…' in a macro
https://www.nisus.com/forum/viewtopic.php?f=17&t=6229
Page 1 of 1

Author:  pereelmagne [ 2015-12-04 12:37:39 ]
Post subject:  'Save Copy As…' in a macro

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:
$docActive = Document.active
If $docActive
   File
   Save Copy As…
Else
   Exit
End

Author:  phspaelti [ 2015-12-04 16:31:53 ]
Post subject:  Re: 'Save Copy As…' in a macro

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.

Author:  pereelmagne [ 2015-12-07 00:49:25 ]
Post subject:  Re: 'Save Copy As…' in a macro

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:
$docActive = Document.active
If ! $docActive
   New
Else $docActive
   File:Save As…
End

Conclusion: the "Save Copy As…" command is not working.

Author:  phspaelti [ 2015-12-07 06:19:46 ]
Post subject:  Re: 'Save Copy As…' in a macro

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:
$docActive = Document.active
If ! $docActive
   New
Else $docActive
   File:Save As…
End



What is the $docActive doing after the Else?

Author:  pereelmagne [ 2015-12-22 12:56:05 ]
Post subject:  Re: 'Save Copy As…' in a macro

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

Thank you very much.

Author:  Kino [ 2017-04-04 12:37:53 ]
Post subject:  Re: 'Save Copy As…' in a macro

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:
$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.

Page 1 of 1 All times are UTC - 8 hours
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/