350z
350z

Reputation: 11

autohotkey to put my laptop to sleep works once

The script below puts my laptop to sleep when I hit alt+0, it works once at the beginning, until I log back in, and then it doesn't.

After the first attempt, the script doesn't adhere to the 2 sleeps I inserted, it blazes right through each line, and doesn't put my laptop to sleep. If I reload the script, it works.

Not sure why?

I am using Windows 7 64 bit

!0::


send ^{Esc}

send {Right}

send ^{Right}

sleep 2000

send {Up}

sleep 2000

send {enter}


return

Upvotes: 1

Views: 128

Answers (1)

Forivin
Forivin

Reputation: 15488

Try:

!0::
    DllCall("PowrProf\SetSuspendState", "int", 0, "int", 0, "int", 0)
Return

Upvotes: 1

Related Questions