Jump to content

PowerShell + AutoIT + Clip


jefhal
 Share

Recommended Posts

Since "Clip" is included in Windows Server 2003 and Vista, and runs fine on WinXP (and Win2K?), it makes it easy to get output from PowerShell to AutoIt:

ClipPut("")
RunWait("PowerShell.exe -command $(get-process | where {$_.processname -match '(svc.*)'} | where {$_.ws -gt 3000})[-1..-3] | ft -hide | clip",@TempDir,@SW_HIDE)
$PowerShell = ClipGet()
MsgBox(1,"$powershell",$PowerShell)

This example is not necessarily a practical one, but rather a way of demonstrating a number of useful facets of PowerShell technology. These include: regular expression matching, formatting, filtering, sub-expressions and array slicing...

Edited by jefhal
...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format
Link to comment
Share on other sites

Thanks Ptrex. As long as people can find it, it will be there waiting... Took me a while to dope it out so I hope it's of use to many others.

...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format
Link to comment
Share on other sites

Here's another one:

$strComputer = "anycomputer"
ClipPut("")
    RunWait("powershell.exe -command $(get-wmiobject -computer '" & $strComputer & "' -class win32_logicaldisk | where-object {$_.drivetype -match 3}) | clip", @TempDir,@SW_HIDE)
$answer = ClipGet()
MsgBox(1,"$answer",$answer)
...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format
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...