How do I select a radio button?

Yeah, I've only had O365 on this Mac.

I tried that (see screenshot). It's no faster. The Page Setup window appears, and then I have to wait about five seconds for my mouse cursor to move and click on the button!

image

Again, if "Press Button" is using Accessibility frameworks and your machine (for whatever reason) is dog-slow at processing those...

Are you selecting other options in the "Document" pane? If not, don't use it -- go straight to Page Setup with "File"->"Page Setup...".

Alternatively, see if you can skip all this UI messing around with a quick AppleScript action:

image

The script is

tell application "Microsoft Word"
	set orientation of page setup of section 1 of active document to orient landscape
end tell
1 Like

I was selecting other options in the Document Pane, which is why I was going that route. Nevertheless, using the mouse click to select the Landscape radio button in File->Page Setup works instantly, even though the same action in Format->Document->Page Setup takes 5 s. That's very curious, because when I use a button press instead of a mouse click, they both take 5 s.

So using your method cut my overall macro execution time from 13 s to 7 s (there are no pauses in the macro). The reason I still have a delay is because of this button press ("Ignore"), which also takes ≈ 5 s.

I can't use the mouse click approach there, because this window doesn't appear in a consistent position. However, I did get Click at Found Image working, but found the delay remained the same as with Press Button.

image

What are the other options? They might be scriptable too.

Thanks for offering to look into this further!

Here's the whole Macro. Its purpose is to put Word into Landscape orientation, and set all margins to zero.

It's useful when I'm teaching online, since I use Word as a "canvas" to combine text, pictures, and drawings, and want the maximum space available.

It takes ≈7 s to run, mostly because of a delay in executing the last command ("Ignore"). So that's the only one that needs to be scripted.

The window with "Ignore" comes up because Word wants to warn me that what I've done is outside the printable margins.

Would it be better to create a new document with those specifications, save it as a template file, then have something simple like a Hot Key Macro open the template? The convenience of templates is they retain the initial parameters while every use of the template creates a new document based on the template while the template itself remains unchanged for re-use later.

1 Like

In case the Microsoft Word Template file is a new idea for anyone... It is a specific file type, made by the user after setting up the desired document format, and then using File > Save As to select Template.

Very much this! Far easier to work from a template than to set up each document from scratch.

Unfortunately it's an image of (probably) most of your macro, not the macro itself (for the future: How to Post/Upload your Macros and Scripts).

However, replacing the previous AppleScript with

tell application "Microsoft Word"
	set orientation of page setup of section 1 of active document to orient landscape
	set top margin of page setup of section 1 of active document to 0
	set bottom margin of page setup of section 1 of active document to 0
	set left margin of page setup of section 1 of active document to 0
	set right margin of page setup of section 1 of active document to 0
end tell

...should do what you want. If there's options missing, just say.

(There's probably more concise ways of doing the above, so one the good AppleScripters might chip in here!)