I currently use this macro to create a global macro whenever I run it from any app:
Make global macro.kmmacros (26.5 KB)
However it's not as fast I like it to be. Is there a faster way, ideally instantly to do the same?
I currently use this macro to create a global macro whenever I run it from any app:
Make global macro.kmmacros (26.5 KB)
However it's not as fast I like it to be. Is there a faster way, ideally instantly to do the same?
Hey Nikita,
Sure.
Don't drive the UI, when a task can be scripted instead.
-Chris
----------------------------------------------------------------
# Auth: Christopher Stone
# dCre: 2019/01/25 06:15
# dMod: 2019/01/25 06:15
# Appl: Keyboard Maestro
# Task: Create and Select a New Global Macro in Group "Global Macro Group".
# Libs: None
# Osax: None
# Tags: @Applescript, @Script, @Keyboard_Maestro, @Create, @Select, @New, @Global, @Macro
----------------------------------------------------------------
tell application "Keyboard Maestro"
activate
tell macro group "Global Macro Group"
set newMacro to make new macro with properties {name:"New Global Macro"}
end tell
select macro group "Global Macro Group"
select newMacro
end tell
----------------------------------------------------------------
Hey Nikita,
This will be a trifle faster.
-Chris
----------------------------------------------------------------
# Auth: Christopher Stone
# dCre: 2019/01/25 06:15
# dMod: 2019/01/25 07:07
# Appl: Keyboard Maestro
# Task: Create and Select a New Global Macro in Group "Global Macro Group"
# : then Select the Macro Name Field .
# Libs: None
# Osax: None
# Tags: @Applescript, @Script, @Keyboard_Maestro, @Create, @Select, @New, @Global, @Macro, @Name, @Field
----------------------------------------------------------------
try
tell application "Keyboard Maestro"
activate
tell macro group "Global Macro Group"
set newMacro to make new macro with properties {name:"New Global Macro"}
end tell
select macro group "Global Macro Group"
select newMacro
end tell
tell application "Keyboard Maestro"
activate
tell macro group "Global Macro Group"
set newMacro to make new macro with properties {name:"New Global Macro"}
end tell
select macro group "Global Macro Group"
select newMacro
end tell
tell application "System Events"
tell application process "Keyboard Maestro"
tell window "Keyboard Maestro Editor"
tell group 1
tell splitter group 1
tell scroll area 3
tell scroll bar 1
if value ≠ 0 then set value to 0
end tell
if exists (first text field whose accessibility description is "Macro Group Name") then
tell (first text field whose accessibility description is "Macro Group Name")
set focused to true
end tell
else
tell (first text field whose accessibility description is "Macro Name")
set focused to true
end tell
end if
end tell
end tell
end tell
end tell
end tell
end tell
on error e number n
set e to e & return & return & "Num: " & n
if n ≠ -128 then
try
tell application (path to frontmost application as text) to set ddButton to button returned of ¬
(display dialog e with title "ERROR!" buttons {"Copy Error Message", "Cancel", "OK"} ¬
default button "OK" giving up after 30)
if ddButton = "Copy Error Message" then set the clipboard to e
end try
end if
end try
----------------------------------------------------------------