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 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.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
plautodfl
Posts: 20
Joined: Tue Apr 16, 2019 8:16 pm

Complete a task - Exit Compiled App

Post by plautodfl » Thu Jul 11, 2019 12:30 pm

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.  
  3.  if(Test-Connection -Quiet -ComputerName "dcx-p-a-xxxdr01" -Count 1){
  4.  
  5.         $url = "http://dcx-p-a-xxxdr01/Director"
  6.  
  7.         $ie = New-Object -com internetexplorer.application
  8.  
  9.         $ie.visible = $true
  10.  
  11.         $ie.navigate($url)
  12.  
  13.         break
  14.  
  15.     }
  16.  
  17.  
  18.  
  19.     if(Test-Connection -Quiet -ComputerName "dcx-p-a-xxxdr02" -Count 1){
  20.  
  21.         $url = "http://dcx-p-a-ctxdrxx/Director"
  22.  
  23.         $ie = New-Object -com internetexplorer.application
  24.  
  25.         $ie.visible = $true
  26.  
  27.         $ie.navigate($url)
  28.  
  29.         break
  30.  
  31.     }
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  

User avatar
brittneyr
Site Admin
Posts: 224
Joined: Thu Jun 01, 2017 7:20 am

Re: Complete a task - Exit Compiled App

Post by brittneyr » Thu Jul 11, 2019 3:09 pm

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

plautodfl
Posts: 20
Joined: Tue Apr 16, 2019 8:16 pm

Re: Complete a task - Exit Compiled App

Post by plautodfl » Wed Jul 17, 2019 9:35 am

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: 224
Joined: Thu Jun 01, 2017 7:20 am

Re: Complete a task - Exit Compiled App

Post by brittneyr » Wed Jul 17, 2019 10:37 am

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 1293 times
This script engine option will suppress any output sent to the console, and no window is displayed when executed directly.
Brittney Ryn
SAPIEN Technologies, Inc.

plautodfl
Posts: 20
Joined: Tue Apr 16, 2019 8:16 pm

Re: Complete a task - Exit Compiled App

Post by plautodfl » Fri Jul 19, 2019 8:10 am

coolio-
Trying now...
Thanks!
~P.