Jump to content

New User - Getting Coordinates, ToolTip


Recommended Posts

Hello, I'm a brand new user, so please forgive me, I'm probably making some dumb mistake, I just can't see it.

I want to hit the F12 button and have a tooltip come up telling me the current cursor X, Y & Color.

I've been reading on PixelGetColor, and MouseGetPos, but I can't get what I tried to work, so I've dumbed my script down to be:

Hit F12, have tool tip on screen.  I can't even get that to work!

HotKeySet("{F12}", _coords)

While 1
WEnd



Func _coords()
ToolTip("This is a tooltip")
Sleep(2000) ; Sleep to give tooltip time to display
EndFunc

I'm not sure why this isn't working.  Any help is appreciated.

 

Thanks!

Edited by omgaghost
Link to comment
Share on other sites

Here it is for F11.

HotKeySet("{F11}", _coords)

While 1
    sleep(10)
WEnd



Func _coords()
ToolTip("Position X: " & MouseGetPos()[0] & " -- Position Y: " & MouseGetPos()[1] & " -- Color: " & Hex(PixelGetColor(MouseGetPos()[0] , MouseGetPos()[1])) , 0 , 0)
Sleep(2000) ; Sleep to give tooltip time to display
EndFunc

 

 

Help is your friend.

 

The following hotkeys cannot be set:
 

Ctrl+Alt+DeleteIt is reserved by Windows
F12It is also reserved by Windows, according to its API.
Edited by boththose

,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Link to comment
Share on other sites

I suggest to insert a Sleep command into your While loop. Else it will eat up all CPU cycles.

While 1
    Sleep(10)
WEnd

 

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Thank You!

I seriously never would of found that!  I knew it was some dumb mistake!

I've done a little script writing in AHK, and I've always used F12 with a little script to get cords, So I was pretty set on using F12 again!

I'll just turn it into shift F11, since F11 does something else.

 

Question about the While command with the sleep.  A friend of mine turned me onto AutoIt over AHK, but the while command is new to me.  Why is it necessary? 

 

Thanks Again!

Link to comment
Share on other sites

Because without While/WEnd the script would end immediately.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...