That macro puts the text into an instance variable, which is used as text input to the translation shortcut which it calls. When triggered it calls the subroutine, which copies the text to a named clipboard, dumps that into an instance variable (in the subroutine), clears the named clipboard, and then returns the text to the original calling macro. Download Keyboard Maestro Macro: Translate Selection to French.įor this example, I’ve given the macro a trigger of CTRL + OPT + CMD + 8.We can then use this in another macro to pass the selection via an instance variable into the shortcut action, which is set with Input Type “Text”. Download Keyboard Maestro Subroutine: Get Current Selection.Getting the selected text is something I use quite a lot in my Keyboard Maestro macros, so with v10, I set up a macro as a subroutine to make getting the current text selection even easier. We know that the shortcut is expecting some text to translate, but where would we get the text from? Well, let’s use Keyboard Maestro to pass the current text selection to the shortcut. Now we have this shortcut, let’s see how we can use the plugin to set up a call to it. We will start with a Shortcuts shortcut that takes some text input and then speaks it back to us, translated into French. Results can be set to output to any of the standard Keyboard Maestro options. The path of the file to pass to the shortcut if the Input Type has been set to File. The text to pass to the shortcut if the Input Type has been set to Text. When set to File, it will pass the file for the path specified in the Input File Path field. When set to Text, it will pass the text in the action’s Text Input field to the shortcut. It defaults to None, meaning that no input will be passed to the shortcut. This drop down list has three options - None, Text, and File. The name field is mandatory and is the name of the Shortcuts shortcut to be executed. When you add this action to a macro, you will see the following Once installed, you should see a new action listed in the Third Party Plug Ins category - Run Apple Shortcut. Drag and drop the plugin ZIP file onto the Keyboard Maestro dock icon.Ensure that the Keyboard Maestro editor is open and the dock icon is visible.If it automatically decompresses on download, just ZIP the folder up again. However, I thought it would be fun to create a convenience plugin to make it even easier to integrate Keyboard Maestro with Shortcuts. Shortcuts can be triggered on macOS using AppleScript or shell script, both of which are relatively easy to do with the Swiss Army knife of Mac automation, Keyboard Maestro. With the public release of macOS Monterey, I have been trying out a few ways of interacting with Shortcuts from a number of automation tools. As of version 10.1 (released May 2022), Keyboard Maestro now has native support for Apple Shortcuts and I would recommend using the native macro actions over this plugin.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |