WASP and the Windows OSK (On-Screen Keyboard)

Jul 24, 2014 at 8:38 PM

I've been looking around for a way to control the placement of the Windows On-Screen Keyboard via script. After a lot of searching (and a lot of failed VBScripts) I came across this tool.

The only problem is, Set-WindowPosition doesn't seem to work with the OSK window.

In other words, the following command works:
select-window notepad | select -first 1 | set-windowposition -x 600 -y 200
But this one does not:
select-window osk | select -first 1 | set-windowposition -x 600 -y 200
It does, however, pull up the OSK if it had been minimized, which I guess is nice (it cuts out a step in the script).

In addition, I can close the window just fine using:
select-window osk | select -first 1 | remove-window
Can anyone tell if I'm doing something wrong or if I want is even possible?
Jul 28, 2014 at 4:58 AM
That window is special, you have to be elevated to move it. If you try it with the new WASP module that's on PoshCode/Chocolatey/PowerShellGet you'll actually get an access denied error:
C:\PS> Select-UIElement -ProcessName osk | Invoke-Transform.Move -x 200 -y 300
Exception calling "Move" with "2" argument(s): "Access is denied"
But it will work from an elevated window.
Aug 4, 2014 at 4:06 AM
Awesome, thanks! I hadn't thought that you'd need elevation to move a window but not to close it.