Jump to content

End taskbar app


Recommended Posts

I have a simple script that launches an application, runs another application that interacts with the first, then after the secon application ends on its own, the script closes the first application. Here's the script:

; Run a listening VNC viewer
$listener = Run("C:\Program Files\TurboVNC\vncviewer.exe /listen")

; SSH to server, and run a script that starts a VNC server, and opens a connection back to this machine
$prism = RunWait(@ComSpec & " /c " & "plink -i id_rsa.ppk chris@sessionhost prism", "C:\Users\Chris\Documents\My Program Files\Putty")

; When the VNC session ends, the SSH session will also end.  But we need to shut down the listener manually.
ProcessClose($listener)

Problem is, the VNC viewer puts an icon on the taskbar. Ending the VNC viewer via "ProcessClose" doesn't give the process a chance to clean up after itself. So each time I run my script, I end up with another orphan VNC icon in my taskbar. Very messy. How can I get rid of those icons? Is there a way to get handles to the taskbar icons and figure out which one I can delete? Or is there a way to activate and manipulate the menu for the taskbar app? (The VNC viewer has a "Close listening viewer" option on its taskbar menu, which causes a graceful exit...)

Any hints appreciated!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...