Setting margins and page size of open document

Get help using and writing Nisus Writer Pro macros.
Post Reply
vwnisus
Posts: 62
Joined: 2016-04-24 00:13:31

Setting margins and page size of open document

Post by vwnisus »

Is it possible to create a macro to set the margins and possibly the page size of an open document.

If possible, what would be the commands to do so?

Any help would be gratefully received.
User avatar
phspaelti
Posts: 1341
Joined: 2007-02-07 00:58:12
Location: Japan

Re: Setting margins and page size of open document

Post by phspaelti »

No
philip
adryan
Posts: 595
Joined: 2014-02-08 12:57:03
Location: Australia

Re: Setting margins and page size of open document

Post by adryan »

G'day, Victor, Philip et al

While there appear to be no commands in the Macro Language to achieve this, it may just be possible to have a Macro run AppleScript code that uses System Events to access and modify elements of the Page Setup dialog (for paper size) and the Margins Palette. Once you have gained access to those environments, you can use System Events' "keystroke tab" commands to step through fields until you reach one you want to modify. You then use key and keystroke commands to simulate a paste operation, the clipboard having been primed with the required data. That's the principle anyway….

An alternative, less technical approach would be to create one or more template documents with the page sizes and margin settings one is likely to use. A Macro would copy the contents of your present document, paste them into a chosen template, fiddle with the filenames, and leave you looking at your document with the revised page size and margin settings.

From where I'm sitting, though, I think your current page size and margin settings look just fine.

Cheers,
Adrian
MacBook Pro (M1 Pro, 2021)
macOS Ventura
Nisus Writer user since 1996
vwnisus
Posts: 62
Joined: 2016-04-24 00:13:31

Re: Setting margins and page size of open document

Post by vwnisus »

Thank you for both the responses.


Trying to use AppleScript, System Events, etc, does not appear to reach the margin settings (in my non-expect view).

Adryan's suggestion to set up a template and copy the text of a file into a new document with the chosen template achieves what I need.

Thank you for the suggestion.
Post Reply