Need help with a Mouse Cursor Hide script

Get help with using AutoHotkey and its commands and hotkeys
Wolf_Howlz
Posts: 2
Joined: 05 Nov 2019, 16:05

Need help with a Mouse Cursor Hide script

05 Nov 2019, 16:27

Hello, I'm new to AutoHotKey. I found this script online, and I would like to see if anyone could help me to edit the script so it could work the way I wanted to.
Here is the script:

Code: Select all

SystemCursor(0)
tooltip cursor is hidden for 5 seconds
sleep 5000
SystemCursor(1)
tooltip

SystemCursor(OnOff=1) {
	if (OnOff == 1)
	{
	   BlockInput MouseMoveOff
	   DllCall("ShowCursor", Int,1)	
	} 
	else 
	{
	   MouseGetPos, , , hwnd
	   Gui Cursor:+Owner%hwnd%
	   BlockInput MouseMove
	   DllCall("ShowCursor", Int,0)	
	}
}
[Mod edit: [code][/code] tags fixed]

It works but, I have to click on the script for it to work. It would hide the Cursor for 5 seconds, after 5 secs, it would end and I have to reload the script for it to work again. Can anyone edit this, so that the mouse cursor will hide once the script starts up, and if I were to move the mouse, the cursor would show for about 5 sec. or so. And it would loop until I can turn off the script. It would be nice to be able to watch a movie, browse the web or play a game without having the cursor in plain sight. Thank you for your help.
User avatar
boiler
Posts: 5651
Joined: 21 Dec 2014, 02:44

Re: Need help with a Mouse Cursor Hide script

05 Nov 2019, 18:42

Code: Select all

Status := 1
SetTimer, CheckIdle, 100
return

CheckIdle:
	if (A_TimeIdleMouse > 5000)
	{
		if Status
			SystemCursor(Status := !Status)
	}
	else if !Status
		SystemCursor(Status := !Status)
return

SystemCursor(OnOff=1) {
	if (OnOff == 1)
	{
	   BlockInput MouseMoveOff
	   DllCall("ShowCursor", Int,1)	
	} 
	else 
	{
	   MouseGetPos, , , hwnd
	   Gui Cursor:+Owner%hwnd%
	   BlockInput MouseMove
	   DllCall("ShowCursor", Int,0)	
	}
}
Wolf_Howlz
Posts: 2
Joined: 05 Nov 2019, 16:05

Re: Need help with a Mouse Cursor Hide script

05 Nov 2019, 19:31

Cool, it works, thank you.

Return to “Ask For Help”

Who is online

Users browsing this forum: anhnha, Google [Bot], sobuj53, TAC109, Xeo786 and 36 guests