Automation to set refresh rate on monitor on MAC

Hi every time my mac have been locked or asleep my mac change the refresh rate to a lower rate then i want.
i have tried to record a keyboard maestro macro but i dont work, om not good at scripting or programming so i hope some off you can help me, maybe a bunch script ?

Your refresh rate shouldn’t change when set. What monitor, connection and OS version do you have? Also if you have any video or graphics devices inline between your Mac and monitor, please specify the details.

but it does…
It an macbook pro m1 first model, and im using a 49" samsung monitor with displayport to usb-c.
its set to 120 hz and it work, i have a dock connected for power and other accessories and it does also have the ability to use monitors but i dont use that because i dont support the 120hz, and my guess i thats the problem. so that why i want to automate the manuel change every time it has been to sleep

i have the same setup at home but with a AOC Agon 49" monitor and there no problem with that monitor.

There is more than one 49" sized Samsung branded monitor. If we were to find someone else with the same monitor to compare against, we would need the model number to know what monitor you are actually using.

If you have the same set up at home, are you using exactly the same cable to connect with? If you have a difference in the DP version supported by the cable for instance, I suspect that could cause some difference in behaviour. Remember, not all data transfer cables are identical even if they have the same connectors.

The dock is not inline to the monitor, but presumably you have tried simply having that unplugged as a test to prove it is not that indirectly causing an issue.

I would still recommend digging into understanding the underlying issue first, but if you do have Keyboard Maestro and do need to resort to a workaround, you can record with Keyboard Maestro to playback actions.