Jump to content

Help with HotKeySet


pl123
 Share

Recommended Posts

So, I've been trying to make a loop script, and I'm done with that part.

Now, I can't seem to set a hotkey to make the message box pop up, or cancel the script when I press a certain combo of keys.

For example, I typed

blah blah blah....
....
HotKeySet ("^!d", MsgBox (1, "Paused", "This script has been paused")

then I ran it.

Then, I hit the key combo...but no box popped up.

This is what I have:

Do
...
...
...
Until $i = 1
HotKeySet ("+!d", MsgBox (1, "Paused", "This script has been paused")

Can someone help me?

Link to comment
Share on other sites

Two things you could try:

1) Add another ")" at the end of your HotKeySet line, you never closed that function, just the MsgBox()

2) If you just mistyped that in this thread, then try making a function that has the MsgBox() in it and having HotKeySet call that function.

For those who are asking questions, look in the help file first. I'm tired of people asking stupid questions about how to do things when 10 seconds in the help file could solve their problem.[quote name='JRowe' date='24 January 2010 - 05:58 PM' timestamp='1264381100' post='766337'][quote name='beerman' date='24 January 2010 - 03:28 PM' timestamp='1264372082' post='766300']They already have a punishment system for abuse.[/quote]... and his his name is Valik.[/quote]www.minikori.com

Link to comment
Share on other sites

Im not sure that hotkeyset likes parameters in the function name.

HotKeySet("^!d", "_MsgBox")

While 1
    Sleep(50)
WEnd

Func _MsgBox()
MsgBox(1, "Paused", "This script has been paused")
EndFunc

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

Im not sure that hotkeyset likes parameters in the function name.

Correct, the HotKeySet() function cannot take any parameters.

It does have the @HotKeyPressed macro available, so multiple HotKeySet()'s can reference the same function, and that function can internally decide what to do based on which key was struck.

:D

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...