Leaderboard
Popular Content
Showing content with the highest reputation on 12/16/2018 in all areas
-
Issues with float rounding pop up regularly in this forum, as well as in many others devoted to distinct programming languages. While the reasons for discrepancies observed by poster are correctly adressed here and there, practical advices are not always spot on the poster use case. Depending on the actual context, several rounding methods can be put to work. Here's a snippet offering the most useful. Be sure to read and understand the companion article for details: https://en.wikipedia.org/wiki/Rounding Rounding.au32 points
-
Control Viewer (mod.)
robertocm reacted to argumentum for a file
Version 0.2024.9.16
5,400 downloads
This is @Yashied's most excellent control viewer, modified by me, based on the code @boomingranny posted. There are 2 forum entries, one shows active and the other depreciated, and not seen @Yashied since March 2016, so I feel is OK to post this, tho, i'd take it down upon request. PS: Do run as Admin if available, as it may not do what you need without the rights.1 point -
Automate all windows and browser applications with one UDF function library. Based on the microsoft automation API this library high level supports Recognition of conttrols from EDGE, Chrome, FF, Opera, Safari and Windows native apps Small testing framework to split object repository from coding away Introduction Quickstart - Getting started quickly Simple scripts With this module you can automate all applications/programs that support ui automation and/or accesibility api from microsoft you can recognize more controls than AutoIT can recognize "out of the box" you can use concepts from other testing frameworks like http://download.freedesktop.org/ldtp/doc/ldtp-tutorial.pdf http://safsdev.sourceforge.net/Default.htm coded ui testing from microsoft Some of those controls / applications are chrome browser (partly mainwindow has to be done with MSAA for navigating) chrome://accessibility in the adress bar of chrome or start with "--force-renderer-accessibility" silverlight controls Ribbon control controlbars of Excel/Word IE and FF browsers Windows Media Player Windows clock AFX .. controls (partly) .... Based on the initial AIO Object I now have made the interface file to work with objCreateInterface function which is in the latest beta's automate clicking and querying basic information It gives you a lot of basic information to be able to automate clicking, querying basic information where it goes further in certain situations than AutoIt is identifying Starting threads for background on the ui automation api of microsoft (not for starters) http://en.wikipedia.org/wiki/Microsoft_UI_Automation http://msdn.microsoft.com/en-us/library/ms747327.aspx Previous threads in general help/support Interface AutoItObject IUIAutomation ObjCreateInterface and struct tagPoint in method ElementFromPoint Be aware that API is not allways installed under XP/Vista see http://support.microsoft.com/kb/971513 Within Windows 7 and Windows 8 it should be preinstalled by default. Be aware on 32 and 64 bits way of running your script #AutoIt3Wrapper_UseX64=Y or N Basic example of usage / showing and retrieving the default information, will post multiple examples later Hover your mouse to an area of interest and press ctrl+w and information will be shown in the edit box of the form Simple spy demo (see simplespy.au3 or use latest ZIP attachment for latest version) Main features Recognize windows and html controls for the major browsers Logical and physical description for controls (UI mapping, Application map) Simple repository logic to abstract logical and physical descriptions Store Runtime Type Information in RTI. variables Rubberbanding/highlighting of objects Simple spy to help in making / identifying the physical description Support of regular expression(s) in identifying objects recognize objects on multiple properties supported properties: name ,title, automationid, classname, class, iaccessiblevalue, iaccessiblechildId, controltype, processid, acceleratorkey The actions provided so far "leftclick", "left", "click", "leftdoubleclick", "leftdouble", "doubleclick", _ "rightclick", "right", "rightdoubleclick", "rightdouble", _ "middleclick", "middle", "middledoubleclick", "middledouble", "mousemove", "movemouse" "setvalue","settextvalue" "setvalue using keys" "setValue using clipboard" "getvalue" "sendkeys", "enterstring", "type", "typetext" "invoke" "focus", "setfocus", "activate" "close" "move","setposition" "resize" "minimize", "maximize", "normal", "close", "exist", "exists" "searchcontext", "context" "highlight" "getobject","object" "attach" "capture","screenshot", "takescreenshot" "dump", "dumpthemall" "propertyvalue", "property" match on multiple properties like: name:=((Zoeken.*)|(Find.*)); ControlType:=Button; acceleratorkey:=Ctrl+F Support for 117 different properties see $UIA_propertiesSupportedArray in uiawrappers like for example title, regexptitle, class, regexpclass, iaccessiblevalue, iaccessiblechildid, name, accesskey, automationid, classname IAccessible, IAccessible2, ISimpleDom interfaces debuglogging to a file log.txt (no output in scitewindow) Examples Example 1 Iterating thru the different ways of representing the objects in the tree (#comment-1105548) Example 2 Finding the taskbar and clicking on the start menu button (#comment-1105680) Example 3 Clicking a litlle more and in the end displaying all items from the clock (thats not directly possible with AU3Info) (#comment-1108849) Example 4 that demonstrates the calculator Example 5 Automating chrome Example 6 Demonstrates all stuff within chrome to navigate html pages, find hyperlink, click hyperlink, find picture, click picture, enter data in inputbox Example 7 The chrome example modified to a firefox example Example 8 The other major browser Internet Explorer automated (made on Example 6 and 7) Example 9 Windows media player Example 10 Automating mach 3 (AFX windows and other hard to get recognized by AutoIT) Lot of links are broken due to forum upgrade just search for the text like "Example 11 Demonstrate Word, Notepad and Calculator actions" Example 11 Demonstrate Word, Notepad and Calculator actions ... Example 13 Details 1 about the right pane of the windows explorer Example 14 Details 2 about the right pane of the windows explorer Example 15 Details 3 about the right pane of the windows explorer Example 16 Details 4 about the right pane of the windows explorer Example 17 Details 5 about the right pane of the windows explorer WITH CACHING Example 18 Details 6 about the right pane of the windows explorer WITH VIRTUAL ITEMS Example 19 Eventhandling examples Example 20 Eventhandling examples Example 21a Eventhandling examples Internet Explorer Example 21b Eventhandling examples Internet Explorer Example 22 Eventhandling examples Follow focus Example 23 Eventhandling examples structure changed Example 24 Eventhandling examples IUIAutomationEventHandler Example 25 SAFEARRAYS Example 26 IACCESSIBLE / MSAA Example 27 IACCESSIBLE2 / MSAA Example 28 IACCESSIBLE / MSAA events Example 29 IACCESSIBLE2 events Example 30 ISimpleDOM Example 31 Notepad window move, maximize, minimize Example 32 Three browsers doing the same stuff with small differences in scripting only .. TODO Build recorder Enhance the spy with a nicer UI UI for the repository (now in the script with dot notation) Enhance mapping / identifying on multiple properties instead of 1 combined with index If speed becomes an issue use the caching logic of the MS UIA framework Add the other patterns later Generalize the concept of System Under Test of starting the SUT (for testing framework purposes) Remote running of scripts Fix issue on finding within dynamic context ... edit august 18th 2013 initial post Only zip files are needed to download , just unzip in 1 directory edit july 2016 Made V0_63 and examples works with AutoIt v3.3.14 Windows 10 tested Simple spy gives some basic code as a present Chrome latest versions seems to be having issues with IUIAutomation on tabs/buttons of mainwindow use MSAA for accessing tabsheets / buttons more cleanup to be in UDF style More comments in the source see changelog.txt for previous changes edit september 2017 All examples fixed for the IE, Firefox and Chrome browser Some small but essential fixes in UIAWrappers edit april 2018 Enhanced logic on fallback / dynamic search, still not perfect, to slow Retested with latest Chrome, FF, Edge and IE11 and some extensions to show how to get text from the webpage (examples 5,6,7) Some small bugfixes Some comments as given in forum incorporated edit may 2019 Speed enhancements on especially fallback searching UIA.CFG works now in a better way to turn on/off debug, highlighting, debug2file More stable and consistent behavior Internal cleanup and refactoring of bigger functions Checked with W10 (not tested on W7) Added some W10 properties Run with 3.3.14.5 on W10 UIA_V0_51.zip EXAMPLES_V0_5.zip UIA_V0_63.zip EXAMPLES_V0_63.zip UIA_V0_64.zip EXAMPLES_V0_64.zip EXAMPLES_V0_66.zip UIA_V0_66.zip EXAMPLES_V0_70.zip UIA_V0_70.zip1 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
-
1 point
-
Set $vars in main script that are used in include UDF?
GoogleDude reacted to Nine for a topic
Good programming practices require that #include should be self-sufficient. If you need to have some global vars declared for your include to work properly (and they should be at the very minimum), you should declare them directly in the include, not in the calling script. Information between the main script and the include script should always be passed thru function parameters.1 point -
Question 1 "Copy structure to clipboard" does not calculate the element subtree. The procedure to copy the entire subtree structure to clipboard is (right click the treeview item): 1. Update all childs of element 2. Copy structure to clipboard Question 2 I rarely use the XML format. Usually you can do the same with a plain text file, and with much faster code. But if you'll write the code and it's not too slow, I'll add it to the zip-file in first post. Question 3 GitHub. No. Question 4 Show structure in listview. This is intentional. 1. It takes some time to calculate the structure of a subtree with 1000 elements or more. The calculation is complete when the structure appears in the listview. 2. Perhaps you only need a single or a few rows in the structure. You can select these rows in the listview and use "Copy all or selected items to clipboard" in the "Right pane" main menu to copy only those few rows. Question 6 A Search feature is planned for the next version. Question 7 Use the function keys to handle a menu. Here's an example with Notepad File menu: Run UIASpy.au3. Open Notepad. Click File menu. Place mouse cursor over first menu item. Press F1. Press F2. Switch to UIASpy. It should look like this: Left: F1, Middle: F2, Right: Treeview (red items because the corresponding UI elements doesn't exist, the menu is closed) Question 5 Move example to "Projects and collaboration" forum. I think such an example is too small for "Projects and collaboration". But a more general topic, eg. "UI Automation Updates" might be interesting to start up under "Projects and collaboration". This can include a discussion of a spy tool. First of all, an update of the code in CUIAutomation2.au3 (constants and definitions) is required. CUIAutomation2.au3 contains Windows 7 code. To support Windows 8 and Windows 10 probably 50 - 100 new interfaces, methods, properties and constants are added which are not included in CUIAutomation2.au3. An UI Automation thread in "Projects and collaboration" can certainly be interesting.1 point
-
ListView : Right click on column header
pixelsearch reacted to FrancescoDiMuro for a topic
@pixelsearch Or just "spy" it using AutoItWindowInfoTool You'll notice that the ListView handle and the ListView header handle are different.1 point -
ListView : Right click on column header
pixelsearch reacted to Melba23 for a topic
pixelsearch, Because the header is a separate control from the ListView itself - just as a button is separate from the GUI which contains it. The _GUICtrlListView_GetHeader function will get you the header handle if required. The same thing is true for combo controls, where the combo, input and dropdown list are all separate controls - look at the example for _GUICtrlComboBox_GetComboBoxInfo to see this illustrated. M231 point -
Set $vars in main script that are used in include UDF?
GoogleDude reacted to Melba23 for a topic
GoogleDude, It sounds to me as if you need to recast your entire "main/include" philosophy! But to deal with the immediate problem: the code of any include file is inserted into the main script at the point of the #include directive, so if you declare the Global variables before that point they should be visible within your includes. M231 point -
That was one of the the tiny script breaking changes introduced with one of the latest new versions.1 point
-
Should be doable with either IUIAutomation or Webdriver. See my sig for the 2nd one. ;-)1 point
-
Get Desktop Shortcut Position and Set ToolTip?
GoogleDude reacted to Bilgus for a topic
maybe this will help.. and perhaps this..1 point -
Thats one of the issues you will get when using array within an array you would need to first use a variable to create a sub-array, you will also note that your $maxSteps is out of bounds. Personally I would use 2d method like my example above otherwise it becomes difficult to follow when you writing it into 1d Array. #include <Array.au3> Local $stepMessage[1] = ["NULL"] ;This will become a dynamically filled array. Local $maxSteps = 1 ;Make this 2 if "Next Step" is required. Local $step = 1 ;This will be incremented when a step is passed or failed. Local $function[1] ;This will be a dynamically filled 2d array [$step, $functionName]. Local $functionCount = 1 ;How many automated function calls will be done. ;Default = 1 (because $function already has 1 element Local $functionsCalled = 1 ;How many functions have been called (used for tracking what the next function is). ;Default = 1 (because $function already has 1 element writeStep("a", '"Hello" & @CRLF & "There!"') writeStep("m", '"Hello I AM BOB"', "tempTest()") writeStep("ma", '"Hello" & @CRLF & @CRLF & "K"') writeStep("x", '"This is unspecified..."', "tempTest()") Func writeStep($executionType, $message, $functionName = "NULL") _ArrayAdd($stepMessage, getExecutionType($executionType) & '& "Step: " & $step & "/" & ($maxSteps - 1) & @CRLF & @CRLF & $message') If($functionName <> "NULL") Then ;If a function name has been provided to be run. Local $tempArray[2] = [$maxSteps, $functionName] _ArrayAdd($function, $tempArray, 0, "|", @CRLF, 1) ;Add the function to the array with the step it needs to be executed on. $maxSteps += 1 EndIf EndFunc Func getExecutionType($executionType) If($executionType = "m") Then Return '"<Manual>" & @TAB & @TAB ' ElseIf($executionType = "a") Then $functionCount = $functionCount + 1 Return '"<Auto>" & @TAB & @TAB & @TAB ' ElseIf($executionType = "ma") Then $functionCount = $functionCount + 1 Return '"<Manual/Auto>" & @TAB ' Else Return '"<Unspecified>" & @TAB ' EndIf EndFunc Func tempTest() MsgBox(0, "TEST", "I AM tempTest()") EndFunc MsgBox(4096, "Array Info", "$function count = " & UBound($function) & @CRLF & "$maxSteps = " & $maxSteps) While($step < $maxSteps) MsgBox(0, "TEST", "HELLO1") If($functionCount > 1) Then ;Error will be thrown if no functions were added, hence this If was added. MsgBox(0, "TEST", "HELLO2") If IsArray($function[$step]) Then $aSubArray = $function[$step] _ArrayDisplay($aSubArray) If($step = $aSubArray[0]) Then MsgBox(0, "TEST", "HELLO3") Execute($aSubArray[1]) MsgBox(0, "TEST", "HELLO4") $functionsCalled = $functionsCalled + 1 EndIf EndIf EndIf MsgBox(0, "TEST", "HELLO5") $step += 1 WEnd1 point
-
How do I implement a dynamic 2d array?
t0nZ reacted to pixelsearch for a topic
Hi IAMK, I just had a quick look at your script : you got errors because your 2D Array can't be declared like this, in fact you declared a 1D array : Local $function[1] ;This will be a dynamically filled 2d array [$step, $functionName] If you want an empty 2D array, with 2 columns, then you need to declare it like this : Local $function[0][2] ; 0 row, 2 columns Or if you don't feel comfortable with the "0 row", like that : Local $function[1][2] ; 1 row, 2 columns => [[$step], [$functionName]] Then later, when you populate it, you can do it in a simple way : ; Instead of : ; Local $tempArray[2] = [$maxSteps, $functionName] ; _ArrayAdd($function, $tempArray, 0, "|", @CRLF, 1) ;Add the function to the array with the step it needs to be executed on. ; Try : _ArrayAdd($function, $maxSteps & "|" & $functionName) Also it's a good idea to place an _ArrayDisplay after each _ArrayAdd during the development phase : it shows you immediately if something is going wrong Good luck1 point -
Thanks for the suggestion and I will look at it, but you do know you can make the change already for yourself by adding the following line to SciTEUser.properties (SciTE menu / Options / Open User Options File) : command.shortcut.6.$(au3)=Ctrl+Shift+F6 jos1 point
-
Run Excel Macro
AnonymousX reacted to JoHanatCent for a topic
If you use the following you do not have to build a sleep in: #include <Excel.au3> and to open use $oExcel = _ExcelBookOpen($file, 1) $oExcel.run("mymacro1");<<<< == Your Macro to run1 point -
Try this: #include <IE.au3> $oIE = _IEAttach("IE Get an attribute") $oLinks = _IELinkGetCollection($oIE) For $oLink in $oLinks ConsoleWrite($oLink.getAttributeNode('onclick').NodeValue & @CRLF) Next Dale1 point