How to determine Tooltop co-ordinates ?

Ask gaming related questions (AHK v1.1 and older)
GoneFishing
Posts: 126
Joined: 20 May 2022, 16:17

How to determine Tooltop co-ordinates ?

Post by GoneFishing » 08 Aug 2022, 10:39

Is there a way to determine where Tooltip X,Y co-ordinates will display onscreen. At the moment I’m just guessing, which is hit and miss and takes multiple attempts to get it right.

User avatar
boiler
Posts: 16925
Joined: 21 Dec 2014, 02:44

Re: How to determine Tooltop co-ordinates ?

Post by boiler » 08 Aug 2022, 12:39

GoneFishing wrote: Is there a way to determine where Tooltip X,Y co-ordinates will display onscreen.
There should be no reason to guess. They appear at the coordinates specified in the command's X and Y parameters relative to the active window unless changed using CoordMode, ToolTip, .... If the X and Y parameters are blank, then it will appear near the mouse cursor. Only if the specified coordinates would place the ToolTip near or past the edge of the working display area would they appear in a different location.

GoneFishing
Posts: 126
Joined: 20 May 2022, 16:17

Re: How to determine Tooltop co-ordinates ?

Post by GoneFishing » 08 Aug 2022, 13:12

I’ve been using just the Tooltip command itself, without coordmode. I’ve read up now on coordmode but I don’t see how this helps me position were I want the Tooltip to appear if I want in a specific location.

This command doesn't work. It doesn't display anything onscreen at all

Code: Select all

CoordMode, Tooltip, % "The number of instances is " cnt "      " "The seed number is " ARWholeNum
                         . "`n`n"ARNum " Albino Rhoa(s) have been found so far " "`nIt's been " CurrInst " instances since the last Albino Rhoa. ", 1350, 100, 1
but this does (the coordinates are guessed manually at the moment)

Code: Select all

Tooltip, % "The number of instances is " cnt "      " "The seed number is " ARWholeNum
              . "`n`n"ARNum " Albino Rhoa(s) have been found so far " "`nIt's been " CurrInst " instances since the last Albino Rhoa ", 1350, 100, 1[code]

User avatar
boiler
Posts: 16925
Joined: 21 Dec 2014, 02:44

Re: How to determine Tooltop co-ordinates ?

Post by boiler » 08 Aug 2022, 16:04

You don't combine the CoordMode and ToolTip commands into the same line (you never combine any commands for that matter). CoordMode is its own separate command. This is how you would specify that the coordinates you are specifying are relative to the screen, not the active window:

Code: Select all

CoordMode, ToolTip, Screen

You only have to execute that once, like at the top of your script. It will continue to use that as the coordinate reference unless it is changed later.

GoneFishing
Posts: 126
Joined: 20 May 2022, 16:17

Re: How to determine Tooltop co-ordinates ?

Post by GoneFishing » 08 Aug 2022, 18:36

boiler wrote:
08 Aug 2022, 16:04
You don't combine the CoordMode and ToolTip commands into the same line (you never combine any commands for that matter). CoordMode is its own separate command. This is how you would specify that the coordinates you are specifying are relative to the screen, not the active window:

Code: Select all

CoordMode, ToolTip, Screen

You only have to execute that once, like at the top of your script. It will continue to use that as the coordinate reference unless it is changed later.
OK. Thanks for the clarification. I did a quick test and it works, however the screen displays in the middle of the screen, not where I want it. How do I tell CoordMode to use alternative co-ordinates that will display at the top of the screen without needing to specify Tooltip co-ordinates (which aren't displayed so I've no idea what to adjust them to) ?

I also have a different Tooltip that displays if a condition is triggered. I don't want it to overwrite the first display. I want them to both display at the same time. How would the CoordMode handle that or do I have to put X,Y co-ordinates in for the second Tooltip command (which I have no way of telling what the X,Y co-ordinates should be) ?

Edit:

Code: Select all

CoordMode, Tooltip, Client
.
Gets me close to top of screen but still not in the exact location I want. Is there a way to display the X,Y co-ordinates so I can see and adjust them ?

User avatar
boiler
Posts: 16925
Joined: 21 Dec 2014, 02:44

Re: How to determine Tooltop co-ordinates ?

Post by boiler » 08 Aug 2022, 18:59

GoneFishing wrote: How do I tell CoordMode to use alternative co-ordinates that will display at the top of the screen without needing to specify Tooltip co-ordinates (which aren't displayed so I've no idea what to adjust them to) ?
What do you mean they’re not displayed? They’re screen coordinates. Use the Window Spy tool to see exactly what the coordinates are for different parts of the screen. The CoordMode statement says that you are locating the ToolTip relative to the screen (i.e., upper-left corner of the screen is 0,0 if you have a single monitor).

GoneFishing wrote: I also have a different Tooltip that displays if a condition is triggered. I don't want it to overwrite the first display. I want them to both display at the same time. How would the CoordMode handle that or do I have to put X,Y co-ordinates in for the second Tooltip command (which I have no way of telling what the X,Y co-ordinates should be) ?
You don’t use a different CoordMode to prevent one ToolTip from being on top of the other. You simply choose different coordinates for the other one. If you use different coordinates, they won’t be on top of each other. I don’t see how you could accidentally have them on top of each other. Use different numbers for the locations of each.

GoneFishing wrote: Edit:

Code: Select all

CoordMode, Tooltip, Client
.
Gets me close to top of screen but still not in the exact location I want.
Just leave it screen as coordinates and use 0 for the Y value to put it at the top of the screen. Leave CoordMode alone once you set it to Screen.
GoneFishing wrote: Is there a way to display the X,Y co-ordinates so I can see and adjust them ?
Why is it a mystery what the coordinates are? It’s your script that’s defining them. Whatever you put in for X and Y, that’s where it is. I don’t know what else to say.

You should just post your script so I can show you exactly in your script what to look at to know where the ToolTip is being displayed.

GoneFishing
Posts: 126
Joined: 20 May 2022, 16:17

Re: How to determine Tooltop co-ordinates ?

Post by GoneFishing » 08 Aug 2022, 20:10

What do you mean they’re not displayed? They’re screen coordinates. Use the Window Spy tool to see exactly what the coordinates are for different parts of the screen. The CoordMode statement says that you are locating the ToolTip relative to the screen (i.e., upper-left corner of the screen is 0,0 if you have a single monitor).
I think I get it now. I assumed CoordMode displayed the co-ordinates on screen, but they just set the co-ordinates. I also was not using the WindowSpy co-ordinate prior.
If I want to see co-ordinates I now understand to look at the Screen, Windows & Client numbers in WindowSpy and select the Screen numbers (or Windows or Client if that what is set with Coordmode).
Image

and select the co-ordinates I want to use in Tooltip. So my code would look like this

Code: Select all

 CoordMode, Tooltip, Screen                        ; <--- set parameters

 FullName := A_ScriptDir "\Client.txt"
   FileRead, AllLines, %FullName%
   StringSplit, Line, AllLines, `n
   PosSeedLastLine := Line0 -5
   DTS := SubStr(Line%PosSeedLastLine%, 1,19)  ; Date and Time stamp
   RegExMatch(Line%PosSeedLastLine%, """1_1_3"" with seed\s+\K\d*", ARWholeNum)
   
  Tooltip, % "The seed number is " ARWholeNum, 1462, 190, 1     ;<---- Use WindowSpy co-ordinates. The 1 is if I have multiple Tooltip windows
  Tooltip, % "The otehr message displayed is " SomeVar, 1248, 210, 2     ;<---- If a second Tooltip is needed     
  Sleep 1000
Why is it a mystery what the coordinates are? It’s your script that’s defining them. Whatever you put in for X and Y, that’s where it is. I don’t know what else to say.
Because I mistakenly thought CoordMode displayed the co-ordinates. I wasn't aware what WindowSpy was telling me. I get it now.

[Mod edit: Fixed quote tags.]

Post Reply

Return to “Gaming Help (v1)”