identify cursor pointers

Get help with using AutoHotkey and its commands and hotkeys
javierdals
Posts: 2
Joined: 18 May 2017, 15:35

identify cursor pointers

18 May 2017, 17:29

Hi, I´m new in AutoHotKey. :wave:
I need to identify some cursor pointers, for example the differents pointers in Excel.
A_cursor lists only a few pointers.
Is there a way, with a number, to identify a specific pointer that is not listed in A_cursor values?
A_cursor only gives the value "unknown".

I hope soon I´ll be able to help someone, now I´m just a learner.
User avatar
jeeswg
Posts: 2637
Joined: 19 Dec 2016, 01:58
Location: UK

Re: identify cursor pointers

18 May 2017, 17:51

This might be useful, I haven't tested it myself yet though. An old script, so it might be worth testing it with AHK x32, if you use AHK x64 and it doesn't work.

Compare current cursor to saved image - Scripts and Functions - AutoHotkey Community
https://autohotkey.com/board/topic/73686-compare-current-cursor-to-saved-image/

Btw do mention what you might like to use it for, in case there may be any other methods, like getting text from the status bar.
User avatar
jeeswg
Posts: 2637
Joined: 19 Dec 2016, 01:58
Location: UK

Re: identify cursor pointers

18 May 2017, 19:22

On that link, there is a post at the bottom which works in both AHK x32 and AHK x64.

I've created a modified version of it, what it does is this:
- If you press q it grabs the current cursor as an hBitmap, and if it's a cursor it hasn't seen before, it saves it to a file on Desktop.
- If you press w it grabs the current cursor as an hBitmap, it messages you to say which cursor it matches or that it didn't match a cursor.

So what I would do is this:
- Move your cursor around in Excel and generate lot of cursor image files.
- Create a script that creates hBitmaps from those 'haystack' images when it starts up.
- When you run your hotkey, create an hBitmap for the current cursor and compare that 'needle' hBitmap against the 'haystack' hBitmaps to find a match.

Hope that helps. I'd been meaning to investigate this precise issue, so thanks for reminding me. Cheers to glucos and chaidy for the code.

[EDIT:] You could use the Gdip library to save/load the images as other filetypes such as a png, to save space. Also, you could potentially store the image data inside a script as hex for example or base64.

Btw it's kind of cool having all the Excel cursors (and MS Paint Windows XP version and the Internet Explorer hand icon) as image files now. Another possibility is you may be able to get hBitmaps direct from an Excel exe or dll file.

[EDIT:] I use Excel 2007, and the cursors were in the main exe file, I was able to check it using Resource Hacker.
C:\Program Files (x86)\Microsoft Office\Office12\EXCEL.EXE
The same was true for MS Paint Windows XP version, the main exe file (mspaint.exe).

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus

javierdals
Posts: 2
Joined: 18 May 2017, 15:35

Re: identify cursor pointers

18 May 2017, 19:54

Thanks, jeeswg, I like second option. I´ll try it

Return to “Ask For Help”

Who is online

Users browsing this forum: Bing [Bot], HotKeyIt, kczx3 and 47 guests