Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 07/22/2020 in Posts

  1. In UIA code, an application top window is identified by the window control type being either $UIA_WindowControlTypeId or $UIA_PaneControlTypeId. E.g. the Chrome top window is a Pane control. Thus, not all application top windows can be identified solely through the $UIA_WindowControlTypeId. And the window must be a direct child of the Desktop. UIA code to identify all application top windows: #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 #AutoIt3Wrapper_UseX64=y ; If target application is running as 64 bit code #include "UIA_Constants.au3" ; Can be copied from UIASpy Includes folder Opt( "MustDeclareVars", 1 ) Example() Func Example() ; Create UI Automation object Local $oUIAutomation = ObjCreateInterface( $sCLSID_CUIAutomation, $sIID_IUIAutomation, $dtag_IUIAutomation ) If Not IsObj( $oUIAutomation ) Then Return ConsoleWrite( "$oUIAutomation ERR" & @CRLF ) ConsoleWrite( "$oUIAutomation OK" & @CRLF ) ; Get Desktop element Local $pDesktop, $oDesktop $oUIAutomation.GetRootElement( $pDesktop ) $oDesktop = ObjCreateInterface( $pDesktop, $sIID_IUIAutomationElement, $dtag_IUIAutomationElement ) If Not IsObj( $oDesktop ) Then Return ConsoleWrite( "$oDesktop ERR" & @CRLF ) ConsoleWrite( "$oDesktop OK" & @CRLF ) ; --- Code Snippets --- ConsoleWrite( "--- Code Snippets ---" & @CRLF ) ; --- Or condition to find window/control --- ConsoleWrite( "--- Or condition to find window/control ---" & @CRLF ) Local $pCondition0, $pCondition1, $pOrCondition1 $oUIAutomation.CreatePropertyCondition( $UIA_ControlTypePropertyId, $UIA_WindowControlTypeId, $pCondition0 ) $oUIAutomation.CreatePropertyCondition( $UIA_ControlTypePropertyId, $UIA_PaneControlTypeId, $pCondition1 ) $oUIAutomation.CreateOrCondition( $pCondition0, $pCondition1, $pOrCondition1 ) If Not $pOrCondition1 Then Return ConsoleWrite( "$pOrCondition1 ERR" & @CRLF ) ConsoleWrite( "$pOrCondition1 OK" & @CRLF ) ; --- $oUIElement methods --- ConsoleWrite( "--- $oUIElement methods ---" & @CRLF ) Local $pElements ;$oDesktop.FindAll( $TreeScope_Children, $pCondition0, $pElements ) ; Windows only $oDesktop.FindAll( $TreeScope_Children, $pOrCondition1, $pElements ) ; Windows and Panes ConsoleWrite( "$oDesktop.FindAll()" & @CRLF ) ; --- Code Snippets --- ConsoleWrite( "--- Code Snippets ---" & @CRLF ) Local $oUIElementArray1, $iLength1 ; $pElements is a pointer to an UI Automation element array $oUIElementArray1 = ObjCreateInterFace( $pElements, $sIID_IUIAutomationElementArray, $dtag_IUIAutomationElementArray ) $oUIElementArray1.Length( $iLength1 ) If Not $iLength1 Then Return ConsoleWrite( "$iLength1 = 0 ERR" & @CRLF ) ConsoleWrite( "$iLength1 = " & $iLength1 & @CRLF ) ; --- Code Snippets --- ConsoleWrite( "--- Code Snippets ---" & @CRLF ) Local $pElement1, $oElement1 Local $sClassName1, $sLocalizedControlType1, $sName1, $hNativeWindowHandle1 For $i = 0 To $iLength1 - 1 $oUIElementArray1.GetElement( $i, $pElement1 ) $oElement1 = ObjCreateInterface( $pElement1, $sIID_IUIAutomationElement, $dtag_IUIAutomationElement ) $oElement1.GetCurrentPropertyValue( $UIA_ClassNamePropertyId, $sClassName1 ) Switch $sClassName1 Case "Progman", "Shell_TrayWnd" ContinueLoop EndSwitch ConsoleWrite( @CRLF & "$sClassName1 = " & $sClassName1 & @CRLF ) $oElement1.GetCurrentPropertyValue( $UIA_LocalizedControlTypePropertyId, $sLocalizedControlType1 ) ConsoleWrite( "$sLocalizedControlType1 = " & $sLocalizedControlType1 & @CRLF ) $oElement1.GetCurrentPropertyValue( $UIA_NamePropertyId, $sName1 ) ConsoleWrite( "$sName1 = " & $sName1 & @CRLF ) $oElement1.GetCurrentPropertyValue( $UIA_NativeWindowHandlePropertyId, $hNativeWindowHandle1 ) ConsoleWrite( "$hNativeWindowHandle1 = " & HWnd( $hNativeWindowHandle1 ) & @CRLF ) Next EndFunc Note the Switch section to exclude windows that are not considered normal windows: Switch $sClassName1 Case "Progman", "Shell_TrayWnd" ContinueLoop EndSwitch Output: $oUIAutomation OK $oDesktop OK --- Code Snippets --- --- Or condition to find window/control --- $pOrCondition1 OK --- $oUIElement methods --- $oDesktop.FindAll() --- Code Snippets --- $iLength1 = 11 --- Code Snippets --- $sClassName1 = SciTEWindow $sLocalizedControlType1 = window $sName1 = D:\Programmering\AutoIt\Temp\UIA related issues\How does UIA Spy identify these windows\tst00.au3 - SciTE $hNativeWindowHandle1 = 0x000000000002056C $sClassName1 = Notepad++ $sLocalizedControlType1 = window $sName1 = D:\Programmering\AutoIt\Temp\UIA related issues\How does UIA Spy identify these windows\tst00.au3 - Notepad++ $hNativeWindowHandle1 = 0x000000000006036A $sClassName1 = Chrome_WidgetWin_1 $sLocalizedControlType1 = pane $sName1 = Kind LarsJ, how does UIA Spy identify these windows? - AutoIt General Help and Support - AutoIt Forums - Microsoft Edge $hNativeWindowHandle1 = 0x00000000000201E4 $sClassName1 = AutoIt v3 GUI $sLocalizedControlType1 = window $sName1 = UIASpy - UI Automation Spy Tool $hNativeWindowHandle1 = 0x000000000005035E $sClassName1 = MozillaWindowClass $sLocalizedControlType1 = window $sName1 = Mozilla Firefox $hNativeWindowHandle1 = 0x00000000000905EE $sClassName1 = Chrome_WidgetWin_1 $sLocalizedControlType1 = pane $sName1 = about:blank - Google Chrome $hNativeWindowHandle1 = 0x000000000001043C $sClassName1 = IEFrame $sLocalizedControlType1 = window $sName1 = Blank Page - Internet Explorer $hNativeWindowHandle1 = 0x0000000000020480 $sClassName1 = CabinetWClass $sLocalizedControlType1 = window $sName1 = How does UIA Spy identify these windows $hNativeWindowHandle1 = 0x0000000000030246 $sClassName1 = CabinetWClass $sLocalizedControlType1 = window $sName1 = UIASpy $hNativeWindowHandle1 = 0x00000000000502B8
    1 point
  2. You should definitely look in to use Web automation UDF like IE or WebDriver. It will be way easier for you to get robust script than trying to use MouseClicks. IE is part of the installation of AutoIt and it is well documented in help file.
    1 point
  3. Thank you very much now all works i have also test and create users that have ä å ö and all works perfect thanks for your help...
    1 point
  4. New version in the first post. Codepage 1252 inserted.
    1 point
  5. You're not doing anything with the $go variable, try this (and please use a code block in future posts): HotKeySet ( "{DOWN}","_start" ) HotKeySet ( "{UP}","_pause" ) HotKeySet ( "{END}","_exit" ) Global $go = 0 While(1) If($go) Then MouseClick("left",912,271,1,1) Sleep(100) MouseClick("left",912,718,1,1) $go=0 Else Sleep(1) EndIf WEnd Func _start() $go = 1 EndFunc Func _pause() $go = 0 EndFunc Func _exit() Exit EndFunc
    1 point
  6. Hi Exit ! I have test the A2C.au3 and that works perfect it creates the icon on my desktop no problems.
    1 point
  7. One easy way. Use WM_COMMAND with EN_CHANGE. Check if the input box contains other char than [0-9] and backspace it.
    1 point
  8. Figured out that you have to use a relative xpath for this Webdriver function to work correctly. Try your code again after making this one change -- Local $sXpathUserContent = ".//div[contains(@class, 'userContent ')]" ;xpath within element $PostContent to usercontent
    1 point
×
×
  • Create New...