How to turn off screen using a script

I’ve a PC and a MacMini sharing one keyboard and a mouse with a program called “Synergy”.
I’ve a TFT monitor with DVI (PC) & VGA (MacMini).
I need a script to send a combination of keys and then turn off screen. This way, I could activate de PC (in Windows I’ve made a program to get this).

Thx!

Daliphant.

If you are saying you can already do this with Key presses. Then what are they.
Also I assume its synergy that it is done within synergy

More info please

Using applescript to press keyboard buttons can be done using the following pattern where “key” is the actual button that you need pressed and “modifier” is “command”, “option”, “shift”, “control” or whatever.

keystroke key using modifier

Once you have that in order, I would imagine that you’re wanting to put your Mini to sleep via the finder.

tell application "Finder" to sleep

I don’t know if this is what you need, but I hope it helps.:slight_smile:

With “sleep” I can switch to PC, but not return, since Macmini system is sleep, and “Synergy” go disconnected…
Another command to “sleep” only the screen (like the powersaver)?

Thx!