Administrators Jon Posted August 24, 2013 Administrators Posted August 24, 2013 I've added these experimental PowerShell Cmdlets to the beta download. To use open PowerShell ISE: Import-Module "C:\Program Files\AutoIt\Beta\AutoItX\AutoItX3_PS.dll" Wait-AU3WinActive -Title "Untitled - Notepad" You will need to specify "C:Program Files (x86)" if you have a 64bit system. It should work with PowerShell v2.0 or v3.0 - although it's in a very early stage yet. Current CmdLets Implemented Get-AU3ErrorCode Initialize-AU3 Set-AU3Option Send-AU3Key Show-AU3WinActivate Close-AU3Win Get-AU3WinText Get-AU3WinTitle Close-AU3Win Wait-AU3Win Wait-AU3WinActive Wait-AU3WinClose Wait-AU3WinNotActive
Administrators Jon Posted August 26, 2013 Author Administrators Posted August 26, 2013 I'm going to use Parameter Sets to allow a lot of the Win functions to either accept Title/Text paramters or a proper window handle (HWND) that can be obtained from Get-WinHandle (next beta). PS> Get-Help Wait-AU3WinClose NAME Wait-AU3WinClose SYNTAX Wait-AU3WinClose [-Title] <string> [[-Text] <string>] [[-Timeout] <int>] [<CommonParameters>] Wait-AU3WinClose [-Handle] <IntPtr> [[-Timeout] <int>] [<CommonParameters>] The window handle will be treated as the .NET IntPtr type: $handle = Get-AU3WinHandle -Title "Untitled - Notepad" $handle.GetType() IsPublic IsSerial Name BaseType -------- -------- ---- -------- True True IntPtr System.ValueType This will be far easier than trying to shoe-horn handles into strings.
Richard Robertson Posted August 28, 2013 Posted August 28, 2013 I never really understood why you put handles into strings instead of a wide-enough integer anyway. But then again, AutoItX was always just a side project.
Administrators Jon Posted August 28, 2013 Author Administrators Posted August 28, 2013 AutoIt didn't work with real handles when I first made AutoItX - handles were strings in there too. AutoItX is mostly is simple wrapper around the AutoIt functions so is a symptom of the time it was developed and then never updated.
Administrators Jon Posted August 29, 2013 Author Administrators Posted August 29, 2013 I think the hardest part of this is mapping the AutoIt names to the PowerShell approved verbs list. http://msdn.microsoft.com/en-us/library/windows/desktop/ms714428%28v=vs.85%29.aspx Some are fairly easy, like Get-AU3WinHandle. But the closest I can find for WinExists is Assert-AU3WinExists. At least they are really easy to rename and alias.
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