Leaderboard
Popular Content
Showing content with the highest reputation on 04/11/2016 in all areas
-
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
-
extract a word from URL
alien4u reacted to InunoTaishou for a topic
Global $sUrl = 'http://www.domain.com/mytopfolder/various-possible-words/Silk-By-James' Global $sExtractName = StringTrimLeft($sUrl, StringInStr($sUrl, "/", 0, -1)) ConsoleWrite("Extracted title: " & $sExtractName & @CRLF) ; Either of these only extract the first word ; StringLeft ; ConsoleWrite("Extracted first word: " & StringLeft($sExtractName, StringInStr($sExtractName, "-") -1) & @CRLF) ; StringRegExpReplace. Will work with [:space:] and [-]. ConsoleWrite("Extracted first word: " & StringRegExpReplace($sExtractName, "[\ \-].*", "") & @CRLF)1 point -
Sending Email
Balmukundam reacted to Jos for a topic
Why is $ssl set to 0? Doubt that will ever work with Gmail. Also remove the " MsgBox(0,"near","5")" line as that wil invalidate the test for an successful send. Jos1 point -
Computer Info UDF's
RestrictedUser reacted to JSThePatriot for a topic
When I first visit a new client, I take inventory of their machines, what is on them, stats, and other useful information. Up till now I would either write the information down, or just try to remember it myself. Then I decided why not write a script that would allow me to gather all this useful information, and put it in a format that I can understand and possibly print. I created that program (its even listed in this thread). I then expounded on my ideas, and have created this great Computer Information Library. Feel free to use it as you see fit, but please credit when you use one of my functions. Keywords: CompInfo, CompInfo.au3, Library, Computer, Computers, Info, Information, WMI, Windows Management Instrumentation Requires: AutoIt v3.2 + or AutoIt Beta v3.2.1.2+ Software UDFs _ComputerGetStartup _ComputerGetSoftware _ComputerGetUsers _ComputerGetGroups _ComputerGetServices _ComputerGetThreads _ComputerGetProcesses _ComputerGetOSs _ComputerGetShares _ComputerGetEventLogs _ComputerGetBootConfig _ComputerGetExtensions _ComputerGetDesktops _ComputerGetDependentServices _ComputerGetPrintJobs _ComputerGetLoggedOnUsers Hardware UDFs _ComputerGetDrives _ComputerGetPrinters _ComputerGetProcessors _ComputerGetBIOS _ComputerGetSoundCards _ComputerGetVideoCards _ComputerGetKeyboard _ComputerGetMouse _ComputerGetSystemProduct _ComputerGetNetworkCards _ComputerGetSystem _ComputerGetMonitors _ComputerGetMotherboard _ComputerGetBattery _ComputerGetMemory I have finally created an include file with the above listed UDF's. I will be continually adding to this file. Include File: CompInfo.au3 | 1671 Previous Downloads (Total) Example File: CompInfoExamples.au3 | 929 Previous Downloads (Total) I have listed special thanks in the include file. Please note all example code will now start with #include "CompInfo.au3". I am working on adding error checking and standardizing the code. (Note: I haven't spent much time doing this as of late) NerdFencer has created a set of Drive UDF's that were inspired from this code. If you need more drive information please see his thread. ?do=embed' frameborder='0' data-embedContent> Edit 01: Added _ComputerGetPrinters Edit 02: Added _ComputerGetCPUs Edit 03: Changed _DriveGetInfo to _ComputerGetDrives Edit 04: Updated _ComputerGetDrives with documentation and error checking. Edit 05: Fixed _ComputerGetUsers @ComputerName wasnt being used properly. Edit 06: Added _ComputerGetGroups Edit 07: Updated _ComputerGet Printers/Groups with documentation and error checking. Edit 08: Changed _ComputerGetUsers to include more information. Updated _ComputerGetUsers with documentation and error checking. Edit 09: Changed _ComputerGetStartup to include more information. Updated _ComputerGetStartup with documentation and error checking. Edit 10: Added _ComputerGetServices Edit 11: Added to the top of the post about requiring AutoIt's Beta version. Edit 12: Added _ComputerGetBIOS Edit 13: Added _ComputerGetThreads Edit 14: Changed _ComputerGetCPUs to _ComputerGetProcessors and included more information. Edit 15: Added _ComputerGetProcesses Edit 16: Changed _ComputerGetPrinters to include more information and documentation. Edit 17: Added an Example file containing all 11 current UDF's in one simple file. Edit 18: Added _ComputerGetOSs, _ComputerGetShares, _ComputerGetEventLogs Edit 19: Added to the top about no longer requiring a Beta version to work correctly. Requires v3.2 + Edit 20: Added _ComputerGetSoundCards, _ComputerGetVideoCards Updated _ComputerGetGroups (moved "Description" to element 4 to match the rest of the library). Updated Processes, OSs, Processors, Services, Software, Threads, Printers, BIOS, and EventLogs to have the same header layout. Alphabetized CompInfo.au3 and CompInfoExamples.au3 Edit 21: Updated _ComputerGetOSs (Bug Fix) in CompInfoExamples.au3 (Thanks Koala) Edit 22: Added _ComputerGetKeyboard, _ComputerGetMouse Edit 23: Added _ComputerGetSystemProduct, _ComputerGetBootConfig Updated Spelling errors and misc items in CompInfoExamples.au3 Edit 24: Added _ComputerGetNetworkCards Edit 25: Added _ComputerGetExtensions, and _ComputerGetSystem Edit 26: Added _ComputerGetDesktops, _ComputerGetDependentServices, _ComputerGetPrintJobs, _ComputerGetBattery, _ComputerGetMotherboard, and _ComputerGetMonitor Edit 27: Added _ComputerGetMemory, and _ComputerGetLoggedOnUsers Edit 28: Updated CompInfo Version Information Error Edit 29: Linked ?do=embed' frameborder='0' data-embedContent> Thanks, JS1 point -
How do I save the copied text into a new file?
cherrylatte reacted to mikell for a topic
WinActivate, F6, Ctrl+C, ClipGet, FileWrite, and be happy1 point -
Translucent Line that Follow Mouse
guiltyking reacted to UEZ for a topic
Not much harder than Screen Ruler Underline: #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Global Const $aFullScreen = WinGetPos(WinGetHandle("[TITLE:Program Manager;CLASS:Progman]")) Global $iSpaceBetween = 150 Global Const $hGUI_Top = GUICreate("Coloured Reading Ruler for free", $aFullScreen[2], $aFullScreen[3], $aFullScreen[0], (-$aFullScreen[3] - $iSpaceBetween) / 2, $WS_POPUP, BitOR($WS_EX_TOPMOST, $WS_EX_TRANSPARENT)) Global Const $hGUI_Buttom = GUICreate("", $aFullScreen[2], $aFullScreen[3], $aFullScreen[0], ($aFullScreen[3] + $iSpaceBetween) / 2, $WS_POPUP, BitOR($WS_EX_TOPMOST, $WS_EX_TRANSPARENT), $hGUI_Top) GUISetBkColor(0x000000, $hGUI_Top) GUISetBkColor(0x000000, $hGUI_Buttom) WinSetTrans($hGUI_Top, "", 0x80) WinSetTrans($hGUI_Buttom, "", 0x80) GUISetState(@SW_SHOW, $hGUI_Top) GUISetState(@SW_SHOW, $hGUI_Buttom) HotKeySet("{ESC}", "_Exit") Do WinMove($hGUI_Top, "", $aFullScreen[0], MouseGetPos(1) - $aFullScreen[3] - $iSpaceBetween / 2) WinMove($hGUI_Buttom, "", $aFullScreen[0], MouseGetPos(1) + $iSpaceBetween / 2) Until Not Sleep(50) Func _Exit() GUIDelete($hGUI_Buttom) GUIDelete($hGUI_Top) Exit EndFunc1 point -
Melba, Your code doesn't allow 0.25 Here is some regex fun ; https://www.autoitscript.com/forum/topic/170558-guictrlcreateinput-to-accept-only-formattted-numbers/ #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <EditConstants.au3> Opt("GUIOnEventMode", 1) $hGUI = GUICreate("Currency Decimal Separator", 232, 90) $Label = GUICtrlCreateLabel("Enter some numbers", 22, 8, 163, 17) $input = GUICtrlCreateInput("", 22, 30, 165, 24) GUICtrlSetLimit(-1, 19) GUICtrlSetFont(-1, 12) GUISetState() GUIRegisterMsg($WM_COMMAND, '_WM_COMMAND') GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit") While Sleep(1000) WEnd Func _Exit() GUIDelete() Exit EndFunc Func _WM_COMMAND($hWnd, $Msg, $wParam, $lParam) Local $id = BitAND($wParam, 0x0000FFFF) Local $code = BitShift($wParam, 16) If $id = $input AND $code = $EN_UPDATE Then GUICtrlSetData($input, _FormatInputNumber(GUICtrlRead($input))) EndIf Return $GUI_RUNDEFMSG EndFunc Func _FormatInputNumber($iNumber, $sSep = ",", $sDec = ".", $iDecPlace = 2) $iNumber = StringRegExpReplace(StringRegExpReplace(StringRegExpReplace($iNumber, "[^0-9" & $sDec & "-]", ""), '(?<!^)-|(^-?0)\K0|^-?\K0(?=[^0' & $sSep & '])', ""), '^(-?)\Q' & $sDec & '\E', "${1}0" & $sDec) Local $s = StringSplit(StringReplace($iNumber, $sSep, ""), $sDec) Return StringRegExpReplace($s[1], '(?<=\d)(?=(\d{3})+$)', $sSep) & (($s[0] = 1) ? "" : $sDec & StringLeft($s[2], $iDecPlace)) EndFunc Easily adaptable for european number format It handles leading minus and ALL decimals - theorically Edit Damn I didn't pay attention to the date of this topic...1 point
-
Draw a circle around the mouse
guiltyking reacted to martin for a topic
This does what I think you want #include <GUIConstants.au3> #include <WindowsConstants.au3> Global Const $pi = 3.14159265358979 HotKeySet("{ESC}", "_Bye") $iCircleR = 20; <=== Edit this for different circle radius (in pixels) $iCircleD = $iCircleR * 2 Global $radius = 100;radius of movement of the blob mouse cursor to centre of circle blob Global $angle = 0 Global $incr = 3 $pt = MouseGetPos() $GUI = GUICreate("test", $iCircleD, $iCircleD, $pt[0] - $iCircleR, $pt[1] - $iCircleR, $WS_POPUP, $WS_EX_TOPMOST) GUISetBkColor(0xFF0000) $a = _CreateRoundRectRgn(0, 0, $iCircleD, $iCircleD, $iCircleD, $iCircleD) Remove comments on next to lines to have the cirle instead of a disc ;$b = _CreateRoundRectRgn(4, 4, ($iCircleD - 8), ($iCircleD - 8), ($iCircleD - 4), ($iCircleD - 4)) ;_CombineRgn($a, $b) _SetWindowRgn($GUI, $a) GUISetState() GUISetState(@SW_DISABLE) adlibenable("setangle",20) While 1 Sleep(10) $pt = MouseGetPos() If Not @error Then MoveBlob($pt) WEnd Func _CreateRoundRectRgn($l, $t, $w, $h, $e1, $e2) $ret = DllCall("gdi32.dll", "long", "CreateRoundRectRgn", "long", $l, "long", $t, "long", $l + $w, "long", $t + $h, "long", $e1, "long", $e2) Return $ret[0] EndFunc ;==>_CreateRoundRectRgn Func _CombineRgn(ByRef $rgn1, ByRef $rgn2) DllCall("gdi32.dll", "long", "CombineRgn", "long", $rgn1, "long", $rgn1, "long", $rgn2, "int", 3) EndFunc ;==>_CombineRgn Func _SetWindowRgn($h_win, $rgn) DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $h_win, "long", $rgn, "int", 1) EndFunc ;==>_SetWindowRgn Func _bye() Exit EndFunc ;==>_bye Func Setangle() $angle = Mod($angle + $Incr,360);degrees EndFunc Func MoveBlob($mousePos) $radAng = $angle * $pi/180 Local $x = $mousepos[0] + $radius * Cos($radAng) - $iCircleR Local $y = $mousepos[1] + $radius * Sin($radAng) - $iCircleR WinMove($GUI, "", $x,$y) EndFunc With a bit of pratice you can get the blob to stay in one place while you move the mouse in a circle. (Why do I waste my time trying to do things like that?)1 point