Jump to content
Sign in to follow this  
pl123

Help with HotKeySet

Recommended Posts

pl123

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?

Share this post


Link to post
Share on other sites
Minikori

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

Share this post


Link to post
Share on other sites
JohnOne

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.

Share this post


Link to post
Share on other sites
madScientist

HotKeySet needs to be put BEFORE the loop if you want to use it inside the loop.

Share this post


Link to post
Share on other sites
PsaltyDS

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

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.