pau31

Windows 10 Traytips

11 posts in this topic

Hello everyone,

I've just upgraded my SO to Windows 10 and I've noticed that the function TrayTip() generates this different type of message:

Captura.thumb.PNG.4a3884259d957eebed31ed

The problem is that one traytip command does not immediately dismiss the previous one, so it takes forever. I've also tried this: 

To clear a balloon tip that is being displayed, call another tip with an empty text string (and any title).

TrayTip("", "A different tray tip.", 5)

But it doesn't work :/

Anyone has been throught this problem? Or can you recommend me an alternative way to inform the user about the status of a script?

Thank you very much!

Share this post


Link to post
Share on other sites



Hi, i know it's been a while, but im very interested in the solution for this, because i have the same problem.

Here's what i tried so far without success:
 

TrayTip('test', 'testing', 5, 1)
Sleep(1000)
ConsoleWrite('Lets do this - '&@MSEC&@CRLF)
WinClose('[CLASS:Windows.UI.Core.CoreWindow]')
WinKill("[CLASS:Windows.UI.Core.CoreWindow]")
WinClose('New notification')
WinKill('New notification')
TrayTip('', '', 0)
ConsoleWrite('Killed? - '&@MSEC&@CRLF)
Sleep(7000)

Info tool outputs those 2 fields, but they dont work with these functions.


Spoiler

BeatsPlayer - Music player.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Firefox Profile Backup - Backup/restore previously saved profile.

Time4Shutdown - Write the time for shutdown in minutes.

Volume Editor - Change label or letter.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

Renamer - Rename files and folders, remove portions of text from the filename etc.

Paster - Main function is to paste text, but has more functions

 

Share this post


Link to post
Share on other sites

You could try creating your own UDF for TrayTip using the MSDN reference. Good luck with that, it doesn't look to fun. Could also try ControlClick? Make your own UDF for TrayTip (Like _TrayTipWin10) that will check to see if a notification is currently present, close it, then call TrayTip.

You could also use ToolTip instead or create a GUI with an edit box in it that you can append to or a label that you can overwrite with debugging info

Share this post


Link to post
Share on other sites

Yes, doesn't look fun, and i don't have enough knowlegde to do it. On a side note WinWaitActive also doesn't detect it, controlclick won't detect the place to click, so it has to be made from scratch, its something new to autoit.


Spoiler

BeatsPlayer - Music player.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Firefox Profile Backup - Backup/restore previously saved profile.

Time4Shutdown - Write the time for shutdown in minutes.

Volume Editor - Change label or letter.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

Renamer - Rename files and folders, remove portions of text from the filename etc.

Paster - Main function is to paste text, but has more functions

 

Share this post


Link to post
Share on other sites

This page in msdn has code on hiding the toasts, what can i do with it? I got a general idea on the dll calls and such, but not a pro on it.


Spoiler

BeatsPlayer - Music player.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Firefox Profile Backup - Backup/restore previously saved profile.

Time4Shutdown - Write the time for shutdown in minutes.

Volume Editor - Change label or letter.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

Renamer - Rename files and folders, remove portions of text from the filename etc.

Paster - Main function is to paste text, but has more functions

 

Share this post


Link to post
Share on other sites

You'd have to create your own toast notification UDF that's going to do some DLL calls. I know C++ pretty well but I don't know enough about dll calls to create a class, set values, and call the toast display/hide functions.

Melba made some toast notification example that might help if you don't want to use windows toast

And it looks like someone suggested disabling the tray icon for the script and then re-enable it (Since notifications will not be displayed if there's no tray icon).

This works on windows 7, you might want to use a timer instead of just sleep

_TrayTip("Title 1", "First test notification", 5)

_TrayTip("Title 2", "Second test notification", 2)

Func _TrayTip(Const ByRef $sTitle, Const ByRef $sMsg, Const ByRef $iTimeout, Const $iOption = 0)
    Local $hwnd_timer

    TrayTip($sTitle, $sMsg, $iTimeout, $iOption)

    $hwnd_timer = TimerInit()
    While (($iTimeout * 1000) - TimerDiff($hwnd_timer) > 0)
        Sleep(10)
    WEnd

    Opt("trayiconhide", 1);Momentarily hides AutoIt Tray Icon as TrayTip cannot function without a tray icon.
    Opt("trayiconhide", 0);Re-enables AutoIt Tray Icon.
EndFunc

You could Adlibregister/deregister to check a global timer instead of keeping the script stuck in the _TrayTip function

Share this post


Link to post
Share on other sites

I've used melba's toasts in the past, i'll probably use 'em again, now, in terms of disabling the toasts and stuff, you have the option for it, by opening the action center and clicking the notification, to "disable all notifications for this application" or whatever. I just wanted to be able to delete a previous toast to update the information faster, as of now it doesn't and each toast has a long timeout, i did discover that killing "shellexperiencehost.exe" the toast goes away, the problem is that whenever another one is called, the one that comes up was the last one "killed", not the new one.

ProcessExplorer shows this exe, it's kinda hidden.

Untitled.png


Spoiler

BeatsPlayer - Music player.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Firefox Profile Backup - Backup/restore previously saved profile.

Time4Shutdown - Write the time for shutdown in minutes.

Volume Editor - Change label or letter.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

Renamer - Rename files and folders, remove portions of text from the filename etc.

Paster - Main function is to paste text, but has more functions

 

Share this post


Link to post
Share on other sites

Hi, im not sure you got the issue, but i'll try to explain again, using traytips in autoit outputs these windows notifications that, take forever to go away, and don't update fast as say, a tooltip, you can output like 3 traytips in 3 seconds, 1 per second, but the time for windows to show you the actual/last traytip is going to be like 10 seconds, can't precise, but seems forever, and the notifications pile up in action center.. Basically it doesn't work as in windows 7, just try it and see.


Spoiler

BeatsPlayer - Music player.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Firefox Profile Backup - Backup/restore previously saved profile.

Time4Shutdown - Write the time for shutdown in minutes.

Volume Editor - Change label or letter.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

Renamer - Rename files and folders, remove portions of text from the filename etc.

Paster - Main function is to paste text, but has more functions

 

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

Maybe using a different means to communicate information to the user? Check if your use of TrayTip follows these guidelines:

 

See the Notifications and Notification Area sections of the Windows User Experience Interaction Guidelines for best practices in the use of notifications and the notification area. The goal is to provide user benefit through appropriate use of notifications, without being annoying or distracting.

The notification area is not for critical information that must be acted on immediately. It is also not intended for quick program or command access. As of Windows 7, much of that functionality is best accomplished through an application's taskbar button.

Windows 7 allows a user to suppress all notifications from an application if they choose, so thoughtful notification design and use will incline the user to allow your application to continue to display them. Notifications are an interruption; ensure that they are worth it.

Windows 7 introduces the concept of "quiet time". Quiet time is defined as the first hour after a new user logs into his or her account either for the first time or for the first time after an operating system upgrade or clean installation. This time is set aside to allow the user to explore and familiarize themselves with the new environment without the distraction of notifications. During this time, most notifications should not be sent or shown. Exceptions include feedback that the user would expect to see in response to a user action, such as when he or she plugs in a USB device or prints a document. API specifics of regarding quiet time are discussed later in this topic.

If not, I'd suggest using a MsgBox or similar. 

Edited by hydranix

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

I created a kind of toast, similar to the windows one, but this one can be called many times, and will override the previous one.

 

 

Capture.PNG

Edited by careca

Spoiler

BeatsPlayer - Music player.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Firefox Profile Backup - Backup/restore previously saved profile.

Time4Shutdown - Write the time for shutdown in minutes.

Volume Editor - Change label or letter.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

Renamer - Rename files and folders, remove portions of text from the filename etc.

Paster - Main function is to paste text, but has more functions

 

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now

  • Similar Content

    • therks
      By therks
      As the title says, does anyone know of a way to open the Windows 10 action center using AutoIt. Maybe via rundll or some other applet?
      My intention is to just hide the normal icon, then have an AutoIt system tray icon that will open the action center on click. And I can't just send the Win+A hotkey because I have it disabled. 
      Thanks for reading.
    • TMelanson
      By TMelanson
      Hi folks,
      I'm hoping someone can help me out here.
      Background:
      I have the need to run a program with admin credentials (#RequireAdmin), and then get the SID of the locally logged in account. Not the admin account.
      If you look at the attached script, Line 16 uses the @UserName variable and returns the SID for the admin account I used to launch the app.
      I want to use line 17 which passes the result of the _GetUsername function which is a username using  ($UserName) to the WMIService.
      I'm getting " The requested action with this object has failed.:" error message.
      Any suggestions would be appreciated!
       
      test1.au3
    • Zinthose
      By Zinthose
      Hey all!

      It's been a while since I've posted but here is a simple little function I thought I'd share that allows you to keep a script process active for a minimum amount of time.

      I use this to ensure the process is active to ensure any TrayTips remain visible.  But I'm sure there is far more interesting uses for this.
      How it Works
      The coder calls the KeepAlive function with the number of seconds he/she wants to ensure the process will remain active for the next n seconds.  Let's say you just called the TrayTip function with 15 seconds display time.  You might call KeepAlive with 18 seconds to ensure the process stays active for the next 18 seconds.  If the process is closed after that, then the process will close normally.
      #Region - KeepAlive Functions ;## Function used to ensure the process stays active for the next n seconds. This is useful to ensure ToolTips ect remain visible. #cs - Example TrayTip(@ScriptName, "This Tip will be called just prior to exit of process.", 5) KeepAlive(8) Exit #ce - Example Func KeepAlive($Seconds = 5) Global $KeeyAlive_IsActive = False Global $KeeyAlive_Init = 0 Global $KeeyAlive_Timeout = 0 ;## Check if there is a previously set timer and only set the new value if it is more than the previously set value. If $KeeyAlive_Timeout - TimerDiff($KeeyAlive_Init) < $Seconds * 1000 Then $KeeyAlive_Init = TimerInit() $KeeyAlive_Timeout = $Seconds * 1000 EndIf ;## If the callback is not yet regerister to execute on exit, register it now. If Not $KeeyAlive_IsActive Then $KeeyAlive_IsActive = True OnAutoItExitRegister("__KeepAlive_OnExit") EndIf EndFunc ;## Private On Exit Function used to ensure program remains active for a previously defined number of seconds. Func __KeepAlive_OnExit() ;## If closeing due to Loffoff or shutdown. Allow it without Delay. If @exitMethod > 2 Then Return ;## Check for reasons that process should be clsoed immediatly without delay. If @exitMethod > 2 Or Not IsDeclared("KeeyAlive_IsActive") Or Not IsDeclared("KeeyAlive_Init") Or Not IsDeclared("KeeyAlive_Timeout") Or TimerDiff($KeeyAlive_Init) > $KeeyAlive_Timeout Then Return ;## Pause Process for the time remaining. ConsoleWrite("Keeping Alive for " & Int($KeeyAlive_Timeout - TimerDiff($KeeyAlive_Init)) & "ms" & @CRLF) Sleep($KeeyAlive_Timeout - TimerDiff($KeeyAlive_Init)) EndFunc #EndRegion Enjoy!
    • onlineth
      By onlineth
      I’m wondering how to add a Windows Hello option to the additional PIN, Fingerprint, and Facial Recognition options? I'd like an interface that could be linked to the Windows Hello authentication system and AutoIt itself.
      I understand that this discussion did not meet the Forum Rules, I apologize about that. I'd like to point out that this post is asking for a way to attach into the Windows Hello service. I'd like to follow the same concept that YubiKey's interact with Windows Hello as seen here: https://www.yubico.com/2016/09/yubikey-works-windows-hello/.
    • afallenhope
      By afallenhope
      Hello all! 
      I am having a bit of trouble and was wondering if anyone may have a workaround for my issue. I made a script that would automatically install a piece of software each night on a Windows 7 Box. Now I have been instructed to do the same with a Windows 10 box since the application is now being tested on Windows 10. 
      The way I did the win7 installation was that I made a script and then made an executable that I call with a batch file along with the Installer. So the process is 
      AutoitMainFile calls batch file, batch file opens Installer, and the automatedinstaller.exe  The automatedinstlaller waits 10-20 seconds to make sure the Installer has been fully loaded.
      When I try to do the same both get loaded but the automatedinstallation.exe does not send commands to the installer. The code does work and nothing from the program we are wanting to install has changed as our Windows 7 runs every night no problem. 
       
      Do I need to make a new automatedinstall script for windows 10? 
      Any advice is appreciated 
      Thanks,
      Richard