Add a Code Text Snippet

I did search the forum here before creating this little macro.

Here is the applescript - change the folder name to the group where you keep your text snippets.

tell application "Keyboard Maestro"
activate
set visible of first window whose name contains "Editor" to true
set windowName to name of front window
tell application "System Events"
	tell process "Keyboard Maestro"
		click group "YOUR_GROUP_NAME" of scroll area 1 of splitter group 1 of group 1 of window windowName
		click menu item "New Macro" of menu 1 of menu bar item "File" of menu bar 1
		click menu item "Insert Text by Pasting" of menu 1 of menu item "Text" of menu 1 of menu item "Insert Action" of menu 1 of menu bar item "Edit" of menu bar 1
		click menu item "Rename…" of menu 1 of menu bar item "View" of menu bar 1
	end tell
end tell
end tell

create_snippet.kmmacros (2.1 KB)