ToolTip not follow the mouse Topic is solved

Get help with using AutoHotkey and its commands and hotkeys
zuzu_kuc
Posts: 44
Joined: 30 Mar 2016, 12:36

ToolTip not follow the mouse

Post by zuzu_kuc » 24 Jan 2021, 18:29

Hi,
i found this script:

Code: Select all

ToolTip, HI!
	Process,Exist
	hwnd:=WinExist("ahk_class tooltips_class32 ahk_pid " ErrorLevel)
	WinGetPos,posX,posY,w,h,ahk_id %hwnd%
	While DllCall("MoveWindow","ptr",hwnd,"Int",x+20,"Int",y+20,"Int",w,"Int",h)
	{
		MouseGetPos,x,y
		
	}
return
but it is not follow the mouse.
Where the tool tip is, is defined by size of the window where a run the script. If i run the script e.g. in Acrobat which is Maximaze. Tooltip is OK. but whne i make this window smaller, toolTip is away from mouse and the gap between cursor and toolTip depends how small the window is :/
i tried make som changes but i dont know how to fix this :/
can you please help me?
User avatar
mikeyww
Posts: 5438
Joined: 09 Sep 2014, 18:38

Re: ToolTip not follow the mouse

Post by mikeyww » 24 Jan 2021, 19:34

Code: Select all

#Persistent
Process, Priority,, B
CoordMode, ToolTip
CoordMode, Mouse
SetTimer, Tip, 250
Tip:
MouseGetPos, xpos, ypos
ToolTip, Hi!, Max(0, xpos - 50), Max(0, ypos - 50)
Return
zuzu_kuc
Posts: 44
Joined: 30 Mar 2016, 12:36

Re: ToolTip not follow the mouse

Post by zuzu_kuc » 25 Jan 2021, 06:18

i have keywait in my script. (to show formated row from excel as tooltip) and if i use settimer, the keyWait will not work properly. Even if i set timer to 1.
User avatar
mikeyww
Posts: 5438
Joined: 09 Sep 2014, 18:38

Re: ToolTip not follow the mouse

Post by mikeyww » 25 Jan 2021, 06:53

Feel free to post it to get more specific feedback.
zuzu_kuc
Posts: 44
Joined: 30 Mar 2016, 12:36

Re: ToolTip not follow the mouse

Post by zuzu_kuc » 25 Jan 2021, 07:16

now i have this:

Code: Select all

F3::
Xl := ComObjActive("Excel.Application") 	
xl.activesheet.usedrange.copy
dataRadek := rtrim(clipboard,"`r`n")

loop,parse,dataRadek, `r,`n
{
	;msgbox % A_LoopField
	;------------------------rozdelit radek na bunky--------------
	radek := StrSplit(a_loopfield, "`r")
	sloupceAll := StrSplit(radek[1], "`t")
	;msgbox % Radek[1]
	;msgbox % sloupceAll[1]
	sloupec2 := sloupceAll[2] ;strana
	sloupec3 := sloupceAll[3] ;pozice
	bemerkung := sloupceAll[7] ;bemerkung
	nazev := sloupceAll[8] ;nazev
	sloupec9 := sloupceAll[9] ;nechci
	jednotkova := sloupceAll[10] ;jednotkovacena 
	sloupec11 := sloupceAll[11] ;nechci
	akcni := sloupceAll[12] ;akcni
	stara := sloupceAll[13] ;stara
	sleva := sloupceAll[14] ;sleva
	sleva := RegExReplace(sleva, "^0`%|^1`%|^2`%|^3`%|^4`%|^5`%|^6`%|^7`%|^8`%|^9`%|^10`%|^11`%|^12`%|^13`%|^14`%", " `%") ; procenta do 14
	PKAkcni := sloupceAll[15] ;penny karta
	PKStara := sloupceAll[16] ;penny karta
	
	nazev := sloupceAll[8] ;nazev najit jedinecnou nabidku
	nazev := RegExReplace(nazev, "(^IO-|^IO |^IO_)","***JEDINEČNÁ NABÍDKA***`n")
	
	
	
	
	
	
	
	
	ToolTip, %nazev%`n`nCENA:`n%akcni%`n%stara%`n%sleva%`n`njednotková cena:`n%jednotkova%`n`nPENNY KARTA:`n%PKAkcni%`n%PKStara%`n`nBemerkung:`n%bemerkung%`n`nDobrany:`n%CheckDobrany%
	;ToolTip, % Arr.1
	Process,Exist
	hwnd:=WinExist("ahk_class tooltips_class32 ahk_pid " ErrorLevel)
	WinGetPos,posX,posY,w,h,ahk_id %hwnd%
	While DllCall("MoveWindow","ptr",hwnd,"Int",x+20,"Int",y+20,"Int",w,"Int",h)
	{
		MouseGetPos,x,y
		
	}
	F4::
	{
		ToolTip, % Arr.2
		Process,Exist
		hwnd:=WinExist("ahk_class tooltips_class32 ahk_pid " ErrorLevel)
		WinGetPos,,,w,h,ahk_id %hwnd%
		While DllCall("MoveWindow","ptr",hwnd,"Int",x+20,"Int",y+20,"Int",w,"Int",h)
		MouseGetPos,x,y
		
		Continue
	}
	
	
	
}
return
User avatar
mikeyww
Posts: 5438
Joined: 09 Sep 2014, 18:38

Re: ToolTip not follow the mouse

Post by mikeyww » 25 Jan 2021, 07:21

I don't see a timer or a keywait here, but I hope it's working for you. I don't think you'll want to define a hotkey inside a loop.
zuzu_kuc
Posts: 44
Joined: 30 Mar 2016, 12:36

Re: ToolTip not follow the mouse

Post by zuzu_kuc » 25 Jan 2021, 07:50

i will try find (or create again :/) the old version, this is what i "created" after setTimer version...
here the F4:: will show next row in excel and it is very fast and no flickering with DLL, but i see DLL first time :)
I would like keep this option, but the toolTip is not following the mouse :/

like this:
https://www.youtube.com/watch?v=aRL2J2k8tyo&feature=youtu.be&ab_channel=DTPtutori%C3%A1lyCZ
User avatar
mikeyww
Posts: 5438
Joined: 09 Sep 2014, 18:38

Re: ToolTip not follow the mouse  Topic is solved

Post by mikeyww » 25 Jan 2021, 08:30

The approach with ToolTip is straightforward:

1. Before the ToolTip command, get the mouse position.

2. Add the coordinates to your ToolTip command.

See my first post for an example of how to do it.
zuzu_kuc
Posts: 44
Joined: 30 Mar 2016, 12:36

Re: ToolTip not follow the mouse

Post by zuzu_kuc » 25 Jan 2021, 12:42

aaah, i only moved mouseget front of DDL
and it works!
Thank you.
Post Reply

Return to “Ask For Help”