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.
Setting margins and page size of open document
Re: Setting margins and page size of open document
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
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
macOS Ventura
Nisus Writer user since 1996
Re: Setting margins and page size of open document
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.
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.