Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 11/11/2018 in all areas

  1. Jos

    AWC String Converter

    @AWC, Welcome. Honestly, everybody with a sane mind will not simply run a posted compiled script. Why not simply post your source in case you want to share or have questions? Jos
    2 points
  2. As I was too limited by what was feasible with PixelSearch in Autoit, I wrote an optimized DLL in C++ for searching pixels on the screen. The most basic function allows you to find the pixel in a given color - as PixelSearch - but instead of returning the first found, it returns the closest to a given point. It can go much further: - Search for 'spot' the closest (NxN square containing P pixels that meet the criteria of color mentioned) - Maintains a list containing up to 1024 colors (search pixels with one color in this list) - Manages up to 1024 exclusion rectangles. We can define precisely the search pattern that you want (with a rectangle from which you "substract" several "exclusion rectangles"). You can have up to 1024 exclusion rectangles. - You can also set a 'shade variation' (same idea as with PixelSearch). - Can work on several 'snapshots' (screen captures) in memory. It is possible to retain up to 1024 snapshots simultaneously (of course, each capture consumes memory, so only use the "slots" you really need). - Works on full screen or specific window (HWND optionnal parameter) or part of it. - Also includes functions to identify the changes between two SnapShots (minimum rectangle containing all changes + number of pixels that have changed). Useful to detect movement on the screen, object state changes... - Fairly sophisticated tools provided for debugging are also included in the UDF. You can choose the type of logs you want, including the ability to view on screen the detected areas (most useful during development phasis) and record the transaction details in a log file. - For even more performance, you can capture the content of a screen memory (SnapShot, takes about the same time as or PixelSearch PixelGetColor) then do all the research you want in this snapshots (very fast functions : nearly 1000 times as fast as the native PixelGetColor). - [v1.4] : find the "best spot" - meaning the spot that has the best number of "right" colors. - [v1.4] : now provided with a tool, FFShowPixels.exe, to find colors, manage color lists, show all occurences of them on the Captured Window, and... automatically generates AutoIt or C++ code. - [v1.6] : Saves SnapShots on BitMaps (BMP and JPG supported) - [v1.6] : Modifies SnapShots with "filters" (Keep only some colors or only pixels that have changes. All other pixels can be turned to black). - [v1.7] : Can change pixels colors on SnapShots (SetPixel) - [v1.7] : Can access the Raw pixel data of SnapShots (GetRawData) - [v1.7] : Can draw back SnapShots on Screen. - [v1.8] : Bug fixes. Deleted - [v1.8.1] : Bug fixes (FastFind.au3). - [v1.8.2] : Bug fixes (FastFind.au3). - [v1.8.3] : Bug fixes (FastFind.au3). Deleted - [v1.8.4] : Should now run on early XP and Windows 2000 OS. - [v2.0] : Documentation file in english (FastFind.chm), several new functions and new feature on some old functions. - [v2.1] : Bug fixes (removed those nasty errors in message boxes) - [v2.2] : Bug fix Included in the archive: both the 32 bits and 64 bits dll (written in Visual C++ 2010), the AutoIt Wrapper, a demonstration script and a tiny Benchmark script. Here it is, your comments and suggestions are welcome. [updates/Changelog] Last Version : 2.2 FastFind 2_2.zip Version 2.2 Bug fixes FastFind 2_2.zip Version 2.1 Bug fixes FastFind 2_1.zip Version 2.0 A new documentation file, in chm format (thanks to CeramicWeasel) New functions : DrawSnapShotXY (same as DrawSnapShot, with specific top-left position for drawing). ComputeMeanValues (Gives mean Red, Green and Blue values of a SnapShot) ApplyFilterOnSnapShot (apply a AND filter on each pixels in the SnapShot) FFGetRawData (provide access to all pixel data) ShadeVariation parameter added in the following functions : KeepChanges LocalizeChanges HasChanged FastFind 2_0.zip jan 5 2012: ShowPixel Link should work now ?do=embed' frameborder='0' data-embedContent> Version 1.8 -> bug fixes Updates : FastFind 1_8_4.zip Version 1.7 -> bug fix with client coordinates -> Can change pixels colors on SnapShots (SetPixel) -> Can access the Raw pixel data of SnapShots (GetRawData). Not that this feature is not allready wrapped into autoit: you have to do it with dllcall. -> Can draw back SnapShots on Screen (DrawSnapShot). -> New function to duplicate a SnapShot (DuplicateSnapShot) FastFind 1_7.zip FFShowPixels + FastFind complete 1.7 package : ?do=embed' frameborder='0' data-embedContent> Version 1.6 -> bug fix (restriction rectangles + FFColorCount) -> New functions to export captures into BMP or JPEG Files -> New functions to create SnapShots with changes or selected colors from a previous SnapShot(FFKeepChanges & FFKeepColors). FFShowPixels1_6 wo FFShowPixels.zip Version 1.5 -> FFGetPixel bug fix. FastFind1_5.zip (Update) Version 1.4 -> A new optional parameter in SetHWnd : You can now choose to take either the full Window or only the Client area of the window. -> Several bug fixes (more reliable and consistent) -> A new search fonction : FFBestSpot. It will find the spot that contains the most "good" pixels. -> A new tool - ShowPixels.exe - will allow you to easily manage list of colors (find them on the screen, make stats...) and automatically generate AutoIt or C++ code from them. Unfortunately, the zip is too big to include ShowPixel.exe in it. So if you want this tool, just ask with pm or mail. (Update) Version 1.3 -> comments in demo scripts now in english -> Some minor bug fixed -> now both 32 bits and 64 bits dll are provided -> Several function calls are now more simple to use : the x1,y1,x2,y2 limits of the area for search functions are now optional. Default values means full window (or screen)) ** Warning ** I've changed the order of the parameters in some fonctions, to make them easier to use. So if you use any of the 3 following function, you will need to reorder the parameters if you want to update to the version 1.3 of FastFind. Func FFNearestPixel($PosX, $PosY, $Color, $Left=0, $Top=0, $Right=0, $Bottom=0, $ForceNewSnap=true, $NoSnapShot=$FFLastSnap, $WindowHandle=-1) Func FFNearestSpot($SizeSearch, $NbPixel, $PosX, $PosY, $Color, $ShadeVariation=0, $Left=0, $Top=0, $Right=0, $Bottom=0, $ForceNewSnap=true, $NoSnapShot=$FFLastSnap, $WindowHandle=-1) Func FFColorCount($ColorToCount, $ShadeVariation=0, $Left=0, $Top=0, $Right=0, $Bottom=0, $ForceNewSnap=true, $NoSnapShot=$FFLastSnap, $WindowHandle=-1) (Update) Version 1.2 I hope these library will prove useful. Please tell me how you use it and how you like it. FF
    1 point
  3. 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
  4. AWC

    AWC String Converter

    AWC String Converter is a text convert tool that help normal text or text file in to compaatible AutoIt String. AWC AutoIt Stringer.Exe
    1 point
  5. Jos

    Problem with ControlClick

    ok.. done being played with. *click* and do not open another thread on this or any other related topic.
    1 point
  6. No, can't be the answer, so try again please? _________________________________________________________________ MsgBox($MB_SYSTEMMODAL, "The answer is : ", " No ")
    1 point
  7. Jos

    Problem with ControlClick

    No, can't be the answer, so try again please?
    1 point
  8. Meaning what exactly? ___________________________ No ,
    1 point
  9. Jos

    Problem with ControlClick

    Meaning what exactly?
    1 point
  10. Not your bro, I hate that term. You might want to read the help file for ControlClick, if they're the same coordinates used in your MouseClick statement above, then they are not coordinates inside the bounds of the control, they might be the coordinates where the control is located, but they aren't the same thing as I stated above.
    1 point
  11. Are the coordinates $x1 and $y1 within the bounds of the control? It's rare that you would ever need to use the x and y coordinates if you're clicking a control. MouseClick coordinates and ControlClick coordinates are completely different things, read the help file.
    1 point
  12. That site is odd because it's using a custom radio button, but here's two ways to select the radio buttons -- #include "wd_core.au3" #include "wd_helper.au3" Local $sDesiredCapabilities Local $iIndex Local $sSession $_WD_DEBUG = $_WD_DEBUG_Info SetupChrome() _WD_Startup() $sSession = _WD_CreateSession($sDesiredCapabilities) _WD_Navigate($sSession, "https://www.w3schools.com/howto/tryit.asp?filename=tryhow_css_custom_radio") ConsoleWrite("Frames=" & _WD_GetFrameCount($sSession) & @CRLF) $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//iframe[@id='iframeResult']") _WD_FrameEnter($sSession, $sElement) ; Method 1 $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//label[3]/input") _WD_ElementAction($sSession, $sElement, 'click') Sleep(3000) ; Method 2 $aElements = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//input", "", True) ;_ArrayDisplay($aElements) _WD_ElementAction($sSession, $aElements[0], 'click') Sleep(3000) _WD_FrameLeave($sSession) _WD_DeleteSession($sSession) _WD_Shutdown() Func SetupChrome() _WD_Option('Driver', 'chromedriver.exe') _WD_Option('Port', 9515) _WD_Option('DriverParams', '--log-path="' & @ScriptDir & '\chrome.log"') $sDesiredCapabilities = '{"capabilities": {"alwaysMatch": {"chromeOptions": {"w3c": true }}}}' EndFunc ;==>SetupChrome
    1 point
  13. Trong

    AWC String Converter

    quotes String quotes I do not know what application to use to do, but I think it is a sample script for GUI! But forgot to post the script. 🥴
    1 point
  14. careca

    AWC String Converter

    Hey mate, this is GUI help and support, did you mean to post in example scripts?
    1 point
  15. Simple solution:         .Send($req[$num][0])         Sleep(Random(100,200))      If .Status <> '200' Then ContinueLoop ; --> added         If @error Or StringLen(.ResponseText) < 500 Then ContinueLoop            ; The error come up here! Advanced solution: $objErr = ObjEvent("AutoIt.Error","MyErrFunc") Func MyErrFunc()     SetError(1) EndFunc ... .Send(...) If @error Then ContinueLoop
    1 point
  16. Ok guys ...stay out please as it is made clear I am waiting for an answer. @mrtgtr, You will require to answer me now as I know you have read my post. You get 10 minutes or else will be unable to post until you do (via PM after you failed to provide the answer in time) Jos
    1 point
  17. puts ouija board on the table, and starts to probe the depth of the ether above for your answers. describe what you want done in more details, and even better the (item) program you want to automate. Better yet, reported. (duplicate thread)
    1 point
  18. because it only defines one cell and you declare 2 cells $aAccelKeys[1][2] = ... should work
    1 point
  19. That site uses iframes, so you'll need to switch to the correct frame before you can locate the element with WD_FindElement. This can be done with _WD_Window or the helper function _WD_FrameEnter. Check out the DemoFrames function in wd_demo.au3 for an example of using these functions.
    1 point
  20. New version: 2018/11/08 v3.1 * Added: colors for each Edit control - used GUICtrlSetBkColor() - mLipok * Added: FullScreen option (Checkbox + INI + Remarks in Tip) - mLipok * Added: _IsChecked() - mLipok * Changed: WinMove() - change size of window using: WindowWidth and WindowHeight - mLipok Download location: Screenshot:
    1 point
  21. This gives your script the ability to move or re-size the controls on your GUI at run-time. You need to add to your script"- 1/ #include "CtrlResizeMove.au3" ; with the CtrlResizeMove.au3 file in the same directory as your script, and, 2/ _CtrlResizeMove() ; add to within loop of your script. To operate run your script with the above two additions. Then:- :Hold down Ctrl key and drag control with left mouse button. This moves the control; :Hold down Alt key and drag control with left mouse button. This resizes the control; or, ; Press Ctrl + S to save the new control layout to a backup au3 file. Beware For the "save to backup" to work correctly, the controls needs to be created in the following format:- [$controlID = ]GUICtrlCreateNAME("text", int, int, int, int[,styles, etc.]) Where, [...] = optional. Also each "text" parameter needs to be unique. If SciTE is not default handler for opening au3 files, then you may need to delete or comment out the line #76, ShellExecute($scriptPathNew). Other things. Labels would not activate. So "get control classnameNN by position" had to be used. Thanks SmOke_N. The include file script uses the active window to select the controls to maniputate. So, for something different, when the example is running, open up the help file window. You can rearrange and re-size the controls in the help window - its not permanent. CtrlResizeMoveExample.au3 ; #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <EditConstants.au3> #include <StaticConstants.au3> #include "CtrlResizeMove.au3"; < ===== Inserted here (Remove when finished) ======== ;Opt('MustDeclareVars', 1) Example() Func Example() Local $Button_1, $Button_2, $msg, $aCPos, $checkCN1, $checkCN2, $myedit, $Label1 GUICreate("Hold down Ctrl or Alt & Drag control / Ctrl+S Save") $Button_1 = GUICtrlCreateButton("ControlMove", 10, 14, 100, 30) $Button_2 = GUICtrlCreateButton("Button Test", 118, 14, 100, 30) $checkCN1 = GUICtrlCreateCheckbox("CHECKBOX 1", 12, 49, 98, 19) $checkCN2 = GUICtrlCreateCheckbox("CHECKBOX 2", 120, 49, 98, 19) $myedit = GUICtrlCreateEdit("First line" & @CRLF, 10, 73, 211, 54, $ES_AUTOVSCROLL + $WS_VSCROLL) $Label1 = GUICtrlCreateLabel("Line 1 Cell 1", 10, 150, 70, 20) GUICtrlCreateLabel("Line 2 Cell 1", 100, 150, 70, 20) GUISetState() ; Run the GUI until the dialog is closed While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $Button_1 ; A command Case $msg = $Button_2 MsgBox(0, 'Testing', 'Button 2 was pressed') EndSelect _CtrlResizeMove(); < ========= Inserted here (Remove when finished) ======== WEnd EndFunc ;==>Example ; The include file CtrlResizeMove.au3 ; ;================= CtrlResizeMove.au3 =========================== ; REQUIREMENTS. There are two things you need to do to use script ; If this file is saved as "CtrlResizeMove.au3" then ; 1/ Add #include "CtrlResizeMove.au3" or #include "c:\full path\CtrlResizeMove.au3" ; to top of your script in which you need to resize or move the controls. ; 2/ Put _CtrlResizeMove() within the loop of your script. ; ; HOW TO USE. While hovering over the GUI control you wish to alter:- ; 1/ Press Ctrl + Left mouse button to MOVE the control (And move the mouse); ; 2/ Press Alt + Left mouse button to RE- SIZE the control (And move the mouse); ; 3/ Press Ctrl + s to Save the new control parameters to a backup file called "'your_script_name' & BKn.au3" ; ; CLEANUP. When the control are as required:- ; 1/ Remove the inserted #include "CtrlResizeMove.au3" command ; 2/ Remove the inserted _CtrlResizeMove() command from within the loop of your script. ; 3/ Rename or remove backup files from your script's directory (folder). ;=================================================================== ; #include <GUIConstantsEx.au3> #include <Misc.au3> ;Opt('MustDeclareVars', 1) Local $scriptPath = @ScriptFullPath, $File, $Data Local $scriptPathNew = StringRegExpReplace($scriptPath, "(^.*)\.(.*)", "\1") & "BK" & _ StringRegExpReplace($scriptPath, "^.*\.", ".$1") ;ConsoleWrite(@ScriptFullPath & @CRLF) If FileExists($scriptPathNew) Then Local $Num = 0 Do $Num += 1 $scriptPathNew = StringRegExpReplace($scriptPath, "(^.*)\.(.*)", "\1") & "BK" & $Num & _ StringRegExpReplace($scriptPath, "^.*\.", ".$1") Until Not FileExists($scriptPathNew) EndIf $Data = FileRead($scriptPath) ; This function to be called from within the loop of the script which has the GUI controls to be altered. Func _CtrlResizeMove() Local $aCPos, $aMPos, $aMPosNew, $Num, $scriptPath, $hWnd, $aClssNmNN, $sTxt, $ClssNmNN, $iCommasNo Select Case (_IsPressed("11") Or _IsPressed("12")) And _IsPressed("01"); Ctrl + Left mouse button to move $hWnd = WinGetHandle(""); or Alt + Left mouse button to re-size Opt("MouseCoordMode", 2);1=absolute, 0=relative, 2=client $aMPos = MouseGetPos() $aClssNmNN = _CtrlGetByPos($hWnd, "", $aMPos[0], $aMPos[1], 0); uses client mouse coords Opt("MouseCoordMode", 1);1=absolute, 0=relative, 2=client $aMPos = MouseGetPos() If IsArray($aClssNmNN) Then $ClssNmNN = $aClssNmNN[1] ;ConsoleWrite("CLNN " & $ClssNmNN & @CRLF) $aCPos = ControlGetPos($hWnd, "", $ClssNmNN) Do $aMPosNew = MouseGetPos() If _IsPressed("11") Then ControlMove($hWnd, "", $ClssNmNN, $aCPos[0] + $aMPosNew[0] - $aMPos[0], _ $aCPos[1] + $aMPosNew[1] - $aMPos[1]) If _IsPressed("12") Then ControlMove($hWnd, "", $ClssNmNN, $aCPos[0], $aCPos[1], _ $aCPos[2] + $aMPosNew[0] - $aMPos[0], $aCPos[3] + $aMPosNew[1] - $aMPos[1]) Sleep(100) Until Not _IsPressed("01") ;========== Updata Data ==================== $sTxt = StringRegExpReplace(ControlGetText($hWnd, "", $ClssNmNN), "(\w*[ ]*)(\s*\v*)", "\1") ;ConsoleWrite($sTxt & @CRLF) $aCPos = ControlGetPos($hWnd, "", $ClssNmNN) $Data = StringRegExpReplace($Data, '("' & $sTxt & '".*),\h*\d*\h*,\h*\d*\h*,\h*\d*\h*,\h*\d*\h*(,.*|\))', _ '\1, ' & $aCPos[0] & ", " & $aCPos[1] & ", " & $aCPos[2] & ", " & $aCPos[3] & "\2") ;=========> End of Updata Data ============= Case _IsPressed("11") And _IsPressed("53"); Ctrl + s To Save Do Until Not (_IsPressed("11") And _IsPressed("53")) $File = FileOpen($scriptPathNew, 2) FileWrite($File, $Data) FileClose($File) ShellExecute($scriptPathNew) EndSelect EndFunc ;==>_CtrlResizeMove ; From http://www.autoitscript.com/forum/index.php?s=&showtopic=30717&view=findpost&p=219847 Func _CtrlGetByPos($hWin, $sText = '', $iXPos = 0, $iYPos = 0, $iReturnType = 0) If IsString($hWin) Then $hWin = WinGetHandle($hWin) Local $sClassList = WinGetClassList($hWin), $hCtrlWnd Local $sSplitClass = StringSplit(StringTrimRight($sClassList, 1), @LF), $aReturn = '' For $iCount = UBound($sSplitClass) - 1 To 1 Step -1 Local $nCount = 0 While 1 $nCount += 1 Local $aCPos = ControlGetPos($hWin, $sText, $sSplitClass[$iCount] & $nCount) If @error Then ExitLoop If $iXPos >= $aCPos[0] And $iXPos <= ($aCPos[0] + $aCPos[2]) _ And $iYPos >= $aCPos[1] And $iYPos <= ($aCPos[1] + $aCPos[3]) Then If $sSplitClass[$iCount] <> '' And Not $iReturnType Then Local $aClassNN[2] = [2, $sSplitClass[$iCount] & $nCount] Return $aClassNN EndIf If $sSplitClass[$iCount] <> '' And $iReturnType = 3 Then $hCtrlWnd = ControlGetHandle($hWin, $sText, $sSplitClass[$iCount] & $nCount) ControlFocus($hWin, $sText, $hCtrlWnd) $aReturn = DllCall('User32.dll', 'int', 'GetDlgCtrlID', 'hwnd', $hCtrlWnd) If @error = 0 And $aReturn[0] <> '' Then Local $aClassNN[4] = [4, $aReturn[0], $sSplitClass[$iCount] & $nCount, $hCtrlWnd] Return $aClassNN EndIf Local $aClassNN[2] = [2, $sSplitClass[$iCount] & $nCount] Return $aClassNN ElseIf $sSplitClass[$iCount] <> '' And $iReturnType = 2 Then Return ControlGetHandle($hWin, $sText, $sSplitClass[$iCount] & $nCount) ElseIf $sSplitClass[$iCount] <> '' And $iReturnType = 1 Then $hCtrlWnd = ControlGetHandle($hWin, $sText, $sSplitClass[$iCount] & $nCount) ControlFocus($hWin, $sText, $hCtrlWnd) $aReturn = DllCall('User32.dll', 'int', 'GetDlgCtrlID', 'hwnd', $hCtrlWnd) If @error = 0 And $aReturn[0] <> '' Then Local $aClassNN[2] = [2, $aReturn[0]] Return $aClassNN EndIf EndIf Return SetError(1, 0, 0) EndIf WEnd Next Return SetError(2, 0, 0) EndFunc ;==>_CtrlGetByPos ;Edit: Added comment,";", to Opt('MustDeclareVars', 1) lines.
    1 point
×
×
  • Create New...