Update a Systray icon tooltip in real time?

Started by User_McUser, February 21, 2024, 01:07:41 PM

Previous topic - Next topic

User_McUser

I am working on a script that runs in the system tray and on mouse-over shows the time left in a timer.

It works, but the value in the tooltip does not update while being displayed; that is to say, when I mouse over the tray icon it shows a tooltip with the seconds remaining, but as time passes the tooltip text does not change unless I mouse away and back over.

I'd like for the user to see the countdown happening in real time if they leave the pointer over the icon, if this is possible.
The code below is what I'm using right now.

Code (winbatch) Select
timeRemaining = 60

:timerLoop
TimeDelay(1)

timeRemaining -= 1
if timeRemaining < 1 then exit

theToolTip = StrCat(timeRemaining, " sec remaining.")
IntControl(1007,4,1,theToolTip,"")

Goto timerLoop


Thank you! :D

td

I hate to say it, but it works for me after adding the necessary IntControl(1007, 1,... line to the top of your script. By "works for me" I mean it updates the text once per second when the mouse cursor is over the script's notification area icon. Of course, if you click on the icon the tip disappears, and you need to move the cursor off the icon and back over the icon to resume seeing the countdown.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

User_McUser

Interesting... 🤔 I wonder what's different about my systems that makes it not work for me; tried it on three different Windows 10 PCs.

While a tiny bit disappointing it's not the end of the world - I'll probably just change to "minutes remaining" and call it good enough. 👍

Thank you! 😊

td

There are numerous taskbar settings in Windows 10/11 but it is difficult to determine which or if any of them are influencing the tooltip behavior. You would likely have to perform trial-and-error testing with no guarantee of success.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

td

I happened to be performing compatibility checks on an old version of Windows 10 (2022h2).  Your script does not update the text once per second when the mouse cursor is over the script's notification area icon on that version of Windows.  I guess the fix would be to upgrade to Windows 11...
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

spl

Quote from: td on February 23, 2024, 01:38:44 PM
I happened to be performing compatibility checks on an old version of Windows 10 (2022h2).  Your script does not update the text once per second when the mouse cursor is over the script's notification area icon on that version of Windows.  I guess the fix would be to upgrade to Windows 11...

which according to Microsoft is underway, forcefully, for applicable PC's.
Stan - formerly stanl [ex-Pundit]

td

Yes, that appears to be the case. Fortunately, we have a Windows 10 VM that is configured to be incompatible with Windows 11. We need to keep old OS's around for testing purposes and verifying user issues.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade