Jump to content
Sign in to follow this  
premiumg

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

Recommended Posts

premiumg

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

Share this post


Link to post
Share on other sites
premiumg

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?

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.