-
Posts
3,064 -
Joined
-
Last visited
-
Days Won
15
Everything posted by junkew
-
Get System Try Icon for reading MS Teams status
junkew replied to Jacov's topic in AutoIt General Help and Support
Simplespy seems to give information including its XAML framework information [Klok 20:53 29-4-2025] class: [SystemTray.OmniButton] UIA_AutomationId:= <TaskbarFrame> UIA_ClassName:= <Taskbar.TaskbarFrameAutomationPeer> UIA_ClickablePoint:= <960;1056> UIA_Culture:= <1043> UIA_IsControlElement:= <True> UIA_IsContentElement:= <True> UIA_IsPassword:= <False> UIA_NativeWindowHandle:= <0> UIA_IsOffscreen:= <False> UIA_Orientation:= <0> UIA_FrameworkId:= <XAML> But it seems much harder on the news no sub tiles identified: UIA_class:= <Microsoft.UI.Xaml.Controls.WebView2> But then check with inspect.exe as part of the win32 sdk tools then you can navigate and inspect the tree -
IUIAutomation MS framework automate chrome, FF, IE, ....
junkew replied to junkew's topic in AutoIt Example Scripts
Is that a question? You can interact with scrollbars using IUIAutomation. The wrappers I made are not wrapping all possibilities there are many examples made on the forum around IUIAutomation just search and you will find a lot. UIASpy is a nice one that gives you directly when you spy the ability to generate code for it. Using the keyboard with send can be in many cases a good alternative its just one of the things you can use when you want to automate a GUI. Microsoft supports the basic scrolling unfortunately many suppliers of derived scrollbars implement not full logic for IuIAutomation. Basically they should if they want to have their applications accessible for the impaired people. https://learn.microsoft.com/en-us/dotnet/framework/ui-automation/ui-automation-support-for-the-scrollbar-control-type -
IUIAutomation MS framework automate chrome, FF, IE, ....
junkew replied to junkew's topic in AutoIt Example Scripts
This is in the wrappers with propertyvalue, property and most likely when I wrote the library I had to deal with textboxes from java or other not fully iUIAutomation compatible textboxes and choosed to do it by keyboard commands and have another way to get to the propertys by a property command action. Case "propertyvalue", "property" Local $i = _UIA_getPropertyIndex($p1) If Not @error <> 0 Then $retValue = _UIA_getPropertyValue($obj2ActOn, $UIA_propertiesSupportedArray[$i][1]) Else $retValue = _UIA_getPropertyValue($obj2ActOn, $p1) EndIf and implemented like Func _UIA_getPropertyValue($UIA_oUIElement, $id) Local $tmpValue, $tmpStr, $iProperty If Not _UIA_IsElement($UIA_oUIElement) Then Return SetError($_UIASTATUS_GeneralError, $_UIASTATUS_GeneralError, "** NO PROPERTYVALUE DUE TO NONEXISTING OBJECT **") EndIf $UIA_oUIElement.GetCurrentPropertyValue($id, $tmpValue) $tmpStr = "" & $tmpValue If IsArray($tmpValue) Then $tmpStr = "" For $iProperty = 0 To UBound($tmpValue) - 1 $tmpStr = $tmpStr & StringStripWS($tmpValue[$iProperty], $STR_STRIPLEADING + $STR_STRIPTRAILING) If $iProperty <> UBound($tmpValue) - 1 Then $tmpStr = $tmpStr & ";" EndIf Next Return $tmpStr EndIf Return SetError($_UIASTATUS_GeneralError, $_UIASTATUS_GeneralError, $tmpStr) EndFunc ;==>_UIA_getPropertyValue And setting your keyboard focus back to begin or end could be done with keys like ctrl+home and ctrl+end. There are to many aspects in remotely controlling different applications and all kinds of different textboxes from different programming languages. Nowadays probably more and more html frontend applications but in 2010-2015 dealing with many windows UX technologies (Visual Basic, Java, Win32 forms, Delphi, HTML, QWidgets, ....) -
Interesting but if Au3Inf is seeing it you should be able to handle it. https://learn.microsoft.com/en-us/shows/visual-studio-toolbox/xaml-islands Try FAQ 31 with UIAutomation Whats the output of this Example() Func Example() ; Retrieve a list of window handles. Local $aList = WinList() ; Loop through the array displaying only visable windows with a title. For $i = 1 To $aList[0][0] If $aList[$i][0] <> "" And BitAND(WinGetState($aList[$i][1]), 2) Then consolewrite("Title: " & $aList[$i][0] & @CRLF & "Handle: " & $aList[$i][1] & @CRLF) ; Retrieve the classlist of the window using the handle returned . Local $sClassList = WinGetClassList($aList[$i][1]) consolewrite(stringreplace($sClassList,@LF,@LF & " -")& @CRLF) EndIf Next EndFunc ;==>Example
-
goto specific line in rich edit control
junkew replied to TheAutomator's topic in AutoIt General Help and Support
This seems to work for both controls but you have to set the rich text box first to point 0,0 The reverse order is not working #include <EditConstants.au3> #include <GuiEdit.au3> #include <GuiRichEdit.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Example() Func Example() Local $hGui=GUICreate("My GUI edit and rich edit") ; will create a dialog box that when displayed is centered local $someTextLines=stringreplace("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx","x", "line" & @crlf) Local $idMyedit = GUICtrlCreateEdit($someTextLines & @CRLF, 10, 10, 350, 180, $ES_MULTILINE+$ES_AUTOVSCROLL + $WS_VSCROLL) Local $hRichEdit = _GUICtrlRichEdit_Create($hGui, $someTextLines, 10, 210, 350, 180, bitor($ES_MULTILINE, $ES_AUTOVSCROLL, $WS_VSCROLL)) ;~ Important line _GUICtrlRichEdit_SetSel($hRichEdit, 0, 0) GUISetState(@SW_SHOW) ;~ GUICtrlSendMsg ($hRichEdit, $EM_LINESCROLL, 0, 0) local $i For $i=10 to 20 ;~ _GUICtrlEdit_LineScroll($idMyedit, 0, _GUICtrlEdit_GetLineCount($idMyedit)) ;~ _GUICtrlEdit_LineScroll($hRichEdit, 0, _GUICtrlEdit_GetLineCount($hRichEdit)) _GUICtrlEdit_LineScroll($idMyedit, 0, $i) _GUICtrlEdit_LineScroll($hRichEdit, 0, $i) ;~ GUICtrlSendMsg ($hRichEdit, $EM_LINESCROLL, 0, $i) ;~ Local $nIndex = GUICtrlSendMsg ($hRichEdit, $EM_LINEINDEX, $i, 0) ;~ GUICtrlSendMsg ($hRichEdit, $EM_SETSEL, $nIndex, 0) ;~ ControlCommand ($hGUI, "", $hRichEdit, "SetCurrentSelection", @CRLF) ;~ $iCharPosition = _GUICtrlRichEdit_GetFirstCharPosOnLine($hRichEdit, $i) ;~ _GUICtrlRichEdit_SetSel($hRichEdit, $iCharPosition, $iCharPosition + 4) sleep(250) next ;~ Important line ;~ _GUICtrlEdit_SetSel($idMyedit, -1, -1) ;~ _GUICtrlRichEdit_SetSel($hRichEdit, -1,-1) For $i=10 to 0 step -1 _GUICtrlEdit_LineScroll($idMyedit, 0, $i) _GUICtrlEdit_LineScroll($hRichEdit, 0, $i) sleep(250) next ; Loop until the user exits. While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd GUIDelete() EndFunc ;==>Example -
goto specific line in rich edit control
junkew replied to TheAutomator's topic in AutoIt General Help and Support
https://www.autoitscript.com/autoit3/docs/libfunctions/_GUICtrlRichEdit_FindText.htm https://www.autoitscript.com/autoit3/docs/libfunctions/_GUICtrlRichEdit_GotoCharPos.htm Goto 0 and in a loop find carriage return Probably with those messages you will be able to do this EM_POSFROMCHAR EM_CHARFROMPOS EM_LINEFROMCHAR EM_LINEINDEX EM_LINESCROLL And the editcontrol functions should work also otherwise you need sendmessage function with windows messages https://learn.microsoft.com/en-us/windows/win32/controls/about-rich-edit-controls https://www.autoitscript.com/autoit3/docs/libfunctions/_GUICtrlEdit_LineScroll.htm -
https://github.com/MicrosoftDocs/win32/blob/docs/desktop-src/wintouch/architectural-overview.md is having WM_TOUCH messages. Then it depends afterwards what the driver is doing if its a nice driver it uses sendinput for driving the keyboard and/or mouse. (which you then can hook with a keyboard hook) And not sure where MS is going with WinUI: https://learn.microsoft.com/en-us/uwp/api/windows.ui.input.preview.injection?view=winrt-26100
-
https://learn.microsoft.com/en-us/windows/win32/winmsg/about-messages-and-message-queues The whole windows system is based on messaging. Your swipedevice has a driver that if it nicely behaves transforms your guesture to a sendinput or sendmessage for a keyboardmessage ctrl and left. So you must know which messages the driver is sending and then you have to catche.hook them. An advanced topic where you probably have to read a lot.
-
Remap right mouse dragging as left mouse dragging?
junkew replied to VAN0's topic in AutoIt General Help and Support
https://www.autoitscript.com/autoit3/docs/libfunctions/_WinAPI_SetWindowsHookEx.htm -
DLLCall fails in AutoIt but works in VB6
junkew replied to TimRude's topic in AutoIt General Help and Support
To make it complete. The BSTR has a definition: https://learn.microsoft.com/en-us/previous-versions/windows/desktop/automat/bstr?redirectedfrom=MSDN And some nice topic on many variable types was made by @LarsJ -
Another bitmap brute-forcing thread
junkew replied to Hashim's topic in AutoIt General Help and Support
Waiting for the fasm version and see if OP gets any version 100% running. -
Another bitmap brute-forcing thread
junkew replied to Hashim's topic in AutoIt General Help and Support
Yes offcourse 🙃🤫 -
Another bitmap brute-forcing thread
junkew replied to Hashim's topic in AutoIt General Help and Support
@Werty tried to run your example but only get 1111 as a result for 9.png see below my reproducing script. Could not directly see why it gives 1111 instead of 9142 or was this about getting the exact $posx and $posy right Maybe I am miscalculating 100,100 for the form +16,16 for the drawImageRect. #include <GDIPlus.au3> #include <WinAPI.au3> HotKeySet("{ESC}", "_exit") ;Be sure $posx and $posy is pointing at the correct spot! Global $posx = 116 + 29 + 3, $posy = 116 + 32 + 12 , $result = "", $code[4], $capture, $pixels = DllStructCreate('dword[2816]') ;Lookup table to avoid searching Global $digit[115] = [1,0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,0,0,0,0, _ 0,0,0,0,0,0,0,0,0,0,6,0,0,0,3,2,0,0,0,0, _ 0,0,0,0,0,0,0,0,9,0,0,0,0,0,8,0,0,0,0,0, _ 0,0,0,0,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, _ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, _ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,5] ;Test section ;-------------------------------------------------------------- $gui = GUICreate("Getnumber", 640, 480, 100, 100) GUISetState() WinWaitActive($gui); <--- necessary or screencapture fails _GDIPlus_Startup() $graphics = _GDIPlus_GraphicsCreateFromHWND($gui) $image = _GDIPlus_BitmapCreateFromFile(@UserProfileDir & "\downloads\examples\" & "9.png") _GDIPlus_GraphicsDrawImageRect($graphics, $image, 16, 16, 176, 56) Sleep(250); <------- necessary because drawimagerect() is too slow, script occasionally fails without ;-------------------------------------------------------------- ;/Test section ;~ $hDDC = _WinAPI_GetDC(0) ;should be ;~ $hDDC = _WinAPI_GetWindowDC($tool) $hDDC = _WinAPI_GetDC($gui) $hCDC = _WinAPI_CreateCompatibleDC($hDDC) $capture = _WinAPI_CreateCompatibleBitmap($hDDC, 88, 32) _WinAPI_SelectObject($hCDC, $capture) _WinAPI_BitBlt($hCDC, 0, 0, 88, 32, $hDDC, $posx, $posy, 0x00CC0020) _WinAPI_DeleteDC($hCDC) Sleep(250) local $t2 = TimerInit() $result = Getnumber($result) Consolewrite("Time: " & TimerDiff($t2) & @crlf) Consolewrite("Result: " & $result & @crlf) While 1 Sleep(10) WEnd Func Getnumber($result) Local $code[4] = [0,0,0,0], $value = 64 DllCall('gdi32.dll', 'dword', 'GetBitmapBits', 'ptr', $capture, 'dword', DllStructGetSize($pixels), 'ptr', DllStructGetPtr($pixels)) For $loop = 1 To 2816 Step 440 $code[0] += DllStructGetData($pixels, 1, $loop ) > 4278190080 ? $value:0 $code[1] += DllStructGetData($pixels, 1, $loop+29) > 4278190080 ? $value:0 $code[2] += DllStructGetData($pixels, 1, $loop+58) > 4278190080 ? $value:0 $code[3] += DllStructGetData($pixels, 1, $loop+87) > 4278190080 ? $value:0 $value /= 2 Next ;~ consolewrite($code[0] & $code[1] & $code[2] & $code[3]) Return String($digit[$code[0]]) & String($digit[$code[1]]) & String($digit[$code[2]]) & String($digit[$code[3]]) EndFunc Func _exit() _GDIPlus_Shutdown() Exit EndFunc -
Another bitmap brute-forcing thread
junkew replied to Hashim's topic in AutoIt General Help and Support
And a small explainer on what @Werty is doing (I am off some pixels but I hope @Hashim get the concept as indicated by the red dots) Zoom in on the image to see the 28 pixels used for comparison and understanding why its important to have the screenshots exactly aligned. -
Another bitmap brute-forcing thread
junkew replied to Hashim's topic in AutoIt General Help and Support
4 digits is 10.000 numbers, why try 1,000,000 times? Speed optimization. Why? In general its fun to try in AutoIt but if speed is needed switch to a compiled language _WinAPI_HashString($stringforDigit,false,2) to get a 2 byte hash, easier to compare, no clue if its faster Most likely a boundary issue? 88*32 =2816 pixels then it depends on the goal of the for loop to 2816 with step 440 if you want to hit 7 or 8 bits 1 441 881 1321 1761 2201 2602 (3003) Not sure if 7 or 8 bits make a difference in the first column of a digit. I assume 7 would be enough to have 4 digits in 28 comparisons In my example demo code I scale down to 8x8 bits Why dinner first? 😉 ... -
Another bitmap brute-forcing thread
junkew replied to Hashim's topic in AutoIt General Help and Support
Just hover with au3inf over the window or control and post that info. It will help a lot if we know the name, type of control. -
Another bitmap brute-forcing thread
junkew replied to Hashim's topic in AutoIt General Help and Support
Your 2nd picture you can even see better you are off a few pixels as at the right I can see pixels of the digit thats not visible. -
Another bitmap brute-forcing thread
junkew replied to Hashim's topic in AutoIt General Help and Support
Your 4 is cut to early. Make sure your numbers all are same width. The matrix for 1 digit should fit 3 times for three numbers. -
Another bitmap brute-forcing thread
junkew replied to Hashim's topic in AutoIt General Help and Support
Regarding speed maybe it makes a difference with stretchblt directly going to a smaller size instead of bitblt Example for screenshot in a smaller size. #include <GDIPlus.au3> #include <ScreenCapture.au3> #include <WinAPI.au3> #include <WindowsConstants.au3> Func CaptureAndResize($savePath, $newWidth, $newHeight) ; GDI+ initialiseren _GDIPlus_Startup() ; Schermresolutie ophalen Local $iScreenWidth = @DesktopWidth Local $iScreenHeight = @DesktopHeight ; HDC's ophalen Local $hDC = _WinAPI_GetDC(0) Local $hMemDC = _WinAPI_CreateCompatibleDC($hDC) ; Bitmap maken Local $hBitmap = _WinAPI_CreateCompatibleBitmap($hDC, $iScreenWidth, $iScreenHeight) Local $hOldObj = _WinAPI_SelectObject($hMemDC, $hBitmap) ; Scherminhoud kopiëren met StretchBlt (resize mogelijk) _WinAPI_StretchBlt($hMemDC, 0, 0, $newWidth, $newHeight, $hDC, 0, 0, $iScreenWidth, $iScreenHeight, $SRCCOPY) ; Screenshot opslaan als bestand _ScreenCapture_SaveImage($savePath, $hBitmap) ; Opruimen _WinAPI_SelectObject($hMemDC, $hOldObj) _WinAPI_DeleteObject($hBitmap) _WinAPI_DeleteDC($hMemDC) _WinAPI_ReleaseDC(0, $hDC) _GDIPlus_Shutdown() EndFunc ; Gebruik de functie om een screenshot te maken en te resizen naar 800x600 CaptureAndResize(@UserProfileDir & "\downloads\examples\" & "screenshot_resized.jpg", 800, 600) -
Another bitmap brute-forcing thread
junkew replied to Hashim's topic in AutoIt General Help and Support
Cleaned up demo script Added some choices in the GUI to play around with understanding on whats happening with bits, bytes, string 8x8 resizing to compare less bits #include <GDIPlus.au3> #include <WinAPI.au3> #include <GUIConstants.au3> #include <WindowsConstants.au3> #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <ScreenCapture.au3> ;~ These are the magic bytes for the 8x8 resized image to identify the numbers 0-9 ;~ You can learn them by feeding 10 images having 0-9 at the 1 position (so 2nd character as first is a space global $digits[10] = [ _ '0x0002222002000022020002220200202002002020022000202200002000222200', _ '0x0000200000222000000020000000200000022000000200000002000000222200', _ '0x0002222002000022000000220000220000002200002000002200000022222220', _ '0x0002222002000022000000220000220000002200000000202200002000222200', _ '0x0000022000002200002202000200020002000200022222200000220000002200', _ '0x0222222202000000022222000000002000000020000000202200002000222200', _ '0x0000222000220000020000000222220002222200020000202200002000222200', _ '0x0222222200000022000002000000200000002000002000000020000000200000', _ '0x0002222002000022020000220022220000222200020000202200002000222200', _ '0x0002222002000022020000220022222200222220000000200000220000220000' _ ] local $charWidth=29 ;~Important as thats the width of te consecutive digits on screen ;~ Dont move the window during analysis as then the calculation of the matrix will be off as we dont recalculate every time dim $bmpData, $w, $h, $s dim $pic[10],$BitmapFilename, $hImage, $Bmp ; Initialize GDI+ library _GDIPlus_Startup() #Region ### START Koda GUI section ### Form= $frmCompare = GUICreate("Another bitmap brute-forcing thread", 1280, 768, 193, 125) ;~ Put all the pictures on screen for $picId=0 to 9 $BitmapFilename = @UserProfileDir & "\downloads\examples\" & string($picId) & ".png" $pBitmap = _GDIPlus_BitmapCreateFromFile($BitmapFilename) $hImage=_GDIPlus_ImageLoadFromFile($BitmapFilename) $Bmp = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage) ;~ $hBitmap = _GDIPlus_ImageLoadFromFile($BMPFile) $Pic[$picId] = GUICtrlCreatePic("", 32, 24+($picId*60), 100, 100, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS)) _WinAPI_DeleteObject(GUICtrlSendMsg($Pic[$picId], $STM_SETIMAGE, $iMAGE_BITMAP, $Bmp)) Next ;~ Box for analyzing showing the information $editBox = GuiCtrlCreateEdit("Analytics box", 450,14,700,750) GUICtrlSetFont($editBox, 8, 100, 0, "Courier New") Local $idLearnCheckbox = GUICtrlCreateCheckbox("Learn the digits", 44, 640, 125, 25) Local $idShowCheckbox = GUICtrlCreateCheckbox("Show the bits/highlight", 44, 672, 125, 25) Local $idSlowCheckbox = GUICtrlCreateCheckbox("Slow down", 44, 704, 95, 25) $ButtonAnalyze = GUICtrlCreateButton("Analyze", 44, 730, 75, 25, 0) $Button2 = GUICtrlCreateButton("Button2", 104, 730, 75, 25, 0) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### #region ### While the GUI ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE _GDIPlus_Shutdown() Exit Case $ButtonAnalyze analyse(_IsChecked($idLearnCheckbox), _IsChecked($idShowCheckbox), _IsChecked($idSlowCheckbox)) Case $Button2 EndSwitch WEnd #EndRegion Func _IsChecked($idControlID) Return BitAND(GUICtrlRead($idControlID), $GUI_CHECKED) = $GUI_CHECKED EndFunc ;==>_IsChecked func analyse($learnTheDigits=false, $showDigits=true, $slowDown=false) ;~ local $learnTheDigits=false ;~Use this to learn the 0-9 digit magic values ;~ local $showDigits=true ;~ For showing the bits in detail to show whats happening ;~ local $slowDown=false ;~ With or without sleep waiting local $charLow=1, $charHigh=1 ;~ For learning which areas to analyse WinActivate($frmCompare) Local $wPos = WinGetPos($frmCompare) ;~ $aArray[0] = X position $aArray[1] = Y position $aArray[2] = Width $aArray[3] = Height Local $aClientSize = WinGetClientSize($frmCompare) ;~ $aArray[0] = Width of window's client area $aArray[1] = Height of window's client area Local $cLeft= ($wpos[2]-$aClientSize[0])/2 Local $cTop= ($wPos[3]-$aClientSize[1])-2 Local $bytesPerDigit = 1 ;~ could be 1 or 2 or 3 bytes for $picId=0 to 9 Local $cPos = ControlGetPos ( $frmCompare, "", $pic[$picId] ) ;~ $aArray[0] = X position ;~ $aArray[1] = Y position ;~ $aArray[2] = Width ;~ $aArray[3] = Height if ($learnTheDigits = false) Then $charLow=0 $charHigh=5 EndIf for $charId=$charlow to $charHigh ;~ Calculate the matrix where the digit is based on the control where the picture is in, as absolute coordinates so window location also in the calculation local $leftMatrix=($charId*$charWidth)+$wpos[0]+$cLeft+$cPos[0] local $rightMatrix=$charWidth+($charId*$charWidth)+$wPos[0]+$cLeft+$cPos[0] local $topMatrix= $wPos[1] + $cTop +$cPos[1] + 10 local $bottomMatrix=$wPos[1] + $cTop + $cPos[1] + $cPos[3] -2 -11 local $x, $y Local $bytesDataForDigit="", $widthMatrix=0, $heightMatrix=0, $stride=0 ;~ Func GetImageDataFromScreen($left, $right, $top, $bottom, byref $BMPDataStart, byref $Width, byRef $Height, byref $Stride, $picIdmgBytes=3) ;~Play with this to take a smaller area GetImageDataFromScreen($leftMatrix, $topMatrix, $rightMatrix, $bottomMatrix, $bytesDataForDigit, $widthMatrix, $heightMatrix, $stride, $bytesPerDigit) ;~ consolewrite(BinaryLen($bytesDataForDigit) & " " & stringlen($bytesDataForDigit) & " " & $widthMatrix & "-" & $heightMatrix & "-" & $stride &@CRLF) local $stringForDigit=string($bytesDataForDigit) if ($learnTheDigits=true) then consolewrite("'" & $stringforDigit & "', _") Else $num=getNumber($stringForDigit) consolewrite($num) EndIf if ($showDigits=true) then showDigitInEditbox($stringForDigit, $heightMatrix, $stride) ;~ Not working propertly? ;~ local $checkSum=PixelChecksum($leftMatrix, $rightMatrix , $topMatrix, $bottomMatrix, 1, 0 ,1) ;~ Just draw a redbox around what we are analysing ;~ Minus 4 just as it influences the next screenshot _Screen_DrawRect( $leftMatrix, $rightMatrix-4 , $topMatrix, $bottomMatrix) if $SlowDown then SLEEP (100) EndIf Next consolewrite(@crlf) Next EndFunc func showDigitInEditbox($stringForDigit, $heightMatrix, $stride) local $textoutput $textOutput=stringmid($stringForDigit,3) $textOutput=StringRegExpReplace($textOutput,"[0-9a-z]{8}","$0"&@CRLF) $textOutput=StringReplace($textoutput,"0",".") ;~ $textOutput=StringRegExpReplace($textOutput,"[1-9A-Za-z]+","X") ControlSetText("","",$editBox,$textOutput) EndFunc func getNumber($stringForDigit) local $num=" " for $i=0 to 9 if ($digits[$i]=$stringForDigit) then return $i next return $num EndFunc Func GetImageDataFromScreen($left, $top, $right, $bottom, byref $BMPDataStart, byref $Width, byRef $Height, byref $Stride, $picIdmgBytes=3) local $Scan0, $pixelData, $hbScreen, $pBitmap, $pBitmapCap, $handle, $bitMapdata, $pixelFormat ; Capture screen to load the bitmap to search in ;~ _ScreenCapture_Capture(@UserProfileDir & "\downloads\examples\test.png",$left, $top, $right, $bottom,False) ;~ _ScreenCapture_Capture("",$left, $top, $right, $bottom,False) $hbScreen=_ScreenCapture_Capture("",$left, $top, $right, $bottom,False) local $pBitmap1 = _GDIPlus_BitmapCreateFromHBITMAP($hbScreen); returns memory bitmap _WinAPI_DeleteObject($hbScreen) ;release GDI bitmap resource because not needed anymore Local $pBitmap= _GDIPlus_ImageResize($pBitmap1, 8, 8) ;resize image ;~ Local $pBitmap= _GDIPlus_ImageResize($pBitmap1, 4, 4) ;resize image ;~ Local $pBitmap= _GDIPlus_ImageScale($pBitmap1, 0.15, 0.15) ;resize image ;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 or 1 byte local $iFormat=$GDIP_PXF16RGB555 if ($picIdmgBytes=1) then $iFormat=$GDIP_PXF04INDEXED if ($picIdmgBytes=2) then $iFormat=$GDIP_PXF16RGB555 if ($picIdmgBytes=3) then $iFormat=$GDIP_PXF24RGB $BitmapData= _GDIPlus_BitmapLockBits($pBitmap, 0, 0, _GDIPlus_ImageGetWidth($pBitmap), _GDIPlus_ImageGetHeight($pBitmap), $GDIP_ILMREAD, $iFormat) 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) & "]", $Scan0) $BMPDataStart = $BMPDataStart & DllStructGetData($pixeldata,"lData") _GDIPlus_BitmapUnlockBits($pBitmap, $BitmapData) _GDIPlus_ImageDispose ($pBitmap) _WinAPI_DeleteObject ($pBitmap) _WinAPI_DeleteObject ($hbScreen) EndFunc;==>GetImage ; Draw rectangle on screen. Func _Screen_DrawRect($tLeft, $tRight, $tTop, $tBottom, $color = 0xFF, $PenWidth = 1) Local $hDC, $hPen, $obj_orig, $x1, $x2, $y1, $y2 $x1 = $tLeft $x2 = $tRight $y1 = $tTop $y2 = $tBottom $hDC = _WinAPI_GetWindowDC(0) ; DC of entire screen (desktop) $hPen = _WinAPI_CreatePen($PS_SOLID, $PenWidth, $color) $obj_orig = _WinAPI_SelectObject($hDC, $hPen) _WinAPI_DrawLine($hDC, $x1, $y1, $x2, $y1) ; horizontal to right _WinAPI_DrawLine($hDC, $x2, $y1, $x2, $y2) ; vertical down on right _WinAPI_DrawLine($hDC, $x2, $y2, $x1, $y2) ; horizontal to left right _WinAPI_DrawLine($hDC, $x1, $y2, $x1, $y1) ; vertical up on left ; clear resources _WinAPI_SelectObject($hDC, $obj_orig) _WinAPI_DeleteObject($hPen) _WinAPI_ReleaseDC(0, $hDC) EndFunc ;==>_UIA_DrawRect