Taskbar

May 15, 2014 at 7:51 PM
Ok, I have been working on this and I am looking for ideas. I have a series of programs that I have launched and minimized and want to script the closing of these with WASP because when they are launched there are key presses to start and when they are closed there are key presses to ensure that they close. However since WASP can only effect windows that are either open or up and in the background I am looking for a way to just send a command or something to the minimized window to get it back where I can manipulate it.

I tried
Select-Window explorer | Set-WindowActive | Send-Keys '%{TAB}'
With mixed results, some times it brings up some of the windows, others it does nothing.
Since there is no windows key or space bar key press shortcuts for WASP it makes it a little bit more difficult.

I saw reading through the discussions that there was a way to access the system tray, is there a similar way to access the taskbar?
Coordinator
May 15, 2014 at 11:14 PM
You'll have to use the script version, and the best approach depends on your version of Windows

It's on chocolatey so if you haven't got it, you can install it with PoshCode's Install-Module WASP or if you don't have PoshCode installed yet, you can install that and WASP at the same time using:
Start-Service WebClient # to start the webDAV client
\\PoshCode.org\Modules\Install WASP
I think what you need is just Invoke-Window.SetWindowVisualState
you should be able to bring any task to to "Normal" and then set focus with:
Select-UIElement -class icoGoogle | Invoke-Window.SetWindowVisualState -state Normal -Passthru | Set-UIFocus
Having said that, with the latest versions of WASP I added the Add-Input and Send-Input commands which are ... well ... awesome ;)

For instance, you can send WIN+T to basically tab through the buttons on the taskbar, or, if you have pinned the apps and can be sure of their order on the taskbar, you can use WIN and a number key to invoke them:
add-input -keypress VK_T -Modifiers LWIN | 
add-input -keypress VK_T -Modifiers LWIN | 
add-input -keypress VK_T -Modifiers LWIN | Send-Input
Or
add-input -keypress VK_4 -Modifiers LWIN | Send-Input
May 19, 2014 at 8:04 PM
Ok, so I couldnt get this done. I went to chocolatey and managed to download wasp.2.5.0.1.nupkg, and I am not sure how to install it. I tried your Start-Service WebClient line and all I ever see from that is down in the ISE that Intellisense is closing or that it timed out. Not sure how to add the \poshcode.org\modules\install WASP as a argument to that...

I went to posh code and tried to execute this command to install
iwr http://PoshCode.org/i -OutF PC.ps1; .\PC; rm .\PC.ps1
and got an error that Import-AtomFeed is not recognized as the name of a cmdlet, function, script file, or operable program.

So how do I get there from here?
May 19, 2014 at 8:23 PM
Ok got chocolatey installed ran cinst WASP but still could not get any of the new elements to work

do I need to point chocolatey at wasp.2.5.01.nupkg to install?
Coordinator
May 20, 2014 at 3:11 AM
Edited May 20, 2014 at 3:15 AM
Heh. \\PoshCode.org\Modules is a WebDAV server ... so that's not an argument, it's a command. There's a script "Install.ps1" in that folder, you can open up the folder in explorer to see it, and then just run it from PowerShell \\PoshCode.org\Modules\Install.ps1

Of course, I don't know what that error about AtomFeed is. The "http://PoshCode.org/i" link is just a web shortcut to that Install.ps1 script, so I can't imagine how you could download it and run it and yet not have the command, which is defined in that file ;-)

Anyway, if you used Chocolatey instead of PoshCode, you probably ended up unzipping the package in C:\Chocolatey\lib\wasp.2.5.0.0\ instead of in your PSModulePath ... You'll want to:
copy-item C:\Chocolatey\lib\wasp.2.5.0.0\*  ~\Documents\WindowsPowerShell\Modules\WASP -Recurse