Back in Mid-May, 2020, I found myself captioning hours of videos for various High Priority reasons (COVID-19, Global Accessibility Awareness Day, Commencement, etc.) and getting frustrated with the process. One thing that specifically irritated me was counting out each caption's characters per line ensuring they were 32 characters or less to maintain accordance with the Described and Captioned Media Program (DCMP) Closed Captioning Standards (URL: https://www.3playmedia.com/2015/11/06/dcmp-closed-captioning-standards/).
My traditional method of parsing out some Auto-generated captions, involved placing my cursor at the beginning of the caption text and hitting the right-arrow key 32 times. This allows me to see where I need to place a line-break in the captions, or create a new caption entirely.
I started digging around on the Internet and found a way to write an AppleScript that would take the current cursor position, hold down the shift key and hit the right arrow 32 times, so that I can visually see the text that gets selected via this script. I also wanted to invoke that AppleScript by programming a shortcut key in the System Preferences. Below are the steps I followed to create this time-saving shortcut:
- I opened Automator by typing ⌘␣ (spacebar) on the keyboard and typing "Automator".
- I clicked on Quick Action as the document type:
and hit the "choose" button.
- I chose "Run AppleScript" from the Actions:
- I kept the default values of the fields (Workflow receives, ..., Color), and pasted the following code block text field, replacing the default code with:
tell application "System Events"
repeat 32 times
key code 124 using {shift down}
end repeat
end tell
- I saved this Quick Action as "Quick Action - Highlight 32 Characters".
- Next, I went to System Preferences > Keyboard > Shortcuts > and found " Quick Action - Hig...ight 32 Characters" listed under Services. I set shortcut keys to ⌃⌘→ (control, command and the right arrow)
- I was prompted to "allow Automator to control my computer", entering my password.
- I went back to my browser, placed my cursor at the beginning of a caption, hit ⌃⌘→, and Voila! 32 characters were highlighted past where I placed my cursor.
Currently I only have this shortcut for Mac OSX, but am looking to make the same kind of shortcut for Windows 10 users.