Jump to content

Problem with HotKeySet


 Share

Recommended Posts

Hey all, I just started using AutoIt today, I've been a AHK user for a few years so I am not that new to the language.. but the hotkey system is completely different, and even after looking at other scripts I can't seem to get this to work.

Here is the code I have, just to learn what I am doing at first.

HotKeySet("1", "GetCursor")
Func GetCursor()
$MouseID = MouseGetCursor()
MsgBox(0, "Coursor ID", $MouseID)
EndFunc

All I am attempting to do is hook 1 to the func of GetColor. But as soon as I run the script it exits.

Thanks for your help ;)

* EDIT *

So.. I got it using:

HotKeySet("1", "GetCursor")

While 1
    Sleep(100)
WEnd

Func GetCursor()
$MouseID = MouseGetCursor()
MsgBox(0, "Coursor ID", $MouseID)
EndFunc

Do you really have to have something in between the HotKeySet and the func in order for it to run? If so, is that the best thing I could do?

Edited by Damein

MCR.jpg?t=1286371579

Most recent sig. I made

Quick Launcher W/ Profiles Topic Movie Database Topic & Website | LiveStreamer Pro Website | YouTube Stand-Alone Playlist Manager: Topic | Weather Desktop Widget: Topic | Flash Memory Game: Topic | Volume Control With Mouse / iTunes Hotkeys: Topic | Weather program: Topic | Paws & Tales radio drama podcast mini-player: Topic | Quick Math Calculations: Topic

Link to comment
Share on other sites

you need a loop to keep your script alive

HotKeySet("1", "GetCursor")

while 1
     Sleep(10)
wend

Func GetCursor()
     $MouseID = MouseGetCursor()
     MsgBox(0, "Coursor ID", $MouseID)
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

Alright, thanks.

MCR.jpg?t=1286371579

Most recent sig. I made

Quick Launcher W/ Profiles Topic Movie Database Topic & Website | LiveStreamer Pro Website | YouTube Stand-Alone Playlist Manager: Topic | Weather Desktop Widget: Topic | Flash Memory Game: Topic | Volume Control With Mouse / iTunes Hotkeys: Topic | Weather program: Topic | Paws & Tales radio drama podcast mini-player: Topic | Quick Math Calculations: Topic

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...