Miranda Posted July 25, 2011 Posted July 25, 2011 So, I switched to Windows 7 not terribly long ago, and I was all happy and stuff... However, for replaying terribly old games I need to use _MouseTrap due to my two monitors, and the script I do this with is this: (some game specific lines/tooltips removed) Func _mouselock() Dim $dimi[50] $dimi[0] = 4 $dimi[1] = "Jagged Alliance 2" $dimi[2] = "Neverwinter Nights v.8109" $dimi[3] = "Deus Ex : Invisible War" $dimi[4] = "Outcast - Wed May 10 11:59:24 2000" For $i = 1 To $dimi[0] If WinActive($dimi[$i]) And $mouselocked = 0 Then _MouseTrap(0, 0, @DesktopWidth, @DesktopHeight) $mouselocked = 1 $activewin = WinGetHandle("") EndIf Next If Not WinActive($activewin) And $mouselocked = 1 Then _MouseTrap() $mouselocked = 0 EndIf EndFunc ;==>_mouselock It used to work flawlessly, but it doesn't anymore... So I did some toying around, and made this simple script: #include <Misc.au3> sleep(1000) _MouseTrap(0, 0, @DesktopWidth, @DesktopHeight) While 1 sleep(1000) Wend And to my surprise, the MouseTrap doesn't work... Or actually, more precisely, it will snap the mouse back to the defined area once, and that's it. I haven't managed to get MouseTrap to work under Win 7. Incidentally, the same thing happens if in a game, if I change the script to _MouseTrap every 3 seconds, every three seconds the mouse will pop back to screen, but it never sticks. I did some digging, and found that MouseTrap is ClipCursor, and after some googling I didn't find any reports that it doesn't work with Windows 7, so is it just me? I did however read somewhere that ClipCursor stops working when they alt+tab, so maybe it has something to do with the Autoit script not being the active window? Anyways, I'm stumped, any input (even if it's a different solution to stop the cursor from going off-screen while in a full screen application), is appreciated!
Blue_Drache Posted July 25, 2011 Posted July 25, 2011 Unfortunately, since you've already revealed that it is for the automation of games, I doubt this will stay open very long. Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache
Valik Posted July 25, 2011 Posted July 25, 2011 From the sounds of your problem the fact that games are involved is incidental and not relevant. I suggest you learn from this and in the future provide only relevant information. Thread locked since it violates the rules.
Recommended Posts