Page 1 of 1

Example of Project I'm Attempting?

Posted: Tue Apr 16, 2019 2:45 pm
by bzowky
Good Afternoon -

I've always been interested in Powershell Studio and recently reinstalled the trial. I'm trying to create an application/script that does a couple of basic actions, but having issues getting it to work. If possible, could you point me to an example / sample project that is similar so that I may see if the result is what I want? If none exist, any assistance or links would be appreciated.

Project Goal
Upon running, it will execute an existing PS1 script with the -noexit parameter then minimize to a custom icon in the system tray. Right clicking on the tray icon will provide an "Exit" option which when selected will stop the script which was initially started with the -noexit parameter and close out of the app therefore removing the tray icon.

Anything you could do to assist would be appreciated -

Thank You

Re: Example of Project I'm Attempting?

Posted: Tue Apr 16, 2019 3:04 pm
by davidc
We have a packager engine / host that is a system tray application:

https://www.sapien.com/blog/2017/07/10/ ... owershell/

Please let us know if this is indeed what you are looking for.

Alternatively, you could use PowerShell Studio's designer to add a NotifyIcon control that displays in the system tray:

https://info.sapien.com/index.php/guis/ ... on-control

Re: Example of Project I'm Attempting?

Posted: Tue Apr 16, 2019 3:22 pm
by bzowky
Thank you -

I actually found out about that after posting, but having an issue. I built the script and executed the EXE, but it immediately closes. I'm sure it's because most of the scripts I wish to compile use "IO.FileSystemWatcher" therefore when launching from command line using powershell.exe, I must include the -noexit parameter or I get the same behavior. I looked through build options, but didn't see anything like "-noexit", unfortunately.

Short of perhaps calling an existing script from the EXE which defeats the whole point, how would I go about configuring the build so that once executed, it wouldn't exit until one right clicks on the icon and chooses to do so?

If I could figure that out, I think this app will suite my needs. Thanks

Re: Example of Project I'm Attempting?

Posted: Tue Apr 16, 2019 3:25 pm
by Alexander Riedel
I would suggest these articles.
https://www.sapien.com/blog/2017/07/10/ ... owershell/
https://www.sapien.com/blog/2019/01/10/ ... lications/

You will note the they make clear that your script needs to not exit until you decide to close the app.
I suggest to study the associated sample project.