Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 04/14/2025 in Posts

  1. I created this UDF for JSON using JSON-C because I needed high performance parsing of JSON data in my script. I needed to query large data arrays of several thousand entries and other UDFs were taking many seconds to do so. With this UDF a query of 5,000 array entries takes me about 600ms (see Example2.au3). This UDF executes JSON functions through a JSON-C DLL to achieve better performance. The JSON-C project is https://github.com/json-c/json-c. To download this UDF please visit https://github.com/seanhaydongriffin/JsonC-UDF. Two examples are provided (Example1.au3 and Example2.au3) that demonstrate all the functions.
    3 points
  2. You caught me while I was in the PM section Gonna have a look at it and let you know later, see ya. @TheAutomator i tried your code, it works fine when you scroll by dragging the thumb. Now the thumb moves up or down while you drag it, which was a missing feature as noted by WildByDesign. Well done.
    1 point
  3. @pixelsearch Found some time to make a simple example to wrap my head around the example you gave me I managed to boil it down to the code below for testing. Gonna skip resizing the tumb and double clicks for this test, do you see any flaws in the test scrollbar I made? The thing I did diffirently is how to handle the WM_COMMAND message to prevent it setting the tumb location twice while dragging the tumb: if $Scrolling then Return $GUI_RUNDEFMSG #include <GUIConstantsEx.au3> #include <GuiRichEdit.au3> #include <Misc.au3> #include <SendMessage.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> Local $s For $i = 1 To 100 $s &= 'Line ' & $i & @crlf Next AutoItSetOption('MouseCoordMode', 2) ; 2 = relative coords to the client area of the active window $Form = GUICreate('Form', 294, 432, 2034, 330) $Text = GUICtrlCreateLabel(0, 0, 0, 200, 17) $Edit = _GUICtrlRichEdit_Create($Form, $s, 120, 70, 100, 270, BitOR($es_multiline, $es_autovscroll, $es_nohidesel), 0) _GUICtrlRichEdit_SetScrollPos($Edit, 0, 0) $Bar = GUICtrlCreateLabel('', 70, 70, 40, 270, $SS_BLACKRECT) $Tumb = GUICtrlCreateLabel('', 70, 70, 40, 80, $SS_GRAYRECT) GUISetState(@SW_SHOW) ;----------------------------------------------- $BarX = 70 $BarY = 70 $BarWidth = 40 $BarHeight = 270 $TumbX = 70 $TumbY = 70 $TumbHeight = 80 $TumbMax = $BarY + $BarHeight - $TumbHeight $TumbPercent = 0 $EditHeight = 270 $LineFirst = 0 $LineLast = 0 $LineCount = 0 $LineVisible = 0 $LineTop = 0 $EditPercent = 0 $MouseY = 0 $Scrolling = False ;----------------------------------------------- func MouseOnTumb() local $MouseXY = MouseGetPos() Return $MouseXY[0] >= $BarX and $MouseXY[0] <= $BarX + $BarWidth and $MouseXY[1] >= $BarY and $MouseXY[1] <= $BarY + $BarHeight EndFunc GUIRegisterMsg($WM_COMMAND, WM_COMMAND) Func WM_COMMAND($hWnd, $iMsg, $wParam, $lParam) if $Scrolling then Return $GUI_RUNDEFMSG If $lParam = $Edit Then If BitShift($wParam, 16) = $EN_UPDATE Then UpdateTumbPosition() EndIf Return $GUI_RUNDEFMSG EndFunc Func UpdateTumbPosition() $LineFirst = _GUICtrlRichEdit_GetNumberOfFirstVisibleLine($Edit) $LineLast = _GUICtrlRichEdit_GetLineNumberFromCharPos($Edit, _GUICtrlRichEdit_GetCharPosFromXY($Edit, 1, $EditHeight)) $LineCount = _GUICtrlRichEdit_GetLineCount($Edit) $LinesVisible = $LineLast - $LineFirst + 1 ; count last visible line too (+1) $MaxScroll = $LineCount - $LinesVisible If $MaxScroll <= 0 Then $EditPercent = 0 Else $EditPercent = ($LineFirst - 1) / $MaxScroll EndIf GUICtrlSetData($text, $EditPercent) $TumbY = $BarY + $EditPercent * ($BarHeight - $TumbHeight) GUICtrlSetPos($Tumb, $TumbX, $TumbY) EndFunc Func UpdateEditPosition() $MouseY = MouseGetPos(1) $TumbY = $MouseY - $TumbHeight / 2 If $TumbY < $BarY Then $TumbY = $BarY If $TumbY > $TumbMax Then $TumbY = $TumbMax GUICtrlSetPos($Tumb, $TumbX, $TumbY) $TumbPercent = ($TumbY - $BarY) / ($TumbMax - $BarY) GUICtrlSetData($Text, $TumbPercent) $LineFirst = _GUICtrlRichEdit_GetNumberOfFirstVisibleLine($Edit) $LineLast = _GUICtrlRichEdit_GetLineNumberFromCharPos($Edit, _GUICtrlRichEdit_GetCharPosFromXY($Edit, 1, $EditHeight)) $LineCount = _GUICtrlRichEdit_GetLineCount($Edit) $LinesVisible = $LineLast - $LineFirst $LineTop = $TumbPercent * ($LineCount - $LinesVisible) + 1 _GUICtrlRichEdit_ScrollLines($Edit, $LineTop - $LineFirst) EndFunc ;----------------------------------------------- While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE _GUICtrlRichEdit_Destroy($Edit) GUIDelete($Form) Exit Case $gui_event_primarydown if MouseOnTumb() then $Scrolling = True Case $gui_event_mousemove if $Scrolling then UpdateEditPosition() Case $gui_event_primaryup $Scrolling = False EndSwitch WEnd
    1 point
  4. Thank you ioa747. That worked!
    1 point
  5. TheSaint

    Kobo Cover Fixer

    Latest update now available, see the first post. Okay, as I was waking today, it suddenly occurred to me that I had missed a very obvious improvement. This was a Dropzone for quick and easy renaming and copying of a cover image file, in preparation for the main usage of my program. So after pondering on how best to do that, with limited GUI space, I did the following ... optionally repurposed the 'Cover Image' preview field. To do that, you need to enable it via a checkbox on the 'Settings' window. So basically I did the following. That means another level of automation, making things quicker and less fiddly etc. Enjoy!
    1 point
×
×
  • Create New...