Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 01/22/2025 in all areas

  1. Hi @SEKOMD 👋 , chomium based browsers like Chrome or MSEdge are try to use a random port on opening (since ~Aug 2024). Googles explanation why they changed the behavior can be found here. You simply need the port in DriverParams to override the intended behavior to randomly find a available server port, by supplying the desired port number as a parameter. I guess this should be explanation enough, right 😀 ? Best regards Sven
    1 point
  2. Yes, and much more advantage if one knows the "bitmap" FILE ( ! ) format? Skip the first 54 bytes (file header) and you will find....the "pixels" aka image data pixelarray (depending on the 1/2/4/8/16/24/32 Bit per Pixel mode (see header...)). So no need to CreateBitmapFromFile() because a simple "open" file gives access to the pixel data array.... Go and get the first "line" of the bitmap (as a char-string) and search in the screenshot (transfer the screenshot-bytes into a char-array...others say "string") with StringInstr(). If the first line of the bitmap is found in the screenshot, the comparison of the next "line" in the bitmap with the next "line" in the screenshot is easy. Because the position of the text ( a char-array ist the same as a byte array) is known in the screenshot-"text", the comparison with the next "lines" is only a comparison of "text" (StringMid() is our friend) . I have written a few example scripts with this method to find a "bitmap in a bitmap". I have to look for them at the weekend Speed-challenge opened!
    1 point
  3. Now we are getting somewhere, updated version, got rid of gdiplus, no more bitmapcreatefromHbitmap or bitmaplockbits. Though I couldnt get screencapture_capture to work with it, need to experiment some more, so made my own. (I can only guess but I think there's something wrong with screencapture_capture function, the same problem i had earlier where I had to use bitmapclone) ;Be sure $posx and $posy is pointing at the correct spot! Global $posx = 1718, $posy = 699, $result = "", $code[3] ;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] ;Instead of screencapture_capture() $hDDC = _WinAPI_GetDC(0) $hCDC = _WinAPI_CreateCompatibleDC($hDDC) $hBmp = _WinAPI_CreateCompatibleBitmap($hDDC, 34, 20) _WinAPI_SelectObject($hCDC, $hBmp) _WinAPI_BitBlt($hCDC, 0, 0, 34, 20, $hDDC, $posx, $posy, 0x00CC0020) _WinAPI_DeleteDC($hCDC) $result = Getnumber($result) Func Getnumber($result) Local $code[3] = [0,0,0], $value = 64, $pixels = DllStructCreate('dword[680]') DllCall('gdi32.dll', 'dword', 'GetBitmapBits', 'ptr', $hBmp, 'dword', DllStructGetSize($pixels), 'ptr', DllStructGetPtr($pixels)) For $loop = 1 To 680 Step 102 $code[0] += DllStructGetData($pixels, 1, $loop ) = 4278255360 ? $value:0 $code[1] += DllStructGetData($pixels, 1, $loop+16) = 4278255360 ? $value:0 $code[2] += DllStructGetData($pixels, 1, $loop+32) = 4278255360 ? $value:0 $value /= 2 Next Return String($digit[$code[0]]) & String($digit[$code[1]]) & String($digit[$code[2]]) EndFunc And a runable example (needs pic from the zip earlier) #include <GDIPlus.au3> #include <WinAPI.au3> HotKeySet("{ESC}", "_exit") ;Be sure $posx and $posy is pointing at the correct spot! Global $posx = 1718, $posy = 699, $result = "", $code[3] ;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, -1, -1) GUISetState() WinWaitActive($gui); <--- necessary or screencapture fails _GDIPlus_Startup() $graphics = _GDIPlus_GraphicsCreateFromHWND($gui) $image = _GDIPlus_BitmapCreateFromFile("374.png") _GDIPlus_GraphicsDrawImageRect($graphics, $image, 280, 200, 136, 31) Sleep(10); <------- necessary because drawimagerect() is too slow, script occasionally fails without ;-------------------------------------------------------------- ;/Test section $time = TimerInit() ;Instead of screencapture_capture() $hDDC = _WinAPI_GetDC(0) $hCDC = _WinAPI_CreateCompatibleDC($hDDC) $hBmp = _WinAPI_CreateCompatibleBitmap($hDDC, 34, 20) _WinAPI_SelectObject($hCDC, $capture) _WinAPI_BitBlt($hCDC, 0, 0, 34, 20, $hDDC, $posx, $posy, 0x00CC0020) _WinAPI_DeleteDC($hCDC) $result = Getnumber($result) Consolewrite("Result: " & $result & " Time: " & TimerDiff($time)/1000 & @crlf) While 1 Sleep(10) WEnd Func Getnumber($result) Local $code[3] = [0,0,0], $value = 64, $pixels = DllStructCreate('dword[680]') DllCall('gdi32.dll', 'dword', 'GetBitmapBits', 'ptr', $hBmp, 'dword', DllStructGetSize($pixels), 'ptr', DllStructGetPtr($pixels)) For $loop = 1 To 680 Step 102 $code[0] += DllStructGetData($pixels, 1, $loop ) = 4278255360 ? $value:0 $code[1] += DllStructGetData($pixels, 1, $loop+16) = 4278255360 ? $value:0 $code[2] += DllStructGetData($pixels, 1, $loop+32) = 4278255360 ? $value:0 $value /= 2 Next Return String($digit[$code[0]]) & String($digit[$code[1]]) & String($digit[$code[2]]) EndFunc Func _exit() _GDIPlus_Shutdown() Exit EndFunc I guess it should be faster now, please test and report back. /edit Btw, if you are loading alot of images from disk then make sure they are in uncompressed .bmp format, it takes up more space on the drive but it's faster than png, doesnt have to be decompressed as png does, Atleast 5-10% faster using bmp, especially with that many pics.
    1 point
  4. multithreading has the same semaphore issues to keep in mind as forking. Not a big difference in complexity.
    1 point
  5. Maybe someone will invent multithreading 😉 for this problem
    1 point
  6. .. I told him about forking but it may be too much too soon. Eventually he'll come to desire the idea and jump on it
    1 point
  7. Melba23

    New MVPs

    I am sure all members will wish to join me in welcoming our new MVPs: argumentum and gianni. It has been a while since the last promotions, but it goes to show that helping out around here does get noticed! M23
    1 point
  8. ... and I want people to refrain from joining and posting this shit in a forum that has nothing to do with it !
    1 point
  9. Brostafa

    Show/Hide password

    Hello, I've created a GUI with 2 inputs/buttons and 1 checkbox(check the picture below). The password input is hidden with asterisk signs. I want to show the password whenever the checkbox is checked. Here's my code: #include <GUIConstants.au3> #include <EditConstants.au3> GUICreate("My First Gui", 245, 130) GUICtrlCreateLabel("E-mail", 5, 13) $userInput = GUICtrlCreateInput("", 40, 11, 200, "") GUICtrlCreateLabel("Pass", 5, 47) $passInput = GUICtrlCreateInput("", 40, 43, 200, "") $checkBox = GUICtrlCreateCheckbox("Show Password", 40, 70) $logButton = GUICtrlCreateButton("Login", 190, 100, 50) $alrButton = GUICtrlCreateButton("Already Logged", 5, 100, 100) GUISetState() While 1 Switch GUIGetMsg() Case $checkBox If GUICtrlRead($checkBox) = $GUI_CHECKED Then GUICtrlSetStyle($passInput, default) Else GUICtrlSetStyle($passInput, $ES_PASSWORD) EndIf Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd The problem is with this line GUICtrlSetStyle($passInput, default) isn't working. I don't want to copy input data, delete the input box, create an input box and paste the old data into it. So, I was looking if there's another solution to avoid doing that? P.S: I've read through the help file/read forums/searched on google for about an hour with no luck and I'm new to AutoIt.
    1 point
  10. BrewManNH

    Show/Hide password

    Try here
    1 point
  11. Melba23

    Show Password box

    SeverMessage, There certainly is an easier way: #include <GUIConstantsEx.au3> #include <EditConstants.au3> Global $PassStart = IniRead("Config.ini", "Config", "Password", "Default Value") $hGUI = GUICreate("Test", 500, 500) $cInput = GUICtrlCreateInput("", 10, 10, 200, 20, BitOR($GUI_SS_DEFAULT_INPUT, $ES_PASSWORD)) $cCheck = GUICtrlCreateCheckbox("Show Password", 10, 50, 150, 20) GUICtrlSetData($cInput, $PassStart) GUISetState() ;Retrieve the ASCII value of the default password char $sDefaultPassChar = GUICtrlSendMsg($cInput, $EM_GETPASSWORDCHAR, 0, 0) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $cCheck If GUICtrlRead($cCheck) = $GUI_CHECKED Then GUICtrlSendMsg($cInput, $EM_SETPASSWORDCHAR, 0, 0) GUICtrlSetData($cCheck, "Show Password") Else GUICtrlSendMsg($cInput, $EM_SETPASSWORDCHAR, $sDefaultPassChar, 0) GUICtrlSetData($cCheck, "Hide Password") EndIf GUICtrlSetState($cInput, $GUI_FOCUS) EndSwitch WEndPlease ask if you have any questions. M23
    1 point
×
×
  • Create New...