Populate tooltip with a loop indexed variables serie

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Noo0B
Posts: 151
Joined: 26 Jan 2018, 19:54

Populate tooltip with a loop indexed variables serie

05 Aug 2023, 00:12

Hi,
Thanks for reading.
I have a loop code that produces indexed variables. How do I populate a tooltip with them?
maybe looking like this:

var1 var4
var2 var5
var3 var6

I only can do this on a Gui:

Code: Select all

	Gui, New
	N:= 1
	H:= 1
	W:= 1
	i := 0
	HMax:= 1
	SysGet, SGW, 71
	MouseGetPos, Xpos, Ypos
	Gui, Add, Text, X10 Y10, %initialscore%, %score%
	Loop, %runloopindex% {
		GuiY:= 280 + 30 * H
		ScreenHeight:= A_ScreenHeight - 45
			If (GuiY > ScreenHeight) {
				W+= 1
				HMax:= H
				H= 1
			}
		Y1:= 18 + 30 * H
		Y2:= 15 + 30 * H
		GuiWidth:= 140 * W
			If (W = 1) {
				GuiHeight:= 50 + 30 * H
				ButtonHeight:= 30 + 30 * H
			}
			If (W > 1) {
				GuiHeight:= 50 + 30 * HMax
				ButtonHeight:= 30 + 30 * HMax
			}
		Button1Width:= GuiWidth - 100
		Button2Width:= GuiWidth - 60
		TextWidth:= GuiWidth - 135
		Gui, Add, Text, x%TextWidth% Y%Y1%,% i ": " sessionscore%I% ", " sessiontotal%i%
			If (A_Index = runloopindex) {
				X_Offset:= GuiWidth/2
				Y_Offset:= GuiHeight/2
				X_Limit:= A_ScreenWidth - X_Offset
				Y_Limit:= A_ScreenHeight - Y_Offset
				Mouse_X:= Xpos - X_Offset
				Mouse_Y:= Ypos - Y_Offset
					If Xpos between 0 and %X_Offset%
						Move_X:= 0
					If Xpos between %X_Offset% and %X_Limit%
						Move_X:= Mouse_X
					If Xpos between %X_Limit% and %A_ScreenWidth%
						Move_X:= A_ScreenWidth - GuiWidth
					If Ypos between 0 and %Y_Offset%
						Move_Y:= 0
					If Ypos between %Y_Offset% and %Y_Limit%
						Move_Y:= 10
					If Ypos between %Y_Limit% and %A_ScreenHeight%
						Move_Y:= A_ScreenHeight - GuiHeight - 40
				Gui, Add, Button, x%Button1Width% y%ButtonHeight% w50 h20 gcancel default, Return
				Gui, Add, Button, x%Button2Width% y%ButtonHeight% w50 h20 gunpaue, ok
				Gui, Show, x%Move_X% y%Move_Y% w%GuiWidth% h%GuiHeight%, scores
				pause
				Break
			}
		N+= 1
		H+= 1
		i+= 1
	}
Return
Thanks again for the attention,
kind regards
User avatar
Hellbent
Posts: 2114
Joined: 23 Sep 2017, 13:34

Re: Populate tooltip with a loop indexed variables serie

05 Aug 2023, 00:54

Your code doesn't work for me. Can you post a gif of what it's supposed to look like?
Noo0B
Posts: 151
Joined: 26 Jan 2018, 19:54

Re: Populate tooltip with a loop indexed variables serie

05 Aug 2023, 01:38

Code: Select all

		runloopindex := 99
		Gui, New
	N:= 1
	H:= 1
	W:= 1
	i := 0
	HMax:= 1
	SysGet, SGW, 71
	MouseGetPos, Xpos, Ypos
	Gui, Add, Text, X10 Y10, scores etc
	Loop, %runloopindex% {
		GuiY:= 480 + 30 * H
		ScreenHeight:= A_ScreenHeight - 45
			If (GuiY > ScreenHeight) {
				W+= 1
				HMax:= H
				H= 1
			}
		Y1:= 18 + 30 * H
		Y2:= 15 + 30 * H
		GuiWidth:= 140 * W
			If (W = 1) {
				GuiHeight:= 50 + 30 * H
				ButtonHeight:= 30 + 30 * H
			}
			If (W > 1) {
				GuiHeight:= 50 + 30 * HMax
				ButtonHeight:= 30 + 30 * HMax
			}
		Button1Width:= GuiWidth - 110
		Button2Width:= GuiWidth - 60
		TextWidth:= GuiWidth - 135
		sessionscore%i% := i
		sessiontotal += i
		sessiontotal%i% := sessiontotal
		Gui, Add, Text, x%TextWidth% Y%Y1%,% i ": " sessionscore%i% ", " sessiontotal%i%
			If (A_Index = runloopindex) {
				X_Offset:= GuiWidth/2
				Y_Offset:= GuiHeight/2
				X_Limit:= A_ScreenWidth - X_Offset
				Y_Limit:= A_ScreenHeight - Y_Offset
				Mouse_X:= Xpos - X_Offset
				Mouse_Y:= Ypos - Y_Offset
					If Xpos between 0 and %X_Offset%
						Move_X:= 0
					If Xpos between %X_Offset% and %X_Limit%
						Move_X:= Mouse_X
					If Xpos between %X_Limit% and %A_ScreenWidth%
						Move_X:= A_ScreenWidth - GuiWidth
					If Ypos between 0 and %Y_Offset%
						Move_Y:= 0
					If Ypos between %Y_Offset% and %Y_Limit%
						Move_Y:= Mouse_Y
					If Ypos between %Y_Limit% and %A_ScreenHeight%
						Move_Y:= A_ScreenHeight - GuiHeight - 40
				Gui, Add, Button, x%Button1Width% y%ButtonHeight% w50 h20 gcancel default, Return
				Gui, Add, Button, x%Button2Width% y%ButtonHeight% w50 h20 gunpause, ok
				Gui, Show, x%Move_X% y%Move_Y% w%GuiWidth% h%GuiHeight%, scores
				pause
				Break
			}
		N+= 1
		H+= 1
		i+= 1
	}
Return
unpause:
gui, destroy
return
cancel:
gui, destroy
return

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Bing [Bot], peter_ahk and 367 guests