AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Identifying the current cursor

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
Mistrel



Joined: 12 Sep 2005
Posts: 188

PostPosted: Thu Mar 15, 2007 6:44 pm    Post subject: Identifying the current cursor Reply with quote

I'm updating my TabletMAX script to be more accurate and to not trigger hotkeys in certain undesirable instances.

I would like to have the script check to see what the current cursor type is and to react differently in these special cases.

I tried to make it work through ImageSearch but I believe it's not capturing the cursor when it reads the screen.

Is there any solution where either I can somehow lookup the current cursor or to do an image search that captures the mouse as well?


Here is the failed script that I wrote:

Code:
numpad7::
MouseGetPos, mousex, mousey, OutputVarWin, OutputVarControl, 2

X1:=mousex-8
Y1:=mousey-8
X2:=mousex+8
Y2:=mousey+8

ImageSearch, OutputVarX, OutputVarY, %X1%, %Y1%, %X2%, %Y2%, *Transff00ff *10 rsc/cursors/gizmo-move.bmp
if ErrorLevel = 2
    MsgBox Could not conduct the search.
else if ErrorLevel = 1
    MsgBox Icon could not be found on the screen.
else
    MsgBox The icon was found at %OutputVarX%x%OutputVarY%.

return

numpad8::
MouseGetPos, mousex, mousey, OutputVarWin, OutputVarControl, 2

X1:=mousex-8
Y1:=mousey-8
X2:=mousex+8
Y2:=mousey+8

SplashImage, rsc/cursors/gizmo-move.bmp, b x%X1% y%Y1%
return
Back to top
View user's profile Send private message
engunneer



Joined: 30 Aug 2005
Posts: 6772
Location: Pacific Northwest, US

PostPosted: Thu Mar 15, 2007 8:08 pm    Post subject: Reply with quote

imagesearch does ignore the mouse. I'm not sure how to tell what cursor it is currently showing. I know there is some code posted here that lets you change it, so maybe that will gove you an idea of where to check it's status.
_________________
Unless otherwise noted, all code is untested.
Common Answers: 1.(Loops, Viruses, etc.) 2. Search 3.RTFM
Back to top
View user's profile Send private message Visit poster's website
jonny



Joined: 13 Nov 2004
Posts: 3004
Location: Minnesota

PostPosted: Thu Mar 15, 2007 10:53 pm    Post subject: Reply with quote

Documentation wrote:
A_Cursor

The type of mouse cursor currently being displayed. It will be one of the following words: AppStarting, Arrow, Cross, Help, IBeam, Icon, No, Size, SizeAll, SizeNESW, SizeNS, SizeNWSE, SizeWE, UpArrow, Wait, Unknown. The acronyms used with the size-type cursors are compass directions, e.g. NESW = NorthEast+SouthWest. The hand-shaped cursors (pointing and grabbing) are classfied as Unknown.

Known limitation (in versions prior to 1.0.42.02 or on Windows 95): If this variable's contents are fetched repeatedly at a high frequency (i.e. every 500 ms or faster), it will probably disrupt the user's ability to double-click. There is no known workaround.
Back to top
View user's profile Send private message
Mistrel



Joined: 12 Sep 2005
Posts: 188

PostPosted: Thu Mar 15, 2007 11:57 pm    Post subject: Reply with quote

In this case all of the cursors I'm trying to identify are custom to this application so A_Cursor always returns "Unknown".
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group