Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate

Second Mouse Cursor (Alpha)


  • Please log in to reply
19 replies to this topic
HotKeyIt
  • Moderators
  • 7439 posts
  • Last active: Jun 22 2016 09:14 PM
  • Joined: 18 Jun 2008

is any second mouse script for windows7 ?

Why don't you give it a try :)

majkinetor
  • Moderators
  • 4512 posts
  • Last active: Jul 29 2016 12:40 AM
  • Joined: 24 May 2006
Very interesting idea. Great implemenation HotKeyIt too.

Works on Windows7 too.

However, it doesn't click everything. For instance I couldn't make it to activate window menu. Also, clicking some stuff produces different effects then what happens with the mouse. Click the StartMenu to see that ESC stops working (you need to click elsewhere to close the menu)
Posted Image

RIST
  • Members
  • 39 posts
  • Last active: Aug 17 2012 08:36 PM
  • Joined: 08 May 2008
in my w7 dont work any second cursor, :/
Keegi Siin ka Eestlane? :)

shajul (offline)
  • Guests
  • Last active:
  • Joined: --
It would be good to add a check like this on top of the script.. Otherwise dumb ones like me will miss the whole point of the script :p
If not GetKeyState("NumLock","T")
	{
	MsgBox, 4, Numlock Off, Numlock is off. Script will only work if numlock is on. Activate?
	IfMsgBox, No
		ExitApp
	Send, {Numlock}
	}	


! Note ! some of the examples are only to show the effect of value, you definitely should change it to your needs
I hope you find it useful

MainHotkey=      ~LWin|~<^RAlt|~CapsLock|~<^<Alt|Numpad0|NumpadDot

;!!!   the higher the value the slower mouse will move   !!!
speed=         2.5|5|7|10|20|50
startdelay=      30|10|20|40|10|100

color=         0000FF|FF0000|00FF00|AA55EE|EEFF00|553344

KeyUp=          w|Numpad8
KeyDown=        s|Numpad2
KeyLeft=        a|Numpad4
KeyRight=       d|Numpad6
KeyUpLeft=      Numpad7
KeyUpRight=     Numpad9
KeyDownLeft=    Numpad1
KeyDownRight=   Numpad3
Exit=           Escape

;=======================================================================================
#persistent
#MaxHotkeysPerInterval,1000
SetWinDelay,0
SetBatchLines,-1
CoordMode,ToolTip,Screen
CoordMode,Mouse,Screen
StringSplit,color,color,|
StringSplit,speed,speed,|
StringSplit,startdelay,startdelay,|
keys=KeyUp|KeyDown|KeyLeft|KeyRight|KeyUpLeft|KeyUpRight|KeyDownLeft|KeyDownRight
Loop,Parse,MainHotkey,|
{
   hotkeyvar:=RegExReplace(A_LoopField,"\<|\>|\*|\$|\^|\!|\+|\~")
   Hotkey,$%A_LoopField%,Main,UseErrorLevel
   If ErrorLevel
      MsgBox You cannot use HotKey: $%A_LoopField%`nProgram will not work if this is the only Main hotkey
   else
      %hotkeyvar%:=A_Index
}
return

Main:
mainhotkey:=A_ThisHotkey
thishotkey:=RegExReplace(A_ThisHotkey,"\>|\<|\*|\$|\^|\!|\+|\~")
Tooltip:=%thishotkey% ;assign number of tooltip
Loop,Parse,keys,|
   Loop,Parse,%A_LoopField%,|
      Hotkey,% "$*" A_LoopField,Move,On
Hotkey,*%Exit%,Exit,On
If !x%Tooltip%
   ToolTip % "   `n`n",% A_ScreenWidth/2,% A_ScreenHeight/2,%ToolTip%
else
   ToolTip % "   `n`n",% x%ToolTip%,% y%ToolTip%,%ToolTip%
tthwnd:=WinExist("ahk_class tooltips_class32")
WinSet, Region, 1-4 15-18 9-18 13-27 10-28 5-19 1-23, ahk_id %tthwnd%
WinSet,ExStyle,^0x20,ahk_id %tthwnd%
SetToolTipColor(tthwnd,!color%ToolTip% ? color1 : color%ToolTip%)
speed:=!speed%ToolTip% ? speed1 : speed%ToolTip%
startdelay:=!startdelay%ToolTip% ? startdelay1 : startdelay%ToolTip%
KeyWait,%thishotkey%
If InStr(mainhotkey,"~")
   Send, {%thishotkey% Up}
Loop,Parse,keys,|
   Loop,Parse,%A_LoopField%,|
      Hotkey,% "$*" A_LoopField,Move,Off
Hotkey,*%Exit%,Exit,Off
If MouseMoved
{
   wingetpos, winx, winy,,,% "ahk_id " . hwnd:=Dllcall("WindowFromPoint", "Int", x%ToolTip%, "Int", y%ToolTip%)
   KeyWait,%thishotkey%, D T0.15
   ErrorLevel_:=ErrorLevel
   KeyWait,%thishotkey%
   If ErrorLevel_
      ControlClick,% "x" . (x%ToolTip%+1 - winx) . " y" . (y%ToolTip%+5 - winy), ahk_id %hwnd%,,,, NA
   else {
      WinActivate,ahk_id %hwnd%
      WinWaitActive,ahk_id %hwnd%,,0.1
      MouseClick,Left,% (x%ToolTip%+1),% (y%ToolTip%+5)
   }
}
else if !InStr(mainhotkey,"~")
   Send, {%thishotkey%}
ToolTip,,,,%ToolTip%
MouseMoved=
Return

Move:
MouseMoved:=True
WinGetPos,x%ToolTip%,y%ToolTip%,,,ahk_id %tthwnd%
SysGet,xmin,76
SysGet,xmax,78
SysGet,ymin,77
SysGet,ymax,79
Loop
{
   i:=Round(A_Index/speed)
   Loop,Parse,keys,|
   {
      key:=A_LoopField
      Loop,Parse,%A_LoopField%,|
      {
         If GetKeyState(A_LoopField,"P"){
            IfInString,key,Up
               y%ToolTip%-=(y%ToolTip%-i)<=ymin ? 0 : i
            IfInString,key,Down
               y%ToolTip%+=(y%ToolTip%+i)>=ymax ? 0 : i
            IfInString,key,Left
               x%ToolTip%-=(x%ToolTip%-i)<=xmin ? 0 : i
            IfInString,key,Right
               x%ToolTip%+=(x%ToolTip%+i)>=xmax ? 0 : i
            stopbreak:=1
         }
      }
   }
   If !stopbreak
      Break
   stopbreak=
   WinMove,ahk_id %tthwnd%,,% x%ToolTip%,% y%ToolTip%
   Sleep % (startdelay-i) > 1 ? Round(startdelay-i) : 1
}
Return

SetToolTipColor(hwnd,B){
   B := (StrLen(B) < 8 ? "0x" : "") . B
   B := ((B&255)<<16)+(((B>>8)&255)<<8)+(B>>16) ; rgb -> bgr
   DllCall("SendMessage", "Uint", hWnd, "Uint", 1043, "Uint", B, "Uint", 0)   ; TTM_SETTIPBKCOLOR   
}

exit:
ExitApp



lmbarns
  • Members
  • 7 posts
  • Last active: Nov 12 2011 04:49 PM
  • Joined: 22 Oct 2011
Very awesome, this seems like more than I need so I was wondering is there a way to access the cursor by name to use in a script???

The script above works perfectly for moving the second cursor around with your numpad keys, but I don't really ever need to move it manually.

I just want to be able to make macros on hotkeys that click different places on the screen with the second cursor while leaving my main cursor independent.

*F4::
While GetKeyState("F4", "P")
{
PixelSearch, Px, Py, 468, 385, 555, 468, 0xAD52AD, 10, fast 
if ErrorLevel = 0
	{
		[b]MouseMove, %Px%, %Py% 
		Click 2[/b]
		Send, {;}
	}
}
Return

How to tell the second cursor instead of the first one to "MouseMove, %xVar%,%yVar% and then Double click with the second cursor instead of the main cursor????

Is there a simple way to tell a second mouse cursor "Click x, y" I don't need to control the cursor other than specifying particular x, y coordinates on the screen for it to click at...........?

This would be so awesome for games to be able to click (or drag) multiple points based off imagesearch/pixel searches while still using your main mouse to control your character.