Trigger macro

please how can i trigger macro
when :
the time is 9 am every day
and
the lid of the mac-book is open

9am every day can be done with the Time of Day trigger.

You cannot have "AND" triggers, and in any event “the lid is open” is not a trigger (event), it is a state.

So your macro needs to trigger and then detect the state of the lid.

Note that Keyboard Maestro will not run at all if the Mac is sleeping.

I don't know how to detect if the lid is open, I would search for something like "AppleScript lid is open" and see if you get any results.

i have tool call "no sleep"
that prevent mac from sleep
when i close the lid

can you give me please
if state
that "if the lid is close"
make some sound (i will change this action by my self )
thank you

After some searching around I found this script which should work:

ioreg -r -k AppleClamshellState | grep '"AppleClamshellState" = Yes' | cut -f2 -d"="

Run it in an Execute a Shell Script action and it should return Yes if the lid is closed and No if the list is open (and nothing if it is not a laptop).

Run it in the Terminal and make sure it works on your system.