Example of Project I'm Attempting?

Use this forum to ask questions after your subscription maintenance expires or before you buy. Need information on licensing or pricing? Questions about a trial version? This is the right place for you. No scripting questions, please.
Forum rules
DO NOT POST SUBSCRIPTION NUMBERS, LICENSE KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM.
Only the original author and our tech personnel can reply to a topic that is created in this forum. If you find a topic that relates to an issue you are having, please create a new topic and reference the other in your post.
User avatar
bzowky
Posts: 7
Joined: Mon Sep 30, 2013 1:33 pm

Example of Project I'm Attempting?

Post by bzowky » Tue Apr 16, 2019 2:45 pm

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

User avatar
davidc
Posts: 5913
Joined: Thu Aug 18, 2011 4:56 am

Re: Example of Project I'm Attempting?

Post by davidc » Tue Apr 16, 2019 3:04 pm

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
David
SAPIEN Technologies, Inc.

User avatar
bzowky
Posts: 7
Joined: Mon Sep 30, 2013 1:33 pm

Re: Example of Project I'm Attempting?

Post by bzowky » Tue Apr 16, 2019 3:22 pm

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

User avatar
Alexander Riedel
Posts: 7051
Joined: Tue May 29, 2007 4:43 pm

Re: Example of Project I'm Attempting?

Post by Alexander Riedel » Tue Apr 16, 2019 3:25 pm

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.
Alexander Riedel
SAPIEN Technologies, Inc.