Jump to content

Function to hide mouse cursor? (until certain keyboard combo pressed)


 Share

Recommended Posts

I'm building a HTPC and this mouse cursor is always in the middle of the TV screen. I am not using Media Center but a different software. I'd like to have a script run on startup that hides the mouse cursor until a certain keyboard combo is pressed (i.e. ESC + ALT)

I'm very new to AutoIt so please help me! I'm looking through the help file at mouse commands but I don't see anything to hide cursor.

Edited by premiumg
Link to comment
Share on other sites

This is not hiding but should work for your case.

#include <Misc.au3>

HotKeySet("{F10}", "ReleaseMouse")
$MousePos = MouseGetPos()
_MouseTrap(@DesktopWidth, @DesktopHeight, @DesktopWidth, @DesktopHeight)
While 1
    Sleep(150)
WEnd

Func ReleaseMouse()
    _MouseTrap()
    MouseMove($MousePos[0], $MousePos[1], 0)
    Exit
EndFunc
Thanks man, seems to work. Can you tell me what the code does?

What does sleep(150) do?

This program seems to move the cursor off the screen rather than hide it, correct?

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