Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 11/10/2024 in Posts

  1. #include <GUIConstants.au3> #include <GuiEdit.au3> Example() Func Example() GUICreate("Test Suggestion", 300, 100) Local $idButton = GUICtrlCreateButton("OK", 10, 70, 100, 20) Local $input = GUICtrlCreateInput("", 10, 10, 280, 30) _GUICtrlEdit_SetCueBanner($input, "suggested content...") GUISetState() While True Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd EndFunc ;==>Example
    1 point
  2. 1st try (58) : ==> Array variable has incorrect number of subscripts or subscript dimension range exceeded. do i have to do something? Edit: ok now it works. Now I have to understand how it works? @DesktopWidth x @DesktopHeight = 1920x1080 Global $posx = 958, $posy = 499, $result = ""
    1 point
  3. Yup, ~2 milliseconds on my pc, and that's without the fancy rotating stuff. The basics #include <GDIPlus.au3> #include <ScreenCapture.au3> ;Be sure $posx and $posy is pointing at the correct spot! Global $posx = 1718, $posy = 699, $result = "" ;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] $capture = _ScreenCapture_Capture("", $posx, $posy, $posx+34, $posy+20) $bitmap = _GDIPlus_BitmapCreateFromHBITMAP($capture); for some reason createfromhbitmap is not a fully compatible gdiplus bitmap $clone = _GDIPlus_BitmapCloneArea($bitmap, 0, 0, 34, 20, $GDIP_PXF32ARGB); so we have to do this before it works correctly _GDIPlus_BitmapDispose($bitmap) Func Getnumber($result) Local $code[3] = [0,0,0], $value = 64 $bitmap1 = _GDIPlus_BitmapLockBits($clone, 0, 0, 34, 20, BitOR($GDIP_ILMWRITE, $GDIP_ILMREAD), $GDIP_PXF32ARGB) $pixels = DllStructCreate("dword[" & 680 & "];", DllStructGetData($bitmap1, "Scan0")) 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 _GDIPlus_BitmapUnlockBits($clone, $bitmap1) Return String($digit[$code[0]]) & String($digit[$code[1]]) & String($digit[$code[2]]) EndFunc And a runable script (zipped folder with script and test images attached) #include <GDIPlus.au3> #include <ScreenCapture.au3> HotKeySet("{ESC}", "_exit") ;Be sure $posx and $posy is pointing at the correct spot! Global $posx = 1718, $posy = 699, $result = "" ;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("518.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() $capture = _ScreenCapture_Capture("", $posx, $posy, $posx+34, $posy+20) $bitmap = _GDIPlus_BitmapCreateFromHBITMAP($capture); for some reason createfromhbitmap is not a fully compatible gdiplus bitmap $clone = _GDIPlus_BitmapCloneArea($bitmap, 0, 0, 34, 20, $GDIP_PXF32ARGB); so we have to do this before it works correctly _GDIPlus_BitmapDispose($bitmap) $result = Getnumber() Consolewrite("Result: " & $result & " Time: " & TimerDiff($time)/1000 & @crlf) While 1 Sleep(10) WEnd Func Getnumber() Local $code[3] = [0,0,0] $bitmap1 = _GDIPlus_BitmapLockBits($clone, 0, 0, 34, 20, BitOR($GDIP_ILMWRITE, $GDIP_ILMREAD), $GDIP_PXF32ARGB) $pixels = DllStructCreate("dword[" & 680 & "];", DllStructGetData($bitmap1, "Scan0")) $value = 64 For $loop = 1 To 680 Step 102 $code[0] += BitAnd(BitShift(DllStructGetData($pixels, 1, $loop ), 8), 1) = 1 ? $value:0 $code[1] += BitAnd(BitShift(DllStructGetData($pixels, 1, $loop+16), 8), 1) = 1 ? $value:0 $code[2] += BitAnd(BitShift(DllStructGetData($pixels, 1, $loop+32), 8), 1) = 1 ? $value:0 $value /= 2 Next $result = String($digit[$code[0]]) & String($digit[$code[1]]) & String($digit[$code[2]]) $code = 0 _GDIPlus_BitmapUnlockBits($clone, $bitmap1) Return $result EndFunc Func _exit() _GDIPlus_Shutdown() Exit EndFunc Not much code it takes. I havent checked for memoryleaks and stuff, too tired now, if you spot anyting please tell. Be sure to change the $posx and $posy to point at the correct spot, as it is now it fits a 3440x1440 monitor. (you can comment out line 56 that gives error so you can take a screenshot to find the correct spot) /edit Changed, zip not updated Changed again, $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 getnumber.zip
    1 point
  4. Post edited: I did see the * -1 part (and didn't expect it), just the > 0 caught my (olding) eyes.
    1 point
  5. rudi

    "Windows Security Warning"

    Hi. maybe https://support.microsoft.com/en-au/office/enable-activex-controls-in-internet-explorer-04774c30-617d-4de4-a028-0fe03d68b955 ? what is the result, when you do in a CMD box a ... dir c:\path\to\my\helpfile.chm /r is the result presenting alternate data streams in your chm file? C:\Install>dir c:\install\helpfile.chm /r Volume in Laufwerk C: hat keine Bezeichnung. Volumeseriennummer: 9450-A869 Verzeichnis von c:\install 24.11.2023 14:54 5.282.424 helpfile.chm 129 helpfile.chm:Zone.Identifier:$DATA 1 Datei(en), 5.282.424 Bytes 0 Verzeichnis(se), 105.914.585.088 Bytes frei C:\Install>
    1 point
  6. erik7426

    Input Box Return value

    Try this instead.... Dim $firstname $firstname = InputBox("First Name", "What is your first name?", "", " M", -1, -1);<---- The " M" (The space before the M is important) forces input. OK can't be clicked until something is entered. If @error = 1 Then MsgBox(0,"","Cancel was clicked") Exit EndIf MsgBox(1,"Testing",$firstname)
    1 point
×
×
  • Create New...