timmyc Posted December 22, 2019 Share Posted December 22, 2019 Hi all, I am wanting to use multiple tooltips similar to the one below to give instructions for a process. I like below as it follows the cursor. ToolTip("Paused Script", MouseGetPos(0) + 25, MouseGetPos(1) + 10, "---Testing---", 1) User would start the .exe file and tooltip would appear and when the user pressed Right arrow the next tip would appear and so on until the final tooltip where the script would exit. For example - Start .exe - Tip 1 appears - Right arrow pressed - Tip 2 appears - Right arrow pressed - Tip 3 appears - Right arrow pressed - Exit. Any help would be greatly appreciated. Thanks! Link to comment Share on other sites More sharing options...
Nine Posted December 22, 2019 Share Posted December 22, 2019 (edited) Here one simple way : #include <Constants.au3> #include <GUIConstants.au3> Opt ("MustDeclareVars", 1) Global Const $aTooltip = ["First tooltip", "Second tooltip", "Third tooltip", "Last tooltip"] Local $hGUI = GUICreate ("Tooltip") Local $idButton = GUICtrlCreateButton ("OK", 150, 150, 89, 25) Local $idDummy = GUICtrlCreateDummy () Local $aAccelKeys[1][2] = [["{RIGHT}", $idDummy]] GUISetAccelerators($aAccelKeys) GUISetState () Local $iTootip = 0, $iX = -1, $iY = -1 While True Switch GUIGetMsg () Case $GUI_EVENT_CLOSE, $idButton ExitLoop Case $idDummy $iTootip += 1 If $iTootip = UBound ($aTooltip) Then ExitLoop $iX = -1 EndSwitch If $iX <> MouseGetPos(0) Or $iY <> MouseGetPos(1) Then ToolTip($aTooltip[$iTootip], MouseGetPos(0) + 25, MouseGetPos(1) + 10, "--Test--", 1) $iX = MouseGetPos(0) $iY = MouseGetPos(1) EndIf WEnd Edited December 22, 2019 by Nine corrected a small bug “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
markyrocks Posted December 23, 2019 Share Posted December 23, 2019 (edited) HotKeySet("{ESC}","Exit1") HotKeySet("{RIGHT}","ToolToggle") $tipcount=1 ToolToggle() while 1 WEnd Func ToolToggle() if $tipcount=1 Then ToolTip("ToolTip-1", MouseGetPos(0) + 25, MouseGetPos(1) + 10, "---Testing---", 1) Elseif $tipcount=2 Then ToolTip("ToolTip-2", MouseGetPos(0) + 25, MouseGetPos(1) + 10, "---Testing---", 1) Elseif $tipcount=3 Then ToolTip("ToolTip-3", MouseGetPos(0) + 25, MouseGetPos(1) + 10, "---Testing---", 1) Else ToolTip("ToolTip-4", MouseGetPos(0) + 25, MouseGetPos(1) + 10, "---Testing---", 1) EndIf $tipcount+=1 if $tipcount>=6 Then Exit EndIf EndFunc one simple way or ;this is a little cleaner HotKeySet("{ESC}","Exit1") HotKeySet("{RIGHT}","ToolToggle") $tipcount=1 dim $tooltipdata[4]=['Data1', 'Data2', 'Data3', 'Data4'] ToolToggle() while $tipcount<5 WEnd Func ToolToggle() ToolTip("ToolTip-" & $tipcount, MouseGetPos(0) + 25, MouseGetPos(1) + 10, $tooltipdata[$tipcount-1], 1) $tipcount+=1 EndFunc Func Exit1() Exit EndFunc this also works HotKeySet("{ESC}","Exit1") HotKeySet("{RIGHT}","ToolToggle") Global $tipcount=1 dim $tooltipdata[4]=['Data1', 'Data2', 'Data3', 'Data4'] for $x=1 to 4 ToolTip("ToolTip-" & $tipcount, MouseGetPos(0) + 25, MouseGetPos(1) + 10, $tooltipdata[$tipcount-1], 1) while $tipcount<5 if $tipcount>$x Then ExitLoop EndIf WEnd Next Func ToolToggle() $tipcount+=1 EndFunc Func Exit1() Exit EndFunc Edited December 23, 2019 by markyrocks Spoiler "I Believe array math to be potentially fatal, I may be dying from array math poisoning" Link to comment Share on other sites More sharing options...
timmyc Posted December 26, 2019 Author Share Posted December 26, 2019 Thanks @markyrocks & @Nine! Can you help me find which part of the below script (found while googling) allows the tooltip to follow the cursor? Thanks! :) #include <GUIConstantsEx.au3> $hGUI = GUICreate("Test", 500, 500) $hButton1 = GUICtrlCreateButton("Show", 10, 10, 80, 30) $hButton2 = GUICtrlCreateButton("Hide", 10, 50, 80, 30) $hLabel = GUICtrlCreateLabel("0", 10, 100, 80, 40) GUICtrlSetFont(-1, 18) GUISetState() $iBegin = TimerInit() $iCount = 0 While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $hButton1 $aPos = WinGetPos($hGUI) Tooltip("Testing!", $aPos[0] + 100, $aPos[1] + 100) Case $hButton2 ToolTip("") EndSwitch If TimerDiff($iBegin) > 1000 Then $iCount += 1 GUICtrlSetData($hLabel, $iCount) $iBegin = TimerInit() EndIf WEnd Link to comment Share on other sites More sharing options...
Nine Posted December 26, 2019 Share Posted December 26, 2019 We already gave you examples of it. Just copy/paste it... “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
timmyc Posted December 27, 2019 Author Share Posted December 27, 2019 Yep, love the examples. Thanks for them! What i mean is your examples the tooltip appears where the cursor is but doesn't follow the cursor In the example i have given above the tooltip appears at the cursor and then follows the cursor. I'm thinking its something to do with this bit and i have tried playing around with it but cant get it to follow the cursor. $aPos = WinGetPos($hGUI) Tooltip("Testing!", $aPos[0] + 100, $aPos[1] + 100) Thanks! Link to comment Share on other sites More sharing options...
Nine Posted December 27, 2019 Share Posted December 27, 2019 It is not WinGetPos, read help file to understand the code. You need to use this : If $iX <> MouseGetPos(0) Or $iY <> MouseGetPos(1) Then ToolTip($aTooltip[$iTootip], MouseGetPos(0) + 25, MouseGetPos(1) + 10, "--Test--", 1) $iX = MouseGetPos(0) $iY = MouseGetPos(1) EndIf Refer to my script above... “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
timmyc Posted December 29, 2019 Author Share Posted December 29, 2019 Ahh ok, thanks. With your script is there a way to hide the gui box and just have the tooltip appear? Link to comment Share on other sites More sharing options...
Nine Posted December 29, 2019 Share Posted December 29, 2019 One way is to make it transparent...Add this line before GuiSetStat () WinSetTrans ($hGUI, "", 0) “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
timmyc Posted December 31, 2019 Author Share Posted December 31, 2019 Amazing, thanks so much @Nine. I really appreciate your help. Happy new year. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now