Leaderboard
Popular Content
Showing content with the highest reputation on 12/03/2018 in all areas
-
The GUI looks like shown in the picture: It contains a main menu, a treeview in left pane that lists UI Automation elements, a listview in right pane that displays detail information for the selected element, and a splitterbar to adjust the width of the two panes. Detect element The "Detect element" main menu is used to detect elements under the mouse with function keys F1 - F4. See How to topics number 2. Left pane The left pane is a treeview that initially lists open programs and windows. Generally, the left pane shows UI Automation elements represented as treeview items. Right pane The right pane is a listview that displays detail information for the selected treeview element. The information is grouped into different types of information. Only the relevant information for each type is displayed. Invalid elements When a window is closed the elements in UIASpy becomes invalid. But the elements are not deleted in UIASpy and can still be handled and selected in the treeview. Detail information for an element that was calculated before the window was closed can still be seen in the listview. In this way it's possible for UIASpy to show information for eg. a context menu that is closed as soon as it loses focus. Listview features Listview features Help system With completion of the Help system, a lot of information has been moved from this post and other posts into the Help system. Sample code creation Sample code creation is implemented through the UI element Detail info listview page and through the Sample code main menu. Sample code creates code snippets based on data in one or more selected rows in the Detail info listview page or based on the clicked Sample code menu item. UI Automation code is largely based on COM interface objects and thus on the function ObjCreateInterface(), which is one of the advanced functions in AutoIt. The main purpose of Sample code functionality is to eliminate the complexity of ObjCreateInterface(). Sample code creation either through the Detail info listview page or through the Sample code main menu can create all the interface objects required in UI Automation code. Another purpose is of course to make it easier and faster to implement code for simple automation tasks. Through Sample code creation, you can more or less create all code in a simple automation task: Create UI Automation initial code Create condition and find application window Create condition and find control in window Get information about windows and controls Create pattern objects to perform actions Get information related to pattern objects Perform actions with pattern object methods Add a Sleep() statement if necessary Note that the UI element used in sample code is named after the selected element in the treeview. Also note that both the Sample code menu items and the sections in the Detail info listview page are placed in approximately the order they are used in a simple automation task. Sample code creation through Detail info listview page Sample code creation through Sample code main menu Supported applications Most browsers including Google Chrome To be able to spy on web content in Google Chrome it's necessary to enable accessibility by entering chrome://accessibility/ in the address bar of a new tab item, and then check the five check boxes that are located in a column in upper left corner down along the left edge. Then the accessibility tab can be closed again. It's a global setting that applies to all open and new tabs until Chrome is closed. Without accessibility enabled you are only able to investigate the outer elements of Chrome but not web content. Internet Explorer Microsoft Edge Mozilla Firefox Most Microsoft applications and applications developed with Microsoft software including Classic Windows applications based on the standard control library Modern Universal Windows Platform apps like the Windows 10 Calculator Programs implemented through .NET Framework eg. Windows Forms applications Most applications provided by major development companies Automation issues Automation issues How to topics If UI Automation or the UIASpy tool is new to you, then you should read the How to topics. Examples Examples that demonstrates the features of UIASpy: Automating Notepad. Very detailed example. Automating Notepad - Windows XP Examples about Sample code creation: Automating Notepad with Sample code - step by step Automating Notepad with Sample code - all at once Chrome - Clicking an extension. Compact summary example. Click Save As... issue in Notepad examples: Using Expand() instead of Invoke() Updates Windows 8, Windows 8.1 and Windows 10 updates Threads UI Automation UDFs contains all include files. In Using UI Automation Code in AutoIt you can find and download examples and read information about using UIA code. UI Automation Events is about implementing event handlers and includes GUIs to detect events. IUIAutomation MS framework automate chrome, FF, IE, .... created by junkew August 2013 is the first AutoIt thread on UIA code. Zip-file The zip contains source files for UIASpy GUI. Note that UI Automation UDFs must be installed in the Includes folder. You need AutoIt 3.3.12 or later. Tested on Windows XP, Windows 7 and Windows 10. Comments are welcome. Let me know if there are any issues. UIASpy.7z1 point
-
Hello all ! Here are some functions that I have created to manipulate multidimensionnal arrays. I think some of them can be useful. Some functions are limited to 32 dimensions. List of the functions : _ArrayAssign : Assigns an array variable by name with the data. _ArrayCompare : Checks if two array are identical (size or data) _ArrayDeclare : Creates an empty array with the specified size. _ArrayDeclareFromString : Creates an array from an array declaration type string. _ArrayEnumValues : Returns all values and indexes of an array in a 2D array. _ArrayEval : Returns the array from an array variable name, or the value of an array element by its name _ArrayShuffleMultiDim : Shuffle the whole data of an array. _ArrayToDeclarationString : Returns an array declaration string. The returned string can be used with _ArrayDeclareFromString. Some examples : _Example1() _Example2() _Example3() _Example4() _Example5() _Example6() _Example7() Func _Example1() Local $aArray1 = _ArrayDeclareFromString("[ [ 1, 2, 3], ['a', 'b', 'c'], [True, False, Null], [], [0x10, 1.3, -10.2E-3] ]") _ArrayDisplay($aArray1, "_ArrayDeclareFromString") EndFunc Func _Example2() Global $aArray2 = [[1,2,""], [4,5,6]] ; Must be a global variable _ArrayDisplay($aArray2, "Before _ArrayAssign") _ArrayAssign("aArray2[0][2]", 3) _ArrayDisplay($aArray2, "After _ArrayAssign") EndFunc Func _Example3() Local $aValues = [ [1,2,3], ['a', True, False] ] _ArrayAssign("aArray3", $aValues) Local $aRet = _ArrayEval("aArray3") _ArrayDisplay($aRet, "_ArrayEval") MsgBox(0, "", "Value for aArray3[1][0] : " & _ArrayEval("aArray3[1][0]") ) EndFunc Func _Example4() Local $aArray3 = [ [[ "000", "001", "002"], ["010", "011", "012"]] , [[ "100", "101", "102"], ["110", "111", "112"]] ] Local $aArray = _ArrayEnumValues($aArray3) _ArrayDisplay($aArray) EndFunc Func _Example5() Local $aArray4 = [ [1, 2, 3], [], ['A string', "That's so ""cool"" !"], [0x10, 1.3, -10.2E-3] ] Local $sDeclaration = _ArrayToDeclarationString($aArray4) MsgBox(0, "", $sDeclaration) EndFunc Func _Example6() Local $aArray5 = [ [[ "000", "001", "002"], ["010", "011", "012"]] , [[ "100", "101", "102"], ["110", "111", "112"]] ] Local $aBefore = _ArrayEnumValues($aArray5) _ArrayDisplay($aBefore, "Before shuffle") _ArrayShuffleMultiDim($aArray5) Local $aAfter = _ArrayEnumValues($aArray5) _ArrayDisplay($aAfter, "After shuffle") EndFunc Func _Example7() Local $aArray6 = [[1, 2], [3, 4]] Local $aArray7 = [["", 2], [3, 4]] Local $iRet = _ArrayCompare($aArray6, $aArray7) If $iRet Then MsgBox(0, "", "Arrays have exactly the same size") Else MsgBox(0, "", "Arrays do not have the same size and dimension.") EndIf $iRet = _ArrayCompare($aArray6, $aArray7, 1) If $iRet Then MsgBox(0, "", "Arrays have exactly the same size and values") Else MsgBox(0, "", "Arrays do not have the same size and values.") EndIf EndFunc ArrayMultiDim.au31 point
-
As the WebDriver UDF - Help & Support thread has grown too big, I started a new one. The prior thread can be found here.1 point
-
Automate Task in Background - (Moved)
plainly reacted to JLogan3o13 for a topic
No worries, @plainly, happens to the best of us1 point -
UIASpy - UI Automation Spy Tool
argumentum reacted to LarsJ for a topic
High resolution display I've multiplied left, top, right and bottom coordinates of the element rectangle with the DPI scale factor in DrawElemRect() near bottom of UIASpy_Detect.au3. Since I don't have a high resolution display I've not been able to test the code. But the rectangle is still drawn correct on my standard screen (DPI scale factor = 1). Danp2 (or other with a high resolution display) will you test the code and check if the red rectangle is drawn correctly? Replace the existing version of UIASpy_Detect.au3 with this version: UIASpy_Detect.au31 point -
Cannot create a Word Object: do I need to buy MS Word first?
FrancescoDiMuro reacted to water for a topic
The UDF automates MS Word by interacting with Word through COM. Hence: You need to install MS Word to use the Word UDF How did you get the impression that the Word UDF works with Wordpad?1 point -
I would automate the silent installation and not the installation via GUI. The installation guide describes how to do so.1 point
-
I've never tried this task myself, but this should get you started: https://stackoverflow.com/questions/38196048/how-to-get-the-name-of-the-current-tab-in-autoit-scite-script-editor1 point
-
Hi Paul, No, but as you've seen it may not work with older versions since the goal is to be compatible with the latest w3c standards. If you can, try your code with the latest FF and let me know the outcome. Dan1 point
-
Oracle SQL developer 18.2 automation - (Moved)
Earthshine reacted to Juvigy for a topic
You can create ODBC or Data connections without anything ,then you just need to open it in SQL Dev.1 point -
random numbers without repeating
FrancescoDiMuro reacted to jchd for a topic
This isn't the semantic of "pseudo-random" one can find in any mathematical source I know of. The term "pseudo-" is to be understood as opposed to "naturally-". For instance true random generators may be based on some radioelement decay, something which is physically proven random. Careful sampling of genuine white noise can be another "natural" source. In IT, "pseudo" refers to an algorithmic source, for instance the one used by AutoIt Random() function, because general-purpose computers have long been driven by determinism, something difficult to use to mimic the random characteristic of some physical phenomenoms. Uncommon requirements like those of the OP could possibly be coined "non-stuttering-biased pseudo random". Resulting sequences are an infinitely small subset of all truly random sequences build from the same digits set.1 point -
Please explain why you are running such an old version of Firefox. Also what version of the gecko driver are you using? Have you tried with current versions of both?1 point
-
lol ya. It is simply that I wanted to solve that enigma !1 point
-
The latest rendition of the UDF will (hopefully) always adhere to the latest W3C specs. You've got a couple of options -- Upgrade Chrome Switch to another supported browser Revert to an older version of the UDF that works with your browser version P.S. I wonder if you could use a portable version of Chrome on this workstation?1 point
-
Could RegExp be used here ?
IAMK reacted to pixelsearch for a topic
This Forum is definitely not a friendly place. I never asked anyone a single line of code in my life and was just curious to know if it was possible, is it so hard to understand ? So why the rude answer about "asking others to do your work for you?" My code above works perfectly and you telling me about "others to do work for me" ? Who do you think you are to answer in such a rude way ? I hope Mods will send you some gentle PM's asking you to cool off, because you're the one that should be educated.1 point -
WMI Application Installation Check Failing if Not Existing
Deito reacted to TheCrimsonCrusader for a topic
Greetings, I am using the below WMI code in AutoIt to check if the MS SQL Server 2008 R2 client is installed. If it is, I can get information such as the actual name or version to confirm it it exists, however, if it doesn't exist, it doesn't do anything and just exists. My goal is if it exists to bring up a message box saying it does, but if it doesn't, so then bring up a message box saying it doesn't exist. My problem is if it is installed, it will come back that it exists, however, if it is not, the else statement doesn't do anything and ignores the message box saying it doesn't exist. I assume this is happening since $objSoftware.Name isn't actually equal to anything since it is not installed and that breaks the check, but I wasn't sure how to get around this. I know I could check against specific registry entries instead, but I prefer to go the WMI route as that also allows me to use wildcards when doing the "Caption LIKE" check. Any ideas? #NoTrayIcon $strComputer = "." $objShell = ObjCreate("WScript.Shell") $objWMIService = ObjGet("winmgmts:{impersonationLevel=impersonate}!\\" & $strComputer & "\root\cimv2") $colSoftware = $objWMIService.ExecQuery ("Select * from Win32_Product where Caption LIKE '%Microsoft SQL Server 2008 R2 Native Client%'") For $objSoftware In $colSoftware $String = "Description: " & $objSoftware.Description & @LF & _ "IdentifyingNumber: " & $objSoftware.IdentifyingNumber & @LF & _ "InstallDate: " & $objSoftware.InstallDate & @LF & _ "InstallDate2: " & $objSoftware.InstallDate2 & @LF & _ "InstallLocation: " & $objSoftware.InstallLocation & @LF & _ "InstallState: " & $objSoftware.InstallState & @LF & _ "Name: " & $objSoftware.Name & @LF & _ "PackageCache: " & $objSoftware.PackageCache & @LF & _ "SKUNumber: " & $objSoftware.SKUNumber & @LF & _ "Vendor: " & $objSoftware.Vendor & @LF & _ "Version: " & $objSoftware.Version If $objSoftware.Name = "Microsoft SQL Server 2008 R2 Native Client" Then MsgBox(262144,"Application Status","It exists.") Exit Else MsgBox(262144,"Application Status","It does not exist.") EndIf Next1 point -
In case someone needs this... Example() Func Example() ConsoleWrite(StringIsNumber("42") & @CRLF) ConsoleWrite(StringIsNumber("3.14") & @CRLF) ConsoleWrite(StringIsNumber("99") & @CRLF) ConsoleWrite(StringIsNumber("99 Problems") & @CRLF) EndFunc ;==>Example Func StringIsNumber($sString) Return Int(StringIsDigit($sString) Or StringIsInt($sString) Or StringIsFloat($sString)) EndFunc ;==>StringIsNumber1 point
-
Edit: Scratch that, the script works. The color was simply not being found. Thanks Yashied and Melba. #include <WinAPI.au3> #Include <WinAPIEx.au3> #include <Array.au3> $window = "[CLASS:Notepad]" $handle = WinGetHandle($window) $aWinPos = WinGetPos($handle) $hDC = _WinAPI_GetWindowDC($handle) $hMemDC = _WinAPI_CreateCompatibleDC($hDC) $hBitmap = _WinAPI_CreateCompatibleBitmap($hDC, $aWinPos[2], $aWinPos[3]) _WinAPI_SelectObject($hMemDC, $hBitmap) _PrintWindow($handle, $hMemDC) $lookup = _PixelSearchEx($hBitmap, 0x00FFFF) _ArrayDisplay($lookup) _WinAPI_DeleteDC($hMemDC) _WinAPI_ReleaseDC($handle, $hDC) _WinAPI_DeleteObject($hBitmap) Func _PixelSearchEx($hBitmap, $iColor) Static $pProc = 0 If Not $pProc Then If @AutoItX64 Then ; Not implemented! Return SetError(1, 0, 0) Else $pProc = __Init(Binary( _ '0x5553575631C0505050837C24280074118B6C2428837D14007407B801000000EB' & _ '0231C021C0747F8B6C24288B5D084B891C2431C03B04247F6DC7442404000000' & _ '008B6C24288B5D044B3B5C24047C528B6C24288B5D148B7C24048B34248B6C24' & _ '280FAF750401F7C1E70201FB895C24088B6C24088B5D0081E3FFFFFF003B5C24' & _ '2475188B5C24048B6C24288B7D082B3C244FC1E71009FB89D8EB14FF44240471' & _ 'A0FF0C24718CB8FFFFFFFFEB0231C083C40C5E5F5B5DC21000')) EndIf EndIf Local $tDIB, $tInt, $tPos, $aPos, $Ret, $Error = True $hBitmap = _WinAPI_CopyBitmap($hBitmap) If @error Then Return SetError(1, 0, 0) EndIf Do $tDIB = DllStructCreate($tagDIBSECTION) If (Not _WinAPI_GetObject($hBitmap, DllStructGetSize($tDIB), DllStructGetPtr($tDIB))) Or (DllStructGetData($tDIB, 'bmBitsPixel') <> 32) Or (DllStructGetData($tDIB, 'biCompression')) Then ExitLoop EndIf $Ret = _WinAPI_CallWindowProc($pProc, 0, $iColor, DllStructGetPtr($tDIB), 0) If (@error) Or ($Ret = -1) Then ExitLoop EndIf $Error = False Until 1 _WinAPI_DeleteObject($hBitmap) If $Error Then Return SetError(1, 0, 0) EndIf $tInt = DllStructCreate('int') $tPos = DllStructCreate('ushort;ushort', DllStructGetPtr($tInt)) DllStructSetData($tInt, 1, $Ret) Dim $aPos[2] For $i = 0 To 1 $aPos[$i] = DllStructGetData($tPos, $i + 1) Next Return $aPos EndFunc ;==>_PixelSearchEx Func _PrintWindow($hWnd, $hMemDC, $iFlag = 0) $aRet = DllCall("User32.dll", "int", "PrintWindow", _ "hwnd", $hWnd, _ "hwnd", $hMemDC, _ "int", $iFlag) Return $aRet[0] EndFunc ;==>_PrintWindow1 point