Jump to content

Werty

Active Members
  • Posts

    1,198
  • Joined

  • Last visited

  • Days Won

    40

Werty last won the day on March 16

Werty had the most liked content!

Profile Information

  • Member Title
    ♥ 96.7k
  • Location
    Danmark

Recent Profile Visitors

2,406 profile views

Werty's Achievements

  1. It's usually called "Strike(through)", not "Stripe", and maybe put an Underline under the characters in the bmp's that can be ctrl'ed, and maybe put a lowercase "u" in front of "uLine". It looks nice, havent tried it though, cant be bothered installing fonts nor compile it as exe. Btw, please put all the files in a folder before zipping, so people dont have to create a folder in their examples scripts folder themselfes.
  2. You're saying it works with VB6, then make a VB6 EXE or DLL that you can channel it through 😛 Your AU3 script sending the request to a VB6 exe/dll, which then calls the xyzdecrypt.dll and then send the result back to your AU3 script. Just as a last resort ofcourse. however it's done in VB6, dunno VB6.
  3. In SciTE go to Options and Open User Options File and add this... ## Scite start position and size position.left=50 position.top=50 position.width=2450 position.height=1250 ...and change to your likings. You can change many things, here's how my user options file look... # User defined key commands user.shortcuts=\ # Ctrl+Shift+V|IDM_PASTEANDDOWN|\ #Ctrl+PageUp|IDM_PREVFILE|\ #Ctrl+PageDown|IDM_NEXTFILE|\ KeypadMinus|IDM_BLOCK_COMMENT|\ Ctrl+F1|IDM_HELP_SCITE| ## Scite start position and size position.left=50 position.top=50 position.width=2450 position.height=1250 split.vertical=0 # open new tab instead of new window check.if.already.open=1 # default linewrap wrap=0 # default statusbar visibility statusbar.visible=1 # clears output window before executing clear.before.execute=1 # default output window location. 0=bottom, 1=side output.initial.hide=0 # at open, load previously open files from close save.session=1 # set default zoom level magnification=1 # set default directory to last opened script open.dialog.in.file.directory=1 # show line numbers line.margin.visible=1 style.au3.32=style.*.32=$(font.base),back:#FFFFFF font.base=font:Courier New,size:10,$(font.override) font.small=font:Courier New,size:8,$(font.override) font.monospace=font:Courier New,size,size:12 indent.size=4 indent.size.*.au3=4 use.tabs=1 caret.line.back=#FFFEBF selection.fore=#006000 selection.alpha=50 selection.back=#EA7783 style.au3.34=fore:#0000FF,back:#FFFFFF style.au3.35=fore:#009933,back:#FFFFFF style.au3.0=fore:#000000,back:#FFFFFF style.au3.1=fore:#008000,italics,back:#FFFFFF style.au3.2=fore:#669900,back:#FFFFFF style.au3.3=fore:#0000FF,back:#FFFFFF style.au3.4=fore:#000090,back:#FFFFFF style.au3.5=fore:#0000FF,back:#FFFFFF style.au3.6=fore:#FF33FF,back:#FFFFFF style.au3.7=fore:#FF0000,back:#FFFFFF style.au3.8=fore:#FF0000,back:#FFFFFF style.au3.9=fore:#AA0000,back:#FFFFFF style.au3.10=fore:#FF8800,back:#FFFFFF style.au3.11=fore:#F000FF,back:#FFFFFF style.au3.12=fore:#A00FF0,back:#FFFFFF style.au3.13=fore:#FF0000,back:#FFFFFF style.au3.14=fore:#0000FF,back:#FFFFFF style.au3.15=fore:#0080FF,back:#FFFFFF
  4. Updated version, and a possible solution to get the faster version running with tool.exe. Arrays are slow in AutoIt, strings are fast, so got rid of the arrays... #include <GDIPlus.au3> #include <WinAPI.au3> HotKeySet("{ESC}", "_exit") ;Be sure $posx and $posy is pointing at the correct spot! Global $posx = 37+16, $posy = 38+16 , $result = "", $code1, $code2, $code3, $code4, $capture, $pixels = DllStructCreate('dword[2816]') ;Lookup table to avoid searching Global $lookup = "1000000000004000000000000000006000320000000000009000008000000000700000000000000000000000000000000000000000000000005" ;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("3.png") _GDIPlus_GraphicsDrawImageRect($graphics, $image, 16, 16, 176, 56) ;-------------------------------------------------------------- ;/Test section $hDDC = _WinAPI_GetWindowDC($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_ReleaseDC($gui, $hDDC) ; <----NOTICE _WinAPI_DeleteDC($hCDC) $result = Getnumber($result) Consolewrite("Result: " & $result & @crlf) While 1 Sleep(10) WEnd Func Getnumber($result) Local $value = 64, $code1 = 0, $code2 = 0, $code3 = 0, $code4 = 0 DllCall('gdi32.dll', 'dword', 'GetBitmapBits', 'ptr', $capture, 'dword', DllStructGetSize($pixels), 'ptr', DllStructGetPtr($pixels)) For $loop = 1 To 2816 Step 440 $code1 += DllStructGetData($pixels, 1, $loop ) > 4278190080 ? $value:0 $code2 += DllStructGetData($pixels, 1, $loop+29) > 4278190080 ? $value:0 $code3 += DllStructGetData($pixels, 1, $loop+58) > 4278190080 ? $value:0 $code4 += DllStructGetData($pixels, 1, $loop+87) > 4278190080 ? $value:0 $value /= 2 Next Return StringMid($lookup, $code1+1, 1) & StringMid($lookup, $code2+1, 1) & StringMid($lookup, $code3+1, 1) & StringMid($lookup, $code4+1, 1) EndFunc Func _exit() _GDIPlus_Shutdown() Exit EndFunc As for the possible solution to get it to work with tool.exe, notice the "NOTICE" in above script, in the helpfile under GetWindowDC() it says... We may have been lucky that it worked at all with our gui as the gui is OWNED by us, so leaving out ReleaseDC() worked, but we dont OWN the tool.exe, so maybe try including the ReleaseDC(), you would have to put all the WinAPI stuff back into the loop, but as you said earlier, they are pretty fast as you saw no big changes in speed putting them outside the loop. it was the bitblt that required more time as we used the whole desktop that took time.
  5. Try with _WinAPI_GetFileSizeEx(), maybe there's a difference.
  6. Have you tried using Opt("GUIOnEventMode", 1) ? Gui Reference in the helpfile, at the bottom "Gui Event Modes". https://www.autoitscript.com/autoit3/docs/guiref/GUIRef.htm
  7. Oh, didnt know my code was complicated, thanks for letting me know.
  8. @junkew, I fixed your script, I tried and tried with no result until I noticed you changed GetWindowDC() back to GetDC(), that doesnt work, it has to be GetWindowDC(). (though I have no idea why getdc($gui) doesnt work, I agree it should work somehow, I tried adding $CAPTUREBLT to the bitblt, with no result) #include <GDIPlus.au3> #include <WinAPI.au3> HotKeySet("{ESC}", "_exit") ;Be sure $posx and $posy is pointing at the correct spot! Global $posx = 37+16, $posy = 38+16 , $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("3.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($gui) ;~ $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
  9. @junkew, yes, the posx and posy must be EXACTLY on the correct spot (red pixel).
  10. Here's the pic from the first thread.... Imagine the first column of each number is a BYTE, with Most Significant Bit being 128, then 64, 32 16 8 4 2 1, we dont need the 128 as each number is only 7 imaginary bits tall, then the loop starts at the top left corner and reads the first bit, if it's lit it adds $value=64 to $code[0], if unlit nothing is added, then the next DllStructGetData reads the next number, and so on, when it gets to the end (last number) then $value is divided by 2 so it's 32 which is the next significant bit and the STEP in the loop goes to next line/bit, if it finds any lit bits it adds $value to $code, and so on.... The $code's now have values, which we then look up in the lookup table, like 114 is 5, the last in the lookup as it's the largest number, while 4 is located at 12'th place.
  11. It's actually including all four, the fourth is just only the first column of that number, as that is all we need. I'll see, as i promised in the other thread, about making a short tutorial/explanation of how it works, this time I promise I will get it done.....after dinner.
  12. Very sure If needed/wanted I can post one of my test examples later where you can see it works, right now I have to make dinner, so I'll be in and out for the next couple of hours.
  13. Hmm, the image you posted is one pixel off, should look like this... That said, I dont have much experience with automation, I use autoit for other things, so I might have assumed wrong that WinWaitActive should give the correct handle to the tools windows, try something like $tools = WinGetHandle(blablabla) or something, as the script should give you atleast other result than 1111 when you are so close. Test yourself how to get the correct handle to the tools windows, or have someone with more automation experience chime in. I get my handle to my test gui where it works like this.... $gui = GUICreate("Getnumber", 320, 240, -1, -1) Maybe something like this... $hTool = Run("tool.exe") ;and then change the GetWindowDC accordingly.
  14. HAHA, major speed increase, we've been doing it wrong, we've been using _WinAPI_GetDC(0) all the time which is the whole desktop, when we should have been using _WinAPI_GetWindowDC() instead, it's now like 5 times faster for me as it went from the whole desktop @3440x1440 to the test gui I've been using @640x480, and speed increased dramatically. Changes to make... $hDDC = _WinAPI_GetDC(0) ;should be $hDDC = _WinAPI_GetWindowDC($tool) ;Change $posx and $posy to point at the correct spot, this is now not from the desktop 0,0 but from the tools.exe windows start position. So speed increase depends on the size of the tools.exe window, maybe you can even resize it to be smaller. Times i get now for full cycle with bitblt and all... 0.5085 0.5136 1.3745 0.5044 0.4402 0.4155 0.9733 Try it and report back with times, it's awesome.
  15. I already tried that with my method, with no good result, to much information is lost no matter how i tried resizing it, tried all the filters and different sizes, but maybe it'll work using another method, like checksum as you mentioned earlier, and stuffed in a lookup table Though, my method already only reads 28 times, so it would have to be resized to something smaller than 28 pixels in a square to be faster. Putting a timer into my GetNumber() function i get insanely fast times like... Func Getnumber($result) $t2 = TimerInit() 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("Time: " & TimerDiff($t2) & @crlf) Return String($digit[$code[0]]) & String($digit[$code[1]]) & String($digit[$code[2]]) & String($digit[$code[3]]) EndFunc Time: 0.0582 Time: 0.0583 Time: 0.0804 Time: 0.0641 Time: 0.0816 Time: 0.0582 Time: 0.0581 it's the other stuff that takes longer, here times I get for a full run. 6.0095 6.9233 6.9252 6.8122 7.2931 6.7959 6.9708 ..with the bitblt stuff. Maybe later I'll try making the getnumber() func into a C Dll, though with only 28 checks it's hardly gonna be worth it. 😛
×
×
  • Create New...