Using Accessibility Keyboard Panels To Repeat Key Sequences
Monday April 8, 2019. 03:00 PM , from MacMost
The Keyboard Panel Accessibility feature on your Mac lets you create sequences of keypresses that you can repeat by pressing a button. This could make some unusual tasks easier to perform. In this example we'll use a panel button to repeat an unusual search and style function in Pages.
Video Transcript / CaptionsCLICK TO EXPAND
Closed captioning for this video is available on YouTube: Using Accessibility Keyboard Panels To Repeat Key Sequences.
Hi, this is Gary with MacMost.com. MacMost is brought to you by the more than 300 people that support the MacMost Patreon Campaign. You can find out more, and become a part of it, at macmost.com/patreon.
So today we're going to take a look at something a little unusual. We're going to look at the Accessibility Keyboard and how we can use that to perform complex tests that take multiple keystrokes. So the accessibility keyboard is something under System Preferences, Accessibility, and you go to Keyboard here, then Accessibility Keyboard. You can enable it and what you'll get is a keyboard that's on your screen and you can type by actually clicking the keys on this virtual keyboard.
Now the real purpose of this is to be used with other hardware so that you can type if you're not able to use the regular keyboard. But an interesting feature of it is these are panels and you can create panels actually if you go to Panel Editor you'll see that there's this panel, the regular anti keyboard panel, and also a numeric one as well. You can add new ones. So we'll add a new one and we'll call it My Shortcuts. This is empty right here. We can actually add buttons to it.
So we'll create a button here that does something specific. Let's call this button Test. We see we can edit the name here. You get to do things like change the font size, position, and even include an image in it. Its color, a spoken phrase that happens when you activate it, and an Action. So the Action is what we're going to be looking at today. There's a few things you can do in here like you can trigger an apple script, you can enter text so I have like a phrase. It's kind a similar thing to using some text replacement. You can open an app with one of these buttons.
We're going to be looking at Press Keys which allows you to give a series of key presses and repeat those by just clicking this button. So, for instance, if I wanted to go to the end of every line in a Pages document and add a period I could do that if I were to do, let's say, Command right arrow. So I'll just hit Command and right arrow and you can see it entered it in there. Type the period and then a forward arrow to go to the next line. So I'll Stop recording here and I'll call this button here Period at End. Now the next thing I want to do is I want to click here on the panels and go to My Shortcuts. You see I had a quick way to click into it and I get the panel controls here.
So here I can select which apps to show this panel in automatically. I can change it to be as the Home panel which is what I'm going to do. So now it will show up in place of this one. Now I'm going to do Save and enter Yes and I'm going to get a little panel here with my one button in it. So now let's try that out. Let's go into Pages here and you can see this floats on top. I'm going to put the cursor here at the end of a line and I'm going to hit Period at End and it should repeat those keys. Go to the end of the line, enter a period, and then go forward one character to the next line. You can see that's what it does. I can actually continue to press that and you can see it adds a period at the end. I'm going to Undo there. So that's one example.
So here's another example of something that's almost impossible to do otherwise. I'm want to highlight, or Bold, all of the words with the letter B in them. So, in other words, find the text that has some text inside of it, select it, change it to bold, and to be able to easily do it through the entire document. Now normally that would be difficult. I can't Find and Replace. I don't want to just bold that letter. I want to bold the entire word containing that letter. So the first thing is to figure out a key sequence. So a good key sequence here is Command F and then type the letter B, by the way I would make sure you have Whole Words turned off so it's looking for that letter. Once you've type the letter B then next thing I want to do is Return and you can see it goes to the next selection there. That's fine. Then I want to close this window. The way you close windows on the keyboard is Command W. I want to stick to just keyboard commands while doing this.
Now I've got a letter in a word selected. So how can I select the entire word. It's tricky but you can use the Option key to do it. One thing that works in all cases no matter if it's the first letter, last letter, or middle letter is to use the right arrow to go forward one, then the Option left arrow to go to the beginning of the word, and then Shift Option right to select the entire word. Now that it's selected I can do Command B for bolding. Now if I leave it there the next time I run this it's going to find that same B. So I'm going to do right arrow once to go to the end of the word so the next time I use the button it finds the next one.
So now that I've got that sequence down let me Undo and let's go back to the Panel Editor and add this as a button. So we'll add a button. We'll position it where we want there. We'll do Words with B as the name. The Action will be Press Keys. So we have to remember the sequence now. The sequence was, sorry I have to hit Record, Command F for Find. Then B, define B and return. Then Command W to close that window. Now it should have that letter selected. So now you want to do the forward arrow, Option left to go to the beginning of the word, Shift Option right to select the entire word and Command B to Bold it and one more forward arrow just to go to the end of that word.
So I'll stop recording. I've got this here. Let me go and Save this and it will update that panel. Let's switch to our Pages document. I'll go to the beginning there and I'll hit Words with B. You can see it did it for the word by. Let's do it again, best, billows, bright, because. Excellent. So I can just continue to press this button a bunch of times and it will work. So one of the things you can do so you don't have to keep clicking the button is you can turn this option on. Treat as a sticky key. So repeat until activated again. So you click it once and it keeps repeating and then you click it again to stop. But in practice for things like this it's kind of clunky because it kind of gets ahead of itself. There's a bunch of times it issues those commands and you try to turn it off and it's still going. So you know experiment with that one and see if it's useful in situations like this.
How To Use Keyboard Accessibility Features On Your Mac, Printable Mac Keyboard Shortcut Page For macOS Mojave, Creating Dynamic Pop-Up Menus In Numbers With AppleScript, How To Use Speech Accessibility Features On Your Mac
Aug, Mon 3 - 16:30 CEST