Jump to content

AtomicSeek

Members
  • Posts

    5
  • Joined

  • Last visited

Everything posted by AtomicSeek

  1. Dear LarsJ, For me there still seems to be a problem related to screen scaling. I'm using the latest version of UIASpy (from March 23), and my screen scaling is set to 125% (because at 100% everything is too small). After selecting the same scaling in UIASpy: 1. If I'm pressing F1-F4 to detect the element, then the correct (scaled) red rectangle is shown but only for a fraction of a second, and afterwards the wrong (not scaled) red rectangle is shown and remain visible. 2. If I'm selecting the element in UIASpy by clicking it in the left pane, then only the wrong (not scaled) red rectangle is shown and remain visible. I tested also with other scalings and I have the same problem. At 100% the red rectangle is shown correctly. Does this happens also to anyone else? Thank you, AtomicSeek
  2. I am a fan of clean code, and comparing the native AutoIt code, with this way of using the UI Automation code in AutoIt, for the same simple task (for example, checking if a window exists and activating it), the result is very different in size and approach. Of course I am more than happy and thankful to LarsJ for his work, giving us a way to automate what we could not automate with native AutoIt code. In the same time, I am also looking for ways to shorten the UI Automation approach up to a level similar with the native AutoIt code. I'm sorry for my intervention, I did not want to deviate in any way this great topic..
  3. Being focused on ways to shorten the code, I missed the most important part there: the return functionality in case of error ..
  4. Dear LarsJ, I have one small suggestion: Ternary Operator can be used in order to shorten the error checking codes: #include "Includes\CUIAutomation2.au3" ; Get proper version in UIASpy Includes folder Opt( "MustDeclareVars", 1 ) Example() ; Ternary Operator ; Conditionally chooses one of two responses based on the result of an expression. ; (expression) ? (expression1 if expression is True) : (expression2 if expression is False) Func Example() ; Create UI Automation object Local $oUIAutomation = ObjCreateInterface( $sCLSID_CUIAutomation, $sIID_IUIAutomation, $dtagIUIAutomation ) ; by using the Ternary Operator, the following 2 lines If Not IsObj( $oUIAutomation ) Then Return ConsoleWrite( "$oUIAutomation ERR" & @CRLF ) ConsoleWrite( "$oUIAutomation OK" & @CRLF ) ; can be replaced by this line ConsoleWrite ( (IsObj($oUIAutomation)) ? ("$oUIAutomation OK" & @CRLF) : ("$oUIAutomation ERR" & @CRLF) ) ; or even shorter by this line ConsoleWrite ( "$oUIAutomation " & ( IsObj($oUIAutomation) ? "OK" : "ERR" ) & @CRLF ) EndFunc .. but it's true that this way the Return part dissapears .. Thak you for your amazing help! Best regards, AtomicSeek
  5. Dear LarsJ, Your UIASpy tool and related examples are simply amazing. I was struggling for months to automate WindowsForms10 and other types of applications that resist to classic AutoIt and this helps me a lot. UI Automation is like the "missing chapter" of AutoIt, and I am very excited to see that it starts to take a functional form. I think this example can be considered even more classic because it does not contain any other UDFs: ; open Notepad Run ( "Notepad.exe" ) ; wait for Notepad window to exist Local $hNotepad = WinWait ( "[CLASS:Notepad; TITLE:Untitled - Notepad;]" ) ; write "HelloWorld" ControlSetText ( $hNotepad, "", "[CLASS:Edit; INSTANCE:1]", "HelloWorld" ) ; open the SaveAs window (by pressing ALT+f and a) ControlSend ( $hNotepad, "", "", "{ALT}fa" ) ; wait for Save As window to exist Local $hSaveAs = WinWait ( "[CLASS:#32770; TITLE:Save As;]" ) ; complete the File Name field with "HelloWorld.txt" ControlSetText ( $hSaveAs, "", "[CLASS:Edit; INSTANCE:1]", "HelloWorld.txt" ) ; press the Save button ControlClick ( $hSaveAs, "", "[CLASS:Button; INSTANCE:2]" ) ; wait for Save As window to close WinWaitClose ( $hSaveAs, "" ) ; close the Notepad window WinClose ( $hNotepad, "" ) ; wait for Notepad window to close WinWaitClose ( $hNotepad, "" ) Thank you! Best regards, AtomicSeek
×
×
  • Create New...