Jump to content
omgaghost

New User - Getting Coordinates, ToolTip

Recommended Posts

omgaghost

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

Share this post


Link to post
Share on other sites
iamtheky

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

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

Share this post


Link to post
Share on other sites
water

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 2018-12-03 - Version 1.4.11.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites
omgaghost

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!

Share this post


Link to post
Share on other sites
water

Because without While/WEnd the script would end immediately.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-12-03 - Version 1.4.11.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
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

×