In other words, I have multiple-selected some Macro Groups and I would like to find the total number of Macros those Groups contain. In this case there are 314 Macros in those selected Groups. I can see the number (in the image above) but I can't find a way to have that number as a Variable to make use of. I wonder if there is an AppleScript that can return this number? Thanks for any help.
(I am making a Progress Bar and can use that total to calculate progress of a Macro that works its way through each Macro in selected Groups.)
The following macro will return the macro count. It just extract the text of the text element. If you want something more robust, another way is to use Applescript to get all selected macro groups and then retrieve their macro count and sum them up.
This is something more robust since it does not depend on UI element positioning, and using Applescript to retrieve the macro groups and their macros for the count
tell application "Keyboard Maestro"
set grpList to selected macro groups
set totalMacroCount to 0
repeat with curGroup in grpList
set macroList to every macro of curGroup
set macroCount to length of macroList
set totalMacroCount to totalMacroCount + macroCount
end repeat
return totalMacroCount
end tell
Yes, that is stronger, as I was finding the Text solution could sometimes return for example, "1 of 773 Selected" instead of "773 Macros" which then made extracting the total harder.
ComplexPoint,
just curious, how do you find out those methods of Application("Keyboard Maestro") since there is no documentation? I try to query the Application object but to no avail.