What is a Sapien GUI?
The SysTray is the same thing as "Toast". Systray creates Toast popups. They are the same thing and PowerShell can use both.
What is a Sapien GUI?
Systray Application
Forum rules
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Re: Systray Application
Ok, you got a point.
So how do I continue now then?
I have a scheduled task which scans for software installed, once it finds someting which is on the not allowed list, it can show a toast message.
But the user cannot do any action on that toast message. So ideally, the systray should show a balloon message and when the user clicks on the systray, it shows the form in which the user can see (and remove) the not allowed software.
My questions:
-can then be achieved and if so how then?
-what about the form opacity, the fact there is a form which shows (even slightly visible) is not an option, what are the possibilities then?
-the psf you shared, shows a green and yellow icon, how can I replace it (the ps1 has a hash of the icon file -I could change that- but the psf does not have that)
So how do I continue now then?
I have a scheduled task which scans for software installed, once it finds someting which is on the not allowed list, it can show a toast message.
But the user cannot do any action on that toast message. So ideally, the systray should show a balloon message and when the user clicks on the systray, it shows the form in which the user can see (and remove) the not allowed software.
My questions:
-can then be achieved and if so how then?
-what about the form opacity, the fact there is a form which shows (even slightly visible) is not an option, what are the possibilities then?
-the psf you shared, shows a green and yellow icon, how can I replace it (the ps1 has a hash of the icon file -I could change that- but the psf does not have that)
Re: Systray Application
Here is an old demo of how to manually create a NotifyIcon. You cannot run it in PSS due to security restrictions on the system notification subsystem.
- Attachments
-
- Test-NotifyIcon.ps1
- (1.32 KiB) Downloaded 149 times
Re: Systray Application
Thanks, but when I run it (not in Ps Studio) then an alertbox comes first, then it shows the info box indeed, which is nice.
Though it runs as which process? Since it does not close itself.
Though it runs as which process? Since it does not close itself.
Re: Systray Application
It is just a simple example and it is up to you to learn how it works from the MS documentation. Also your use of that notification subsystem is something you will have to work out after you learn how it works.
It does what you asked, it opens a ballontip and allows someomnne to click it then executes code when it is clicked. Everything about that is in the code along with examples as to how to add a menu and obtain the menu clicks.
THe alert box is likely from some other system. The code has no alert box in it. the icon subsytem stays loaded until the script session ends or you can terminate it at any time be destroying the object.
$ni.Dispose()
It does what you asked, it opens a ballontip and allows someomnne to click it then executes code when it is clicked. Everything about that is in the code along with examples as to how to add a menu and obtain the menu clicks.
THe alert box is likely from some other system. The code has no alert box in it. the icon subsytem stays loaded until the script session ends or you can terminate it at any time be destroying the object.
$ni.Dispose()
Re: Systray Application
Ok, got it working now
So got a systray icon, called from a ps1 (ps studio doesn't allow me to convert the ps1 to an exe, strange thing: if I try to open a ps1 it opens a psf, tried ten times, closed and opened ps studio) that calls for a form which is in an exe.
I'd like to make the form look like the Microsoft OneDrive interface (default icon these days on W10). Same big ribbon on top, modern icons, no old school Window menu like ps studio defaults to (not sure if that's possible). So if you hover over the icon it gives a status of Onedrive (up to date), if you click on the Onedrive icon, you get a form in the right button corner with some statuses and actions in it.
If it's out of date or there is an error, you get a balloon or toast message.
Exactly that is what I'm looking for.
So got a systray icon, called from a ps1 (ps studio doesn't allow me to convert the ps1 to an exe, strange thing: if I try to open a ps1 it opens a psf, tried ten times, closed and opened ps studio) that calls for a form which is in an exe.
I'd like to make the form look like the Microsoft OneDrive interface (default icon these days on W10). Same big ribbon on top, modern icons, no old school Window menu like ps studio defaults to (not sure if that's possible). So if you hover over the icon it gives a status of Onedrive (up to date), if you click on the Onedrive icon, you get a form in the right button corner with some statuses and actions in it.
If it's out of date or there is an error, you get a balloon or toast message.
Exactly that is what I'm looking for.
Last edited by stevens on Fri Jun 25, 2021 11:25 am, edited 1 time in total.
Re: Systray Application
Here is how to start with any control you are wanting to use.
https://docs.microsoft.com/en-us/dotnet ... ew=net-5.0
There is one of these documents for every WinForms control.
https://docs.microsoft.com/en-us/dotnet ... ew=net-5.0
There is one of these documents for every WinForms control.