JC_Aus Posted July 20, 2018 Share Posted July 20, 2018 I have had great success using the AutoIT Powershell cmdlets, However I am stuck trying to get a comprehensive list of Window handles (as provided by AutoIt "WinList" command). I have resorted to a cludge of calling an AutoIt script to run the command and put results in a file and then reading the file in powershell. Can someone point me to an explanation of how to do this better? Link to comment Share on other sites More sharing options...
careca Posted July 20, 2018 Share Posted July 20, 2018 Yes, do it all in autoit. Why use powershell anyway? Spoiler Renamer - Rename files and folders, remove portions of text from the filename etc. GPO Tool - Export/Import Group policy settings. MirrorDir - Synchronize/Backup/Mirror Folders BeatsPlayer - Music player. Params Tool - Right click an exe to see it's parameters or execute them. String Trigger - Triggers pasting text or applications or internet links on specific strings. Inconspicuous - Hide files in plain sight, not fully encrypted. Regedit Control - Registry browsing history, quickly jump into any saved key. Time4Shutdown - Write the time for shutdown in minutes. Power Profiles Tool - Set a profile as active, delete, duplicate, export and import. Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes. NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s. IUIAutomation - Topic with framework and examples Au3Record.exe Link to comment Share on other sites More sharing options...
iamtheky Posted July 20, 2018 Share Posted July 20, 2018 can always resort to executeline .\AutoIt3.exe /AutoIt3ExecuteLine "msgbox(0 , '' , winlist('AutoIt v3')[1][0] & ' | ' & winlist('AutoIt v3')[1][1])" ,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-. |(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/ (_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_) | | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) ( | | | | |)| | \ / | | | | | |)| | `--. | |) \ | | `-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_| '-' '-' (__) (__) (_) (__) Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted July 20, 2018 Moderators Share Posted July 20, 2018 11 hours ago, careca said: Yes, do it all in autoit. Why use powershell anyway? There is a reason Jon decided to create a PowerShell sub forum. @JC_Aus while I agree that AutoIt makes this task easier, if you have a requirement to do it in PS you could do something like this: Get-Process | Where-Object {$_.MainWindowTitle -like "*notepad*"} | Select MainWindowTitle, MainWindowHandle | Out-GridView If you're looking to capture more like all open windows, you can modify it slightly: Get-Process | Where-Object {$_.MainWindowTitle -ne ""} | Select MainWindowTitle, MainWindowHandle | Out-GridView "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
JC_Aus Posted July 25, 2018 Author Share Posted July 25, 2018 Thanks all for your comments/suggestions. I had originally gone down the 'Get-Process' path, but it does not display all child windows (eg Outlook can have multiple windows open). Winlist does display them all. My final solution was to use ComObject, it had to run as 32 bit, but otherwise no issue $AU3 = New-object -ComObject "AutoItX3.Control" # Must run as 32 bit $array1 = @() $list = $AU3.winlist("[ALL]") for ($i = 1;$i -lt $($list.GetUpperBound(1));$i++) { $title = $list[0,$i] if ($title -ne "" ) { $array1+=($title) } } Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now