Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 08/04/2020 in all areas

  1. 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
  2. Here is the first new issue of the debugger for a long time! Error List: Variables: Tool Chest: Class Viewer: Features: Automatic updates.COM operation replaced with Windows messaging (script no longer closes when program finishes).Output window, showing Console output.Automatic program tracing.Toggle between Release and Debug AutoIt.Script editing using ScintillaNET editor (looks and feels the same as SciTE).Single step debug through your script and #include files.Debug script in compiled (exe) or script (au3) form.View and modify variable values while your program is running. Allows you to test all parts of you program.Breakpoints (toggled by clicking on the line number). Breakpoints are stored between sessions.Scripts can be debugged by right clicking on the au3 file, running the debugger from the Start>Programs menu, from UltraEdit/UEStudio by using AutoIt4UE, or from within SciTE with this mod.Portable version (just install and select 'Portable' instead of 'Full').Automatic Context Check option.Access to 3rd party tools (Context Check, Koda, open in SciTE, Run script, Compile script, Tidy, Code Wizard).Easy switch between Release and Beta AutoIt.Syntax highlighting in either SciTE, or Visual Studio style.Upcoming features (don't hold your breath though!): Detection of changes in the script and prompt to automatically reloadVariable breakpoints (stop if x>1, or @error=1)Variable value tooltips in the code windowSome method of jumping back in the script to an earlier line without restarting. Don't really know if this is possible without the GOTO command.Some sort of variable value popup window to allow long strings to be viewedRun to Cursor option in code windowHere is link to a web page for the program: Autoit Debugger
    1 point
  3. 1) Like this : While Number(@HOUR & "." & @MIN) < 8.45 2) The parameters that are passed to the function SignIn tell the function how many times it has to loop before returning False. If it finds a match with the button objects, it will return True. So you must adjust the $iAttempt accordingly, to cover the duration that you want (increase the $iAttempt for a longer duration).
    1 point
  4. Thank you for taking the time to describe your issue. Here one way you could do it : #include <Constants.au3> #include <IE.au3> ; should be started at 8h50 every day If Not @Compiled Then Exit MsgBox ($MB_SYSTEMMODAL,"Error", "You must compile this script and add it to task scheduler") MsgBox ($MB_SYSTEMMODAL,"", "Reservation manager started", 5) Local $oIE = _IECreate ("https://pretix.eu/dnb/reservierung-f") While Int(@HOUR) < 9 Sleep (100) WEnd If SignIn($oIE, 20, 0) Then ; perform initial reservation with no sleep MsgBox ($MB_SYSTEMMODAL,"","Successful reservation") ElseIf SignIn ($oIE, 500, 1000) Then ; reservation attempt with 1 sec sleep at each iteration MsgBox ($MB_SYSTEMMODAL,"","Reservation found because of cancellation") Else MsgBox ($MB_SYSTEMMODAL,"","Unable to make reservation") EndIf _IEQuit ($oIE) Func SignIn (ByRef $oIE, $iAttempt, $iPause) Local $button1, $button2 For $i = 1 to $iAttempt Sleep ($iPause) _IEAction ($oIE, "refresh") _IELoadWait ($oIE) $button1 = _IEGetObjByName ($oIE,"item_66932") If Not IsObj ($button1) Then ContinueLoop $button2 = _IEGetObjById ($oIE, "btn-add-to-cart") If IsObj ($button2) Then _IEAction ($button1,"click") Sleep(100) _IEAction ($button2,"click") Return True EndIf Next Return False EndFunc I would personally put this compiled script into task scheduler to start every day just before 9h00AM. Edit : I just saw that there is a different button to push for cancellation part, you will need to adjust the script accordingly.
    1 point
  5. Something on fire? It likely doesn't work because you don't wait for chrome to start before starting to type.... And you have the syntax all wrong for the last line.
    1 point
  6. The problem with this thread (and like the other "similar" one) is that you ask us to tell you how to solve your issue but you do not provide the essential information of why is this an issue and what do you want to achieve at the end. I suggest you first start telling us the web site that you want to automate (or at least a screenshot of the pages), the end goal of the script, and a clear description of the issue. Unless you can adduce a more detailed documentation of your problem, I am afraid it is going to be hard to help you.
    1 point
  7. ok. Here: BinaryToAu3Kompressor v 1.0.5.4.au3 I'll remove it once the OP updates the 1st post
    1 point
  8. Nine

    Using IE.au3 with HotKeySet

    And how is it different from your other thread ? https://www.autoitscript.com/forum/topic/203517-how-to-pause-a-program/
    1 point
  9. The problem is probably with the Arrays. If i saw it right, the GuiFlatButton.au3 is using arrays to store the Data of the buttons. Now, when you create 3 button's, the array is updated to hold 3 buttons. When GuiDelete is used, the array is not reseted, therefore each new button is added to the last position in the array. You can test following code, if you change the example2 fuction (from the 1st post) like this: Func Example2() Local $2_hGUI, $P1_Shower $2_hGUI = GUICreate("P2", 275, 220) GUISetBkColor(0x333333) $idLabel = GUICtrlCreateLabel("Click the button", 10, 200, 150, 30) GUICtrlSetColor(-1, 0xFFFFFF) ;create new button then set the background and foreground colors $P1_Shower = GuiFlatButton_Create("Show P1", 78, 10, 120, 40) GuiFlatButton_SetColorsEx(-1, $aColorsEx_BlueRed) $P2_Shower = GuiFlatButton_Create("Show P2", 78, 50, 120, 40) GuiFlatButton_SetColorsEx(-1, $aColorsEx_GreenRed) $P3_Shower = GuiFlatButton_Create("Show P3", 78, 90, 120, 40) GuiFlatButton_SetColorsEx(-1, $aColorsEx_GreenRed) $P4_Shower = GuiFlatButton_Create("Show P4", 78, 130, 120, 40) GuiFlatButton_SetColorsEx(-1, $aColorsEx_GreenRed) GUISetState(@SW_SHOW, $2_hGUI) And you will notice that the 4th button does get colored. (but only in the first function call) Therefore my assumption is that it has to do with the array's, because GuiDelete does not clear them. And so the GuiFlatButton_Delete for each button is needed, for the script, to work properly.
    1 point
  10. v0.3.0.5 just released with the following changes -- - Added: _WD_GetTable (danylarson / water) - Fixed (_WD_FindElement): Enforce relative xpath when utilizing a starting element - Changed: Use InetRead instead of __WD_Get (_WD_IsLatestRelease & _WD_UpdateDriver) - Changed: Pass Content-Type header in HTTP request
    1 point
  11. I want to get the screen coordinates (desktop or application) just by dragging a rectangle. The output may be copied to clipboard or shown in a msgbox. output should be x1 y1 x2 y2 - x1 y1 point of mouse drag begin and x2 y2 being mouse drag end
    1 point
  12. Well maybe jchd's technical knowledge is good but communication skills could use some work. I'm guessing based upon his/her response that I probably didn't hurt their feelings too much but it's very nice that you stood up for them. Earthshine, actually I think there is still some misunderstanding... I am not converting strings to int or floats before writing out to binary. My data is already in int and float format in the computer memory as that is the form I need it in to do computations. I just want to write it out in that format without going through a string in the process as that is an unnecessary and computationally expensive step. The suggestion to use BinaryToString and StringToBinary would introduce this unnecessary step. I want to read/write as Int32, Int64 and Double directly and that is the subject of the code I posted. If anyone has a better way to read/write numerical data in the most computationally efficient manner possible, please post it here. My only goal is to minimize computational and i/o time in reading large numerical datasets. If I'm re-inventing the wheel then I (and I suspect many others) have missed the posting of the wheel somewhere on this forum or in the help files. Please tell me where you've hidden the wheel. I'd be thrilled if someone had an even faster way to read/write large files of numerical data than the method I came up with so please post code if you have it. I for one would use your code.
    1 point
  13. Thanks for your response. I think a detailed explanation may be helpful. Let's go through an example that may make it clear the importance of not treating numerical data as a string. Let's say I have a large number: 2141231231 (10 characters) I have two options to write that number to a file... as a string of 11 bytes (written either in ascii or binary with a deliminator) or as an Int32 which is 4 bytes (written in binary). The BinaryToString and StringToBinary will treat this as 11 bytes so the file size is larger but admittedly dependent on the number of characters in the number. The file size could potentially be smaller if the numerical data on average was made up of numbers from -9 to 99 (remember, still need a 1 char deliminator). But that's not the real problem. After reading in this data as a string you still need to convert this string to a number so that it can be used in mathematical calculations. The string is of no value for calculations. That requires several steps with a computational penalty for each step. For every data point I read in binary as a string I first have to use BinaryToString to get the data in string format, I then have to use StringSplit to separate the large string into individual strings for each number and finally I have to use the Number algorithm to convert the string into a number. When you have millions of data points this is very slow and unnecessary. Much better to write the data in binary as an Int32, Int64 or Double and read it in binary as the same data type. By doing that I eliminate BinaryToString, StringSplit and Number from the process. For small file sizes this is a non-issue in regards to time savings although I think it's actually easier to read/write these files in the method I outlined than use multiple steps to convert between strings and numbers. But for large datasets the time savings in reading these files in the way I outlined is significant. You definitely don't want to read/write numbers as a string whenever dealing with a lot of data. Hope that helps.
    1 point
  14. Version 2018.05.24

    2,921 downloads

    Dbug is graphical debugger for AutoIt. Project started by @Heron in 2009 and now supported by @asdf8 and @valdemar1977. Features Debug the complete script or just parts of it Display run status (line number of currently executed function) GUI default always-on-top in the upper right corner for comfortable debugging WM_NOTIFY and WM_COMMAND hook to prevent interference with possible message handlers Display scope, type and value of variables, expressions, macro's and constants (global AND function local) Execute commands in an immediate window. Can be expressions, functions and assignments Detailed display of array, struct and object variables Dynamic display of variable value in the source code (under cursor) Array table viewer with ability to view the sub-arrays, the correct handling of macro @Error, @Extended and other changes OEM and ANSI console output Conditional breakpoints Saving settings and debugging state and much more... How to use Extract from downloaded archive _Dbug.au3 to your Autoit include dir Add #include <_Dbug.au3> in to your code and run code Before compile or buid comment or remove #include <_Dbug.au3> from your code
    1 point
  15. Add a whitespace before ByRef.
    1 point
  16. ah ok.... I ran Tidy on your code so didn't get the error. Just add a space infront of the Byref statement and au3check will not have any issues. JOs
    1 point
  17. Can you upload it on any sharing site like mediafire or googledrive and share the link.
    1 point
  18. gauss786, Something like this perhaps: #include <GuiConstantsEx.au3> #include <WindowsConstants.au3> #Include <ScreenCapture.au3> #Include <Misc.au3> Global $iX1, $iY1, $iX2, $iY2, $aPos, $sMsg, $sBMP_Path ; Create GUI $hMain_GUI = GUICreate("Select Rectangle", 240, 50) $hRect_Button = GUICtrlCreateButton("Mark Area", 10, 10, 80, 30) $hCancel_Button = GUICtrlCreateButton("Cancel", 150, 10, 80, 30) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $hCancel_Button FileDelete(@ScriptDir & "Rect.bmp") Exit Case $hRect_Button GUISetState(@SW_HIDE, $hMain_GUI) Mark_Rect() ; Capture selected area MsgBox($MB_SYSTEMMODAL, "Coords", "Left: " & $iX1 & @CRLF & "Top: " & $iY1 & @CRLF & "Right: " & $iX2 & @CRLF & "Bott0m: " & $iY2) EndSwitch WEnd ; ------------- Func Mark_Rect() Local $aMouse_Pos, $hMask, $hMaster_Mask, $iTemp Local $UserDLL = DllOpen("user32.dll") ; Create transparent GUI with Cross cursor $hCross_GUI = GUICreate("Test", @DesktopWidth, @DesktopHeight - 20, 0, 0, $WS_POPUP, $WS_EX_TOPMOST) WinSetTrans($hCross_GUI, "", 8) GUISetState(@SW_SHOW, $hCross_GUI) GUISetCursor(3, 1, $hCross_GUI) Global $hRectangle_GUI = GUICreate("", @DesktopWidth, @DesktopHeight, 0, 0, $WS_POPUP, $WS_EX_TOOLWINDOW + $WS_EX_TOPMOST) GUISetBkColor(0x000000) ; Wait until mouse button pressed While Not _IsPressed("01", $UserDLL) Sleep(10) WEnd ; Get first mouse position $aMouse_Pos = MouseGetPos() $iX1 = $aMouse_Pos[0] $iY1 = $aMouse_Pos[1] ; Draw rectangle while mouse button pressed While _IsPressed("01", $UserDLL) $aMouse_Pos = MouseGetPos() $hMaster_Mask = _WinAPI_CreateRectRgn(0, 0, 0, 0) $hMask = _WinAPI_CreateRectRgn($iX1, $aMouse_Pos[1], $aMouse_Pos[0], $aMouse_Pos[1] + 1) ; Bottom of rectangle _WinAPI_CombineRgn($hMaster_Mask, $hMask, $hMaster_Mask, 2) _WinAPI_DeleteObject($hMask) $hMask = _WinAPI_CreateRectRgn($iX1, $iY1, $iX1 + 1, $aMouse_Pos[1]) ; Left of rectangle _WinAPI_CombineRgn($hMaster_Mask, $hMask, $hMaster_Mask, 2) _WinAPI_DeleteObject($hMask) $hMask = _WinAPI_CreateRectRgn($iX1 + 1, $iY1 + 1, $aMouse_Pos[0], $iY1) ; Top of rectangle _WinAPI_CombineRgn($hMaster_Mask, $hMask, $hMaster_Mask, 2) _WinAPI_DeleteObject($hMask) $hMask = _WinAPI_CreateRectRgn($aMouse_Pos[0], $iY1, $aMouse_Pos[0] + 1, $aMouse_Pos[1]) ; Right of rectangle _WinAPI_CombineRgn($hMaster_Mask, $hMask, $hMaster_Mask, 2) _WinAPI_DeleteObject($hMask) ; Set overall region _WinAPI_SetWindowRgn($hRectangle_GUI, $hMaster_Mask) If WinGetState($hRectangle_GUI) < 15 Then GUISetState() Sleep(10) WEnd ; Get second mouse position $iX2 = $aMouse_Pos[0] $iY2 = $aMouse_Pos[1] ; Set in correct order if required If $iX2 < $iX1 Then $iTemp = $iX1 $iX1 = $iX2 $iX2 = $iTemp EndIf If $iY2 < $iY1 Then $iTemp = $iY1 $iY1 = $iY2 $iY2 = $iTemp EndIf GUIDelete($hRectangle_GUI) GUIDelete($hCross_GUI) DllClose($UserDLL) EndFunc ;==>Mark_Rect Please ask if you have any questions. M23
    1 point
  19. Thanks you very much ! On the very first release of FastFind, those were different functions, one for each case. In version 1.2, I've done some refactoring with a highly optimized generic function GenericColorSearch called by most other functions. So all those "deprecated" functions still exist (for compatibility reasons with my own code), but you don't really need them as they internally all call FFNearestSpot with some restrictions on the parameters. Of course, there are some functions that are obviously different, but those are exposed in FastFind.au3 (ColorCount, Changes detection...). Well, it doesn't really matter. For a given pixel, if I know there is a match on a given color in the list, then it's just a question of performance to know if I continue to check the rest of the list for that same pixel or not (so of course, I don't). Anyway the result would be the same. In no case would a single pixel counts for more than one hit, if that is the question. And the impact on performance is in most cases not noticeable (except in very specific cases, with large list of pixels and most pixels in the area having one of the first color in the list). No matter what colors in the list have hits, if you ask a NxN spot with at least P "good" pixels, then you're assured to have the closest spot that fit those criteria if one exists.
    1 point
×
×
  • Create New...