User Tools

Site Tools


Scripting_the_Keyboard_Maestro_editor

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Scripting_the_Keyboard_Maestro_editor [2017/12/15 02:54] – ADD script to get class of object selected JMichaelTXScripting_the_Keyboard_Maestro_editor [2018/04/14 23:02] (current) – Removed script from Section 4 because it won't even compile. JMichaelTX
Line 9: Line 9:
 ===== 1. Selecting Lists of Objects in KM8 ===== ===== 1. Selecting Lists of Objects in KM8 =====
  
-The `selection` property will return whatever is selected, and has focus, in the Keyboard Maestro Editor.  So this could be any of these:  action, macro, macro group.  Here is how to get the selection, and determine the type (class) of the object that is selected:+The `selection` property will return whatever is selected, and has focus, in the Keyboard Maestro editor.  So this could be any of these:  action, macro, macro group.  Here is how to get the selection, and determine the type (class) of the object that is selected:
  
 ```applescript ```applescript
Line 91: Line 91:
 ===== 4. Get and Create Variety of Editor Objects ===== ===== 4. Get and Create Variety of Editor Objects =====
  
 +FIXME [JMichaelTX:  This script removed pending review & update].
  
-```applescript 
-tell app "Keyboard Maestro" 
  
-   properties of group "Enabled" +===== 5. Create Macro Group and Macros =====
-   properties of smart group "Enabled"+
  
-   make new smart group with properties {name:"Enabled", search strings:{"enabled:yes"}} +Before you use a macro group you probably want to check if it exists. The following example tests for the macro group's existence, based on a Keyboard Maestro input variable containing the macro group name -`macroGroup`.
-   set search strings of smart group "Disabled" to {"enabled:no"+
-    +
-   set enable of macro group "Turn Off" to false+
  
-   set name of macro 1 to "Great!"+(This test is case-insensitive. For example macro group "Firefoxcould also be specified as "firefox".)
  
-   tell macro group "New Stuffto make new macro +```applescript 
-       +tell application "Keyboard Maestro Engine
-   set color of action 1 of macro "Bright" to "red+  set macroGroup to getvariable "macroGroup
-    +  if (macroGroup = "") then error "[ERROR]" & linefeed & "Invalid Macro Group Name. KM Variable \"" & "macroGroup" & "\" was empty or undefined." 
-   select action 1 through 3 of action 2 of macro "Working"+end tell
  
-   set selection to global macro group +tell application "Keyboard Maestro-- Editor 
- +  if exists macro group macroGroup then 
-   move first action of macro "Source Macro" to end of actions of macro "Dest Macro+    return true 
-  +  else 
-   move macro "Macro33" to macro group "Test4" +    return false 
-   move (every macro of macro group "Test4" whose name starts with "Macro3") to macro group "Test3" +  end if
-   move macro 2 of macro group "Test3" to macro group "Test4" +
- +
-   delete second action of macro "Target Macro" +
-   +
-   duplicate every macro group whose name starts with "Test" +
- +
-   set m to duplicate action 1 of macro "Macro33" to after action 2 of macro "Macro32" +
- +
-   duplicate (selected macros) to macro group "Test4" +
-   +
 end tell end tell
 ``` ```
  
-===== 5. Create Macro Group and Macros ===== 
  
 Here is a full example that creates a macro group called "Multiple Clipboards" and then creates 9 macros with hot Control-C and action to copy the clipboard to a named clipboard with name "Clipboard N" (where N is 1-9) and another set of 9 macros with hot key Control-V and action to paste from the named clipboard "Clipboard N" Here is a full example that creates a macro group called "Multiple Clipboards" and then creates 9 macros with hot Control-C and action to copy the clipboard to a named clipboard with name "Clipboard N" (where N is 1-9) and another set of 9 macros with hot key Control-V and action to paste from the named clipboard "Clipboard N"
Scripting_the_Keyboard_Maestro_editor.1513306466.txt.gz · Last modified: by JMichaelTX

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki