refocusing my mouse cursor to the keyboard cursor Topic is solved

Get help with using AutoHotkey and its commands and hotkeys
AmDeG 11
Posts: 385
Joined: 28 Nov 2013, 11:42

refocusing my mouse cursor to the keyboard cursor

05 Jan 2021, 11:23

I want to add before this script that the mouse pointer should move to the area where my keyboard cursor is

Code: Select all

^!k:: Send {WheelDown} ; scroll down 5
^!i:: Send {WheelUp} ;: 1; scroll down 1
AmDeG 11
Posts: 385
Joined: 28 Nov 2013, 11:42

Re: refocusing my mouse cursor to the keyboard cursor

10 Jan 2021, 13:45

this works for the first time

Code: Select all

^!k:: ; scroll down 1
      MouseMove A_CaretX,A_CaretY
      Send {WheelDown}
      Return
^!i:: ;scroll up 1
      MouseMove A_CaretX,A_CaretY
      Send {WheelUp} 
      Return
but then there is a problem with the cursor, and at certain case stops working since the Mouse goes to the top of the screen

I think the solution is that only for the first time have this line but when mouse is realy close to keyboard, the script be just

Code: Select all

MouseMove A_CaretX,A_CaretY
how can I do that? that when they are together the script would be only

Code: Select all

Send {WheelDown}
User avatar
mikeyww
Posts: 5104
Joined: 09 Sep 2014, 18:38

Re: refocusing my mouse cursor to the keyboard cursor

19 Jan 2021, 19:48

Code: Select all

CoordMode, Caret, Client
marginUpper := 120, marginLower := 40

F2::
Send {PgDn}
WinGetPos,,,, height, A
Sleep, 100
If (A_CaretY > marginUpper && A_CaretY < height - marginLower)
 MouseMove, A_CaretX, A_CaretY
Return
AmDeG 11
Posts: 385
Joined: 28 Nov 2013, 11:42

Re: refocusing my mouse cursor to the keyboard cursor  Topic is solved

21 Jan 2021, 22:24

thanks mike!

if someone is interested in the answer:

Code: Select all

^!k::  ;smoothly scroll down
      WinGetActiveTitle, WordOver
      MouseGetPos,,, uid
      WinGetTitle, mouseOver, ahk_id %uid%
      If (WordOver = mouseOver)
          Send {WheelDown}
          else
          MouseMove A_CaretX,A_CaretY
          Send {WheelDown}
   Return
^!i::  ;smoothly scroll up
      WinGetActiveTitle, WordOver1
      MouseGetPos,,, uid
      WinGetTitle, mouseOver1, ahk_id %uid%
      If (WordOver1 = mouseOver1)
          Send {WheelUp}
          else
          MouseMove A_CaretX,A_CaretY
          Send {WheelUp}
   Return

Return to “Ask For Help”

Who is online

Users browsing this forum: Bing [Bot], nacken012, viv and 54 guests