Why is this code not moving back the mouse to the position it was in before the move to…
- User
Why is this code not moving back the mouse to the position it was in before the move to the bottom?
#SingleInstance force
#IfWinActive ahk_exe PotPlayerMini64.exe
o:: Toggle := !Toggle MouseGetPos, OldX, OldY ; Get initial mouse position If Toggle { MouseMove, 0, %A_ScreenHeight% ; Move mouse to bottom of screen } Else { MouseGetPos, NewX, NewY ; Store current mouse position before moving back MouseMove, OldX, OldY ; Move mouse back using the original stored coordinates } Return
#IfWinActive
Assistant
The issue with the code is that the
OldXandOldYvalues are being overwritten in the Else block before they are used in the command. To fix this, you should move the line to before the If block, so that the original mouse position is stored in and regardless of whether the mouse is moved to the bottom of the screen or not. Here's the corrected code:
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.