Hi,
why does Switch/Case
offer a much smaller set of conditions than If Then Else
? Why can't I check for example with Switch/Case
if a certain application is running?
Chris
Hi,
why does Switch/Case
offer a much smaller set of conditions than If Then Else
? Why can't I check for example with Switch/Case
if a certain application is running?
Chris
The Switch action only does text/clipboard matching rather than generic conditions (otherwise each switch case entry would have to specify the full condition).
It is possible I will add some sort of โelse ifโ clause to the If Then Else action to allow you do do the sort of thing you want, but currently you just have to use nested If Then Else actions.
Hey Chris,
You can. You just have to be a little creative.
Download โข Case Construct -- Is App Running?.kmmacros (8.1 KB)
Personally I think Keyboard Maestro's method of getting running app names is overly complicated and would use an Execute an AppleScript action with this code:
tell application "System Events"
set AppleScript's text item delimiters to linefeed
return ((name of processes whose background only is false) as text) & linefeed
end tell
Although I'd like to see @peternlewis add a ListRunningApps()
token to the Keyboard Maestro lexicon.
-Chris
I agree. This would be very useful.