AutoHotkey Community

It is currently May 27th, 2012, 12:26 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 20 posts ]  Go to page Previous  1, 2
Author Message
 Post subject:
PostPosted: December 9th, 2009, 6:50 pm 
Offline

Joined: June 18th, 2008, 8:36 am
Posts: 4923
Location: AHK Forum
RIST wrote:
is any second mouse script for windows7 ?

Why don't you give it a try :)

_________________
AHK_H (2alpha) AHF TT _Struct WatchDir Yaml _Input ObjTree RapidHotkey DynaRun :wink:


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 9th, 2009, 7:13 pm 
Offline

Joined: May 24th, 2006, 2:49 pm
Posts: 4511
Location: Belgrade
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)

_________________
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 10th, 2009, 12:17 am 
Offline

Joined: May 8th, 2008, 2:58 pm
Posts: 39
Location: C:\ESTONIA\adavere\RIST.rar
in my w7 dont work any second cursor, :/

_________________
Keegi Siin ka Eestlane? :)


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Check
PostPosted: December 10th, 2009, 5:47 am 
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
Code:
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}
   }   



HotKeyIt wrote:
! 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

Code:
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


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: November 9th, 2011, 9:33 pm 
Offline

Joined: October 22nd, 2011, 9:46 pm
Posts: 7
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.

Code:
*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.


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 20 posts ]  Go to page Previous  1, 2

All times are UTC [ DST ]


Who is online

Users browsing this forum: Bing [Bot], Cristi®, tidbit and 51 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group