Page 1 of 1

how to give a combnation of order through single time pressing keysz

Posted: 07 Dec 2022, 18:34
by Shekhar Singh
I use sleep function when i have to give combination of orders (one after another) through ahk.

is there any other way of doing this .

I have heard that combination of square brackets {} can be used to give series of orders can someone guide me on this .


[Mod action: Topic moved from "Other Utilities and Resources". Please pay attention to where you post new threads.]

Re: how to give a combnation of order through single time pressing keysz

Posted: 07 Dec 2022, 19:00
by boiler
That is not true. People erroneously place {Sleep ...} inside of { }, but it does not work that way. Just put a Sleep on its own line between Send lines.

Re: how to give a combnation of order through single time pressing keysz

Posted: 07 Dec 2022, 19:21
by mikeyww
I agree overall. It turns out that Sleep is a key name that can be sent using Send.

In any case, as boiler mentioned, this is not a command in braces, but a key name.

Explained: Key names

Code: Select all

F3::
Send x
Send {Sleep 100}
Send y
Return

Re: how to give a combnation of order through single time pressing keysz

Posted: 07 Dec 2022, 20:15
by boiler
Isn't that key meant to represent keyboard keys that are meant to put your computer in sleep mode (as opposed to executing a Sleep-type delay)?

Image


So when you send {Sleep 1000} it perhaps has a similar effect as the sleep command just because it "wastes time" sending a bunch of non-keypresses (if your machine doesn't recognize it), but isn't really meant to be an alternative to the Sleep command. The documentation doesn't say much or anything on this from what I can tell, though.

And for machines where the actual Sleep key is implemented, I wonder what effect sending it 1000 times in succession might have on your Windows session. Would it toggle it in and out of sleep mode 500 times?

Re: how to give a combnation of order through single time pressing keysz

Posted: 07 Dec 2022, 20:23
by mikeyww
No idea! I'm curious about the answers. I could reverse Fn and try it.

Re: how to give a combnation of order through single time pressing keysz

Posted: 07 Dec 2022, 20:31
by boiler
According to this How-to Geek article where I got the above picture:
Most Windows PCs and tablets include a special sleep button somewhere on the body of the device. To find it, consult your device’s documentation, or look for a keyboard key with a small “Z” or moon icon on it. If you push it, your PC will fall asleep instantly. To wake it up again later, just press the power button, tap the trackpad, or press a keyboard key.
I would hesitate to send that if that's what the Sleep key is, unless your intention is to put your machine into sleep mode, of course.

Re: how to give a combnation of order through single time pressing keysz

Posted: 07 Dec 2022, 20:52
by mikeyww
OK. I guess it should work, and my script was poorly designed! My keyboard has no such key. I think I've seen them on HPs.