Jump to content
Sign in to follow this  
Sunblood

Quick Hotkey Question

Recommended Posts

Sunblood

If you set a hotkey (for example, HotKeySet("^{HOME}")) and then later in the script have a Send("") function that sends the hotkey, will the hotkey register in AutoIt?

I.E.

HotKeySet("^{HOME"},"OMG")
Sleep(5000)
Send("^{HOME}")

Func OMG()
   MsgBox(0,"","Roffles.")
EndFunc

I would try it out, but I'm not home.


Share this post


Link to post
Share on other sites
Valik

Yes, you'll throw the script into an infinite loop. You'll need to do something like this (Fixed your typo, too...):

HotKeySet("^{HOME}","OMG")
Sleep(5000)
HotkeySet("^{HOME}")   ; Remove the hotkey...
Send("^{HOME}")
HotKeySet("^{HOME}","OMG")   ; Readd the hotkey

Func OMG()
  MsgBox(0,"","Roffles.")
EndFunc

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.