Complete a task - Exit Compiled App

This forum can be browsed by the general public. Posting is limited to current SAPIEN license holders with active maintenance and does not offer a response time guarantee.
Forum rules
DO NOT POST LICENSE NUMBERS, ACTIVATION 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.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
This topic is 4 years and 8 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
plautodfl
Posts: 30
Last visit: Thu Jun 09, 2022 6:09 am

Complete a task - Exit Compiled App

Post by plautodfl »

Product: PowerShell Studio 2019 (64 Bit)
Build: v5.6.165
OS: Windows 10 Enterprise (64 Bit)
Build: v10.0.17763.0

I have a little snippet that checks to see if a server is online - if so launches iexplore and the site.
However, once the site is successfully launched (it runs through four sites)
I would like it to close the Powershell Studio App automatically.
Thoughts?
Thanks!
~P.

  1.  
  2.  if(Test-Connection -Quiet -ComputerName "dcx-p-a-xxxdr01" -Count 1){
  3.         $url = "http://dcx-p-a-xxxdr01/Director"
  4.         $ie = New-Object -com internetexplorer.application
  5.         $ie.visible = $true
  6.         $ie.navigate($url)
  7.         break
  8.     }
  9.  
  10.     if(Test-Connection -Quiet -ComputerName "dcx-p-a-xxxdr02" -Count 1){
  11.         $url = "http://dcx-p-a-ctxdrxx/Director"
  12.         $ie = New-Object -com internetexplorer.application
  13.         $ie.visible = $true
  14.         $ie.navigate($url)
  15.         break
  16.     }
  17.  
  18.  
  19.  
User avatar
brittneyr
Site Admin
Posts: 1654
Last visit: Wed Mar 27, 2024 1:54 pm
Answers: 39
Been upvoted: 30 times

Re: Complete a task - Exit Compiled App

Post by brittneyr »

Are you running this script through PowerShell Studio and when its done you would like PowerShell Studio to close?

If you are running this script from PowerShell Studio, I would suggest using the packager to package the script into an exe that you can run without using PowerShell Studio.
You can use the cmdlets get-process and stop-process to close PowerShell Studio.
Brittney
SAPIEN Technologies, Inc.
plautodfl
Posts: 30
Last visit: Thu Jun 09, 2022 6:09 am

Re: Complete a task - Exit Compiled App

Post by plautodfl »

This is a compiled app using PowerShell studio for our help desk.
The app scrolls through some web servers.
When it hits a web server that is up, it launches the web site in a browser.
After the web site is launched -
I would then like the PowerShell compiled exe to close automatically without having to click File | Exit
Thanks!
~P.
User avatar
brittneyr
Site Admin
Posts: 1654
Last visit: Wed Mar 27, 2024 1:54 pm
Answers: 39
Been upvoted: 30 times

Re: Complete a task - Exit Compiled App

Post by brittneyr »

How are you packaging your exe?
If you do not have any written output, I would suggest packaging your script with a Silent engine:
sps-silent.png
sps-silent.png (72.61 KiB) Viewed 3055 times
This script engine option will suppress any output sent to the console, and no window is displayed when executed directly.
Brittney
SAPIEN Technologies, Inc.
plautodfl
Posts: 30
Last visit: Thu Jun 09, 2022 6:09 am

Re: Complete a task - Exit Compiled App

Post by plautodfl »

coolio-
Trying now...
Thanks!
~P.
This topic is 4 years and 8 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.