wolflake Posted February 20, 2021 Share Posted February 20, 2021 Every now and then I come back to my two big monitors and I can't find the mouse cursor. I'm moving the mouse around but don't seem to be looking in the right place or the right screen. In a few seconds I feel like and idiot and it is very irritating. So finally I wrote a program that waits for 5 minutes of idletime (no keyboard or mouse movement) and draws a nice red circle around the mouse cursor. That I can spot easily, even from across the room as I walk up to the computer. It works nicely coming back from sleep mode if I press a key. If I moved the mouse to come out of sleep I can press the middle mouse button to show the red ring. As soon as I move the mouse it disappears. It has a tray menu so you can change the amount of idletime before it turns on and there is another menu choice to Exit. You can compile the script and set a link in your start menu to come on every day if you like it. I'm attaching a circle icon for the taskbar icon and the exe icon in case want to use it. Thanks to Bam and martin for the circle code using window regions expandcollapse popup;circle around mouse cursor #AutoIt3Wrapper_Icon=circle2.ico #NoTrayIcon #include <GUIConstants.au3> #include <WindowsConstants.au3> #include <timers.au3> #include <misc.au3> ;Thanks to Bam and martin for the circle code using window regions https://www.autoitscript.com/forum/topic/85970-draw-a-circle-around-the-mouse/ Global $IdleTime = 5 * 60000 ;change the 5 to the number of minutes before circle appears Opt("TrayMenuMode", 3) ;The default tray menu items will not be shown and items are not checked when selected. These are options 1 and 2 for TrayMenuMode. Opt("TrayOnEventMode", 1) ; Use event trapping for tray menu TraySetToolTip("ms-circle") TrayCreateItem("SetTime") TrayItemSetOnEvent(-1, "__SetTime") TrayCreateItem("Exit") TrayItemSetOnEvent(-1, "_bye") TraySetIcon("circle2.ico") TraySetState() $iCircleR = 20 ; <=== Edit this for different circle radius (in pixels) $iCircleD = $iCircleR * 2 $pt = MouseGetPos() $GUI = GUICreate("test", $iCircleD, $iCircleD, $pt[0] - $iCircleR, $pt[1] - $iCircleR, $WS_POPUP, $WS_EX_TOPMOST) GUISetBkColor(0xFF0000) $a = _CreateRoundRectRgn(0, 0, $iCircleD, $iCircleD, $iCircleD, $iCircleD) $b = _CreateRoundRectRgn(4, 4, ($iCircleD - 8), ($iCircleD - 8), ($iCircleD - 4), ($iCircleD - 4)) _CombineRgn($a, $b) _SetWindowRgn($GUI, $a) GUISetState(@SW_HIDE) While 1 Sleep(250) _chk_Idle() WEnd ;*** Functions *** Func _CreateRoundRectRgn($l, $t, $w, $h, $e1, $e2) $ret = DllCall("gdi32.dll", "long", "CreateRoundRectRgn", "long", $l, "long", $t, "long", $l + $w, "long", $t + $h, "long", $e1, "long", $e2) Return $ret[0] EndFunc ;==>_CreateRoundRectRgn Func _CombineRgn(ByRef $rgn1, ByRef $rgn2) DllCall("gdi32.dll", "long", "CombineRgn", "long", $rgn1, "long", $rgn1, "long", $rgn2, "int", 3) EndFunc ;==>_CombineRgn Func _SetWindowRgn($h_win, $rgn) DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $h_win, "long", $rgn, "int", 1) EndFunc ;==>_SetWindowRgn Func __SetTime() Local $sd, $min $sd = "Number of minutes" $min = InputBox("Now " & $IdleTime / 60000 & " minutes", $sd, "", "", -1, 122 + (13.2 * UBound(StringRegExp($sd, '\R', 3)))) if $min > 0 then $IdleTime = $min * 60000 EndFunc ;==>__SetTime Func _bye() ToolTip("Exiting") Sleep(1000) ToolTip("", 500, 300) Exit EndFunc ;==>_bye Func _chk_Idle() If _Timer_GetIdleTime() > $IdleTime Or _IsPressed(04) Then ;1 minutes idle Local $wh = WinGetHandle("[active]") $pt = MouseGetPos() GUISetState() GUISetState(@SW_DISABLE) If Not @error Then WinMove($GUI, "", $pt[0] - $iCircleR, $pt[1] - $iCircleR) WinActivate($wh) While 1 $ap = MouseGetPos() If $ap[0] <> $pt[0] Then ExitLoop EndIf Sleep(1000) WEnd GUISetState(@SW_HIDE) EndIf EndFunc ;==>_chk_Idle circle2.ico Gianni and argumentum 2 Link to comment Share on other sites More sharing options...
Exit Posted February 20, 2021 Share Posted February 20, 2021 I use the mouse settings for this. Simply activate the checkbox. Unfortunately the picture is from a German system. Maybe someone can post an English picture. wolflake 1 App: Au3toCmd UDF: _SingleScript() Link to comment Share on other sites More sharing options...
water Posted February 20, 2021 Share Posted February 20, 2021 (edited) I use this setting too and never had to search my mouse pointer since. https://www.isunshare.com/windows-10/show-pointer-location-with-ctrl-key-in-windows-10.html Edited February 20, 2021 by water Added link wolflake and Exit 2 My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 20, 2021 Moderators Share Posted February 20, 2021 (edited) Exit, In Win 10 Settings open the <Devices> - <Mouse> - <Additional mouse options> - you find that option at the bottom of the <Pointer Options> tab. M23 Edit: Just as water shows. Edited February 20, 2021 by Melba23 wolflake 1 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
wolflake Posted February 20, 2021 Author Share Posted February 20, 2021 (edited) Thanks for the support guys! I found it and turned it on. @Melba23 thanks for giving me the extra steps to get to the right place in window settings as I'd been to the mouse settings before and not gone to "Additional mouse options" I did have fun imagining, writing and using my program even if Microsoft had the idea much earlier so it was not a really a waste of time. I had this idea about a round thing... might call it the wheel. Edited February 20, 2021 by wolflake Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 20, 2021 Moderators Share Posted February 20, 2021 wolflake, Quote not a really a waste of time Absolutely not! A really clever solution for doing something you needed. But your "Google-fu" perhaps needs some improvement! M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Werty Posted February 20, 2021 Share Posted February 20, 2021 I usually just right click the mouse, then the noticable context menu pops up, which the desktop and most programs have. Some guy's script + some other guy's script = my script! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now