Jump to content

junkew

MVPs
  • Posts

    3,020
  • Joined

  • Last visited

  • Days Won

    12

junkew last won the day on January 10 2020

junkew had the most liked content!

About junkew

Profile Information

  • Location
    Netherlands, Oostzaan

Recent Profile Visitors

4,112 profile views

junkew's Achievements

  1. Maybe someone will invent multithreading 😉 for this problem
  2. Did you try to create the 1 million screenshots and then run 10 au3 exe files to analyse 100.000 bitmaps? In theory it can be ten times faster.
  3. Check the findbmp code func GetImage on lockbits _GDIPlus_BitmapLockBits and search the forum on bitblt and lockbits. Probably (much) faster then getting the color per pixel with _GDIPlus_BitmapGetPixel($hBitmap, $x, $y) And rotating can help: Function _GDIPlus_ImageRotateFlip as you then have directly the pixels as sequence instead of calculating x,y and iterating x, y Func GetImage($BMPFile, byref $BMPDataStart, byref $Width, byRef $Height, byref $Stride, $imgBytes=3) local $Scan0, $pixelData, $hbScreen, $pBitmap, $pBitmapCap, $handle ; Load the bitmap to search in     If $BMPFile="SCREEN" Then         $hbScreen=_ScreenCapture_Capture("",0,0,-1,-1,False)         $pBitmap = _GDIPlus_BitmapCreateFromHBITMAP($hbScreen); returns memory bitmap     Else ;try to get a handle         $handle = WinGetHandle($BMPFile)         If @error Then ;Assume its an unknown handle so correct filename should be given             $pBitmap = _GDIPlus_BitmapCreateFromFile($BMPFile)         Else             $hbScreen=_ScreenCapture_CaptureWnd("",$handle,0,0,-1,-1,False)             $pBitmap = _GDIPlus_BitmapCreateFromHBITMAP($hbScreen); returns memory bitmap         EndIf     EndIf ;Get $tagGDIPBITMAPDATA structure ;~  ConsoleWrite("Bitmap Width:    " & _GDIPlus_ImageGetWidth($pBitmap) & @CRLF ) ;~  ConsoleWrite("Bitmap Height:      " & _GDIPlus_ImageGetHeight($pBitmap) & @CRLF) ;~  24 bits (3 bytes) or 16 bits (2 bytes) comparison     if ($imgBytes=2) then         $BitmapData= _GDIPlus_BitmapLockBits($pBitmap, 0, 0, _GDIPlus_ImageGetWidth($pBitmap), _GDIPlus_ImageGetHeight($pBitmap), $GDIP_ILMREAD, $GDIP_PXF16RGB555) ;~      $BitmapData= _GDIPlus_BitmapLockBits($pBitmap, 0, 0, _GDIPlus_ImageGetWidth($pBitmap), _GDIPlus_ImageGetHeight($pBitmap), $GDIP_ILMREAD, $GDIP_PXF32ARGB)     Else         $BitmapData= _GDIPlus_BitmapLockBits($pBitmap, 0, 0, _GDIPlus_ImageGetWidth($pBitmap), _GDIPlus_ImageGetHeight($pBitmap), $GDIP_ILMREAD, $GDIP_PXF24RGB) ;~      $BitmapData= _GDIPlus_BitmapLockBits($pBitmap, 0, 0, _GDIPlus_ImageGetWidth($pBitmap), _GDIPlus_ImageGetHeight($pBitmap), $GDIP_ILMREAD, $GDIP_PXF32ARGB)     endIf     If @ERROR Then MsgBox(0,"","Error locking region " & @error)     $Stride = DllStructGetData($BitmapData, "Stride");Stride - Offset, in bytes, between consecutive scan lines of the bitmap. If the stride is positive, the bitmap is top-down. If the stride is negative, the bitmap is bottom-up.     $Width = DllStructGetData($BitmapData, "Width");Image width - Number of pixels in one scan line of the bitmap.     $Height = DllStructGetData($BitmapData, "Height");Image height - Number of scan lines in the bitmap.     $PixelFormat = DllStructGetData($BitmapData, "PixelFormat");Pixel format - Integer that specifies the pixel format of the bitmap     $Scan0 = DllStructGetData($BitmapData, "Scan0");Scan0 - Pointer to the first (index 0) scan line of the bitmap.     $pixelData = DllStructCreate("ubyte lData[" & (abs($Stride) * $Height-1) & "]", $Scan0)     $BMPDataStart = $BMPDataStart & DllStructGetData($pixeldata,"lData")     _GDIPlus_BitmapUnlockBits($pBitmap, $BitmapData)     _GDIPlus_ImageDispose ($pBitmap)     _WinAPI_DeleteObject ($pBitmap) EndFunc;==>GetImage
  4. Wouldn't it be easier to see if it can be read by uiautomation or other accessibility tools. try inspect.exe or simplespy (see faq in signature) It seems to be a certain Delphi version that the tool.exe was build in (https://www.embarcadero.com/products/delphi/starter) This imagerecognition is probably much faster in Delphi or C# I remembered I build this 15 years ago 😉 for a similar purpose. And for fun some reference on analog digits on screen for having fun to recognize with pixel checking 😉 #include <GDIPlus.au3> #include <WindowsConstants.au3> #include <GUIConstantsEx.au3> Dim $ws[12] = [0, 0, 10, -7, 50, -7, 60, 0, 50, 7, 10, 7] ;Koordinaten Polygonzug: von links nach rechts WAAGRECHTER Balken, von rechts nach links SENKRECHTER Balken Dim $ziffer[10] = [239, 10, 118, 94, 154, 220, 253, 14, 254, 222] ;alle gesetzten bits des Indexes in der 7-segmentanzeige ergeben die Ziffer Dim $balkenpos[8] = [0, "60.0", "0.0", "60.60", "0.60", "0.60", "0.120", "0.0"] ;position der Leuchtbalken der 7-Segmentanzeige innerhalb der Ziffer Dim $p[7][2] ;nimmt die polygonzug-koordinaten zum Zeichnen auf $p[0][0] = 6 ;6 Punkte im Polygonzug _GDIPlus_Startup() Global $hgui = GUICreate('Uhr', 620, 175, -1, -1, $WS_POPUP) ;GUI erstellen ohne Rahmen Global $hWnd = WinGetHandle($hgui) ;Handle holen Global $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hWnd) ;"Leinwand" erstellen, auf der gezeichnet werden kann GUICtrlCreateLabel("", 0, 0, 620, 175, Default, $GUI_WS_EX_PARENTDRAG) ;verschieben des Fensters möglich machen durch 2. Fenster GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) ;das 2. Fenster transparent machen GUISetBkColor(0x000000) ;Hintergrund der GUI schwarz GUISetState() ;GUI anzeigen AdlibRegister("_time", 1000) ;jede Zehntelsekunde ein Refresh der Zeitanzeige Do ;Endlosschleife, solange bis.. Until GUIGetMsg() = -3 ;..ESC gedrückt wird _GDIPlus_GraphicsDispose($hGraphic) ;freigeben _GDIPlus_Shutdown() Func _time() ;Uhrzeit anzeigen :o) For $k = 1 To 6 ;die 6 Ziffern der Uhrzeit $setbits = $ziffer[StringMid(String(@HOUR & @MIN & @SEC), $k, 1)] ;gesetzte Bits in der siebensegmentanzeige anhand der Ziffer in der Uhrzeit holen For $bitnr = 7 To 1 Step -1 ;alle Bits durchlaufen _drawpolygon(BitAND($setbits, 128), $k * 100 - 80 + ($k = 1 Or $k = 3 Or $k = 5) * 20, $bitnr) ;parameter: bit gesetzt ja/nein, position der gesamten ziffer,nummer des bits(gerade=waagrechter balken, ungerade=senkrechter balken) $setbits = BitShift($setbits, -1) ;nächstes Bit holen Next Next $brush = _GDIPlus_BrushCreateSolid(0xFF440000 + (@SEC / 2 = Int(@SEC / 2)) * 0xBB0000) ;Pinsel erstellen, wenn Ziffer gerade, dann farbig, ansonsten schwarz _GDIPlus_GraphicsFillEllipse($hGraphic, 202, 55, 15, 15, $brush) ;Punkte zeichnen _GDIPlus_GraphicsFillEllipse($hGraphic, 402, 55, 15, 15, $brush) _GDIPlus_GraphicsFillEllipse($hGraphic, 202, 105, 15, 15, $brush) _GDIPlus_GraphicsFillEllipse($hGraphic, 402, 105, 15, 15, $brush) _GDIPlus_BrushDispose($brush) ;Pinsel auflösen EndFunc ;==>_time Func _drawpolygon($bit, $xpos, $bitnr) ;zeichnet einen polygonzug ("Balken") an die entsprechende Position $split = StringSplit($balkenpos[$bitnr], ".", 3) ;x- und y-koordinaten des Balkens innerhalb der Ziffer holen $b = (($bitnr / 2) = Int($bitnr / 2)) ;$bit gerade => $b = true => Balken waagrecht, ansonsten Balken senkrecht $step = -1 + 2 * $b ;schrittweite durch das $WS-Array For $i = 11 - 11 * $b To 11 * $b Step 2 * $step ;array mit waagrechten (bit=gerade) oder (Bit=ungerade) senkrechten Balken füllen $r = Int(Abs((11 * (Not ($b))) - $i) / 2) + 1 ;abhängig von der Reihenfolge, egal ob $i von 0 bis 11 oder von 11 bis 0, $r muss immer 1,2,3,4,5,6 $p[$r][0] = $ws[$i] + $split[0] + $xpos ;x- und $p[$r][1] = $ws[$i + $step] + $split[1] + 30 ;y-position in das polygonarray schreiben Next $brush = _GDIPlus_BrushCreateSolid(0xFF440000 + ($bit <> 0) * 0xBB0000) ;wenn bit gesetzt, dann farbig, ansonsten schwarz _GDIPlus_GraphicsFillPolygon($hGraphic, $p, $brush) ;Balken zeichnen _GDIPlus_BrushDispose($brush) EndFunc ;==>_drawpolygon
  5. Not sure if typelibinspector still works for ole objects. And there was a debugger in the past that partially could do that but real reflection on all variables is not possible.
  6. Would eval function help? In which circumstance you wouldnt know the objectstructure or subfields. What you refer as "cheating" looks to me reuse what you know from the query. In general there is no reflection mechanism on objects.
  7. https://www.autoitscript.com/autoit3/docs/functions/RegDelete.htm https://www.autoitscript.com/autoit3/docs/functions/Run.htm https://www.autoitscript.com/autoit3/docs/functions.htm Just read the examples and try
  8. If you can determine your element with inspect, uiaspy or simplespy you can see which properties the element has. If you can see unique properties you can filter it. If not you have the fallback on tricks like find nth element after a unique element.
  9. Do you have more information on how you search and learn in the forum?
  10. See the remarks in the help of controlsend * Try an underscore after open instead of space * try 3 controlsends as separate commands Open,Ip,Enter sorry no solution just some more things to experiment. Under the hood of controlsend its probably sendmessage and postmessage win32 api. Maybe keybd_event or sendinput can help but no quarantee Get key state commands can help finding out if shift or capslock is on.
  11. See help on runwait. It says wait till programm stops running
  12. Maybe https://stackoverflow.com/questions/12648165/uiautomation-how-to-get-around-modal-dialog-blocking-using-windowopendedevent
  13. https://github.com/EsportToys/PrecisionThreeFingerDrag/blob/main/finger.au3
×
×
  • Create New...