Condition based on whether multiple screens are detected?

I have a macro that is triggered every time my computer wakes from sleep.

This macro is relevant and useful when I have my usual home office setup, which is having my MacBook Pro connected to my Apple Studio Display.

However, when I'm traveling, i.e. with just my MacBook Pro without my Apple Studio Display, then this macro is not useful or relevant, so I'd prefer to not have it run as usual.

What I was thinking was adding an action to the beginning of this macro where, if more than one screen is detected, then the macro proceeds as usual, and where otherwise the macro is terminated.

Is there a way to do this? Specifically, is there a way to check if multiple screens are detected, so to do what I just described?

An IF action can test the number of screens reported by something like this:

Expand disclosure triangle to view JS source
ObjC.import("AppKit")

return Number($.NSScreen.screens.count)

but more natively, see the SCREENCOUNT() function:

function:SCREEN [Keyboard Maestro Wiki].)

function:SCREENCOUNT [Keyboard Maestro Wiki]

1 Like

Either use check local network for your home network or screencount ()

see also trigger:Wireless Network [Keyboard Maestro Wiki]

1 Like

Another vote for the built-in SCREENCOUNT() function:

image

1 Like