I tried this and it doesn't work. Is this not designed for radio buttons, or do I just have the name wrong?:
According to the documentation, KBM can scan the panel and tell you all the button names:
"There is a popup menu (v11.0+) to scan the front window of a selected application. Ensure the window of interest is the front window in your target application, then select the application in the popup menu. "
...However, the documentation doesn't say how to access the popup menu.
I could try "Move or Click Mouse" or "Click at Found Image", but was hoping for something more direct and robust.
If no one provides a more direct method, it should be possible to select that radio button using multiple instances of the Simulate A Keystroke Action. That is, simulate pressing Tab until the radio button is highlighted, then press Space Bar to select it.
Note that the speed of the Mac and the speed of Keyboard Maestro executing its actions often means doing something like this requires brief pauses between each use of Simulating A Keystroke.
@hemicyon, @NaOH. Nope. I was clicking in the right place. The issue was that, on MacOS, the default for revealing a drop-down with options is to right-click, so that's what I was doing automatically. In this case, however, one instead needs to left-click.
Anyways, that did enable me to get @griffman 's method working. It told me to use "Title: Landscape" (see screenshot below).
The one curious issue is that action, by itself, takes 6 seconds to complete on my 2019 i9 iMac. Don't know why it's so slow compared to my clicking on the button manually. [Removing the "When Enabled" requirement has no perceptible effect on execution time.]
I didn't really catch your original post noting this was in Word. Noticing that now, it's worth pointing out that Word (all of MS Office) has more keyboard-shortcut customization available than most applications. My old version of Word (2011) doesn't seem to show an option for setting a shortcut for Landscape, but it may be worth checking if it can be done in newer versions.
In Word 2011 the keyboard shortcuts can be configured in Tools > Customize Keyboard. From there it can be a little odd tracking down the exact command one wants, but so many are there. Maybe Microsoft has simplified discovery a little in more recent versions.
Yeah, that was the first thing I looked at. Unfortunately, and surprisingly, "Landscape" is not among the listed options within Customize Keyboard.
My other approach was to try making a VBA Macro, since I've made lots of those in Excel, and find they are robust and execute nearly instantaneously.
Unfortunately, the method I'd laboriously learned in order to create VBA Macros in Excel doesn't work in Word. I'm using almost the latest version of both programs (16.89.1, updated Sept. 17, 2024).
I created a Macro identical to yours (see screenshot), rebooted my computer, and shut down all programs except for KBM and Word. Run time was 5 s.
I'm using Word 16.89.1 (updated Sept. 17, 2024).
I've found KBM is always slow on my machine for MS Office apps (though 5-6 s for a single step is a new record for me), particularly compared with using VBA, which seems to execute even a very long sequence of steps in a fraction of a second.
Then again, MS Office in general has always been slow on my machine when I try to interact directly with its interface (i.e., other than through VBA), with frequent spinning beach balls in both Word and Excel.
I use another printer but wanted to test a solution given here. Using the Script UI Properties that Tom refers to, I was able to create a working AppleScript:
tell application "System Events"
tell application process "Microsoft Word"
tell window 1
tell splitter group 1
tell group 2
tell radio button " Landscape"
---click
if value of attribute "AXValue" is not 1 then perform action "AXPress"
end tell
end tell
end tell
end tell
end tell
end tell
Probably because the action is working via Accessibility frameworks, which can be rather slow to "press" the button and also then waits for the dialog to say "Yep, button has been pressed". VBA is hitting Word's API directly, which is why it's so much faster.
Still, 5-6 seconds seems very slow. What OS are you on, and do you have previous versions of Office lying around (which can sometimes cause problems)?
Thanks, I'll test this out when I have the chance. Not sure about the relevance of the printer, though, since I'm simply reformatting the document, not printing it. [The reformatting is useful for when I display it on the screen.]
I'm on MacOS 12.7.6 (Monterey). Tried upgrading to Ventura, but didn't like the reduced contrast, so stayed with Monterey. Will try Sequoia as soon as my university allows it on their VPN.
I don't have earlier versions of Office (I'm on an Office 365 subscription with automatic updates), and frankly it's not worth bothering to check even if I did, since I'm going to continue using the current version regardless. I don't want to risk reconfiguring Outlook, particularly since there were some issues with the older versions.
My Office upgrades stopped when Monterey was deprecated in Sept., but will resume once I switch to Sequoia.
I'm curious--why would the page orientation go through an Accessibility framework?
Not the feature, the means of clicking on the feature.
I had a thought on something else you could use, because the page setup window is always the same size: Move and click the mouse at a fixed offset from a defined corner:
"Previous versions" would Office 2016 and the like, so it would only be a quick check of your Applications folder. O365 installation instructions tell you to remove all previous versions, but few people ever do!
Of course, if you've only ever had O365 on that machine it won't be that that's the problem.