A marco to enable and start screen share on mac?

A marco to enable and start screen share on mac? As I can't find any action relates to screen share.

Screen sharing is just an application (named Screen Sharing) in your Applications > Utilities folder. So starting it would be as simple as using the Activate a Specific Application action in Keyboard Maestro. You could then use keys to navigate the list of servers in the window, or send Command-N to put up the new connection dialog, etc.

Enabling and disabling it is trickier, as that is handled through System Settings. In the past, you could enable and disable it via a somewhat complicated Terminal command. I don't know if it still works in Sonoma, though.

Using AppleScript and UI browser, I put together this little snippet that toggles the setting in macOS Sonoma:

activate application "System Settings"
tell application "System Events"
	tell process "System Settings"
		set currentSharing to get value of checkbox 3 of group 1 of scroll area 1 of group 1 of group 2 of splitter group 1 of group 1 of window "Sharing"
		if currentSharing = 1 then
			set currentState to "enabled"
			set newState to "disable"
		else
			set currentState to "disabled"
			set newState to "enable"
		end if
		display dialog "Screen sharing is currently " & currentState & ". Would you like to " & newState & " it?" buttons {"Yes", "No"} default button "Yes"
		set theAnswer to button returned of the result
		if theAnswer is "Yes" then
			click checkbox 3 of group 1 of scroll area 1 of group 1 of group 2 of splitter group 1 of group 1 of window "Sharing"
		end if
	end tell
end tell

This can probably be improved by others—I'm not great at AppleScript—but it seems to work.

-rob.