Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 01/09/2023 in all areas

  1. Gianni

    Writing hand

    This simple code snippet simulates a writing hand as you type into any input field (hand follows caret) P.S. I don't know what it's for, but I'll post it anyway. .... One possible use would be to draw attention to a message. (such as what I posted here: https://www.autoitscript.com/forum/topic/209396-3202-sraey-wen-yppah/?do=findComment&comment=1510993) Have fun #include <GUIConstants.au3> #include <GDIPlus.au3> Global $iWidth = 100, $iHeight = 70, $iPosX = -1, $iPosY = -1, $aCaretPos, $msg Global $iHandMoves = 2, $iAmplitude = 5, $iHideHidleDelay = 1000, $iFlag = True, $iTimer Global Const $hGUI = GUICreate('', $iWidth, $iHeight, $iPosX, $iPosY, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_TOPMOST, $WS_EX_NOACTIVATE)) Global Const $idLogo = GUICtrlCreatePic("", 0, 0, $iWidth, $iHeight) _GDIPlus_Startup() Global $Bmp_Logo = _GDIPlus_BitmapCreateFromMemory(_WritingHand(), True) _WinAPI_DeleteObject(GUICtrlSendMsg($idLogo, $STM_SETIMAGE, $IMAGE_BITMAP, $Bmp_Logo)) $Bmp_Logo = '' _GDIPlus_Shutdown() While True $aCaretPos = _WinGetCaretPos() If @extended Then $iTimer = TimerInit() $iFlag = True If Not @error Then GUISetState(@SW_SHOWNOACTIVATE, $hGUI) _MoveHand($aCaretPos) EndIf EndIf If $iFlag And (TimerDiff($iTimer) > $iHideHidleDelay) Then GUISetState(@SW_HIDE, $hGUI) $iFlag = False EndIf Sleep(250) WEnd Func _MoveHand($aCaretPos) For $i = 1 To $iHandMoves WinMove($hGUI, '', $aCaretPos[0] + Random(-$iAmplitude, $iAmplitude, 1), $aCaretPos[1] + Random(-$iAmplitude, $iAmplitude, 1), Default, Default, 1) Next WinMove($hGUI, '', $aCaretPos[0], $aCaretPos[1]) EndFunc ;==>_MoveHand ; A more reliable method to retrieve the caret coordinates in MDI Func _WinGetCaretPos() Local Static $iXAdjust = -5, $iYAdjust = -5, $aPrevPos[2] = [0, 0] Local $iOpt = Opt("CaretCoordMode", 0) ; Set "CaretCoordMode" to relative mode and store the previous option. Local $aGetCaretPos = WinGetCaretPos() ; Retrieve the relative caret coordinates. Local $aGetPos = WinGetPos("[ACTIVE]") ; Retrieve the position as well as height and width of the active window. Local $sControl = ControlGetFocus("[ACTIVE]") ; Retrieve the control name that has keyboard focus. Local $aControlPos = ControlGetPos("[ACTIVE]", "", $sControl) ; Retrieve the position as well as the size of the control. $iOpt = Opt("CaretCoordMode", $iOpt) ; Reset "CaretCoordMode" to the previous option. Local $aReturn[2] = [0, 0] ; Create an array to store the x, y position. If IsArray($aGetCaretPos) And IsArray($aGetPos) And IsArray($aControlPos) Then $aReturn[0] = $aGetCaretPos[0] + $aGetPos[0] + $aControlPos[0] + $iXAdjust $aReturn[1] = $aGetCaretPos[1] + $aGetPos[1] + $aControlPos[1] + $iYAdjust ; Check if caret has moved If ($aReturn[0] <> $aPrevPos[0]) Or ($aReturn[1] <> $aPrevPos[1]) Then $aPrevPos[0] = $aReturn[0] $aPrevPos[1] = $aReturn[1] SetError(0, 1) ; if caret has moved set @Extended EndIf Return $aReturn ; Return the array Else Return SetError(1, 0, $aReturn) ; Return the array and set @error to 1. EndIf EndFunc ;==>_WinGetCaretPos ;Code below was generated by: 'File to Base64 String' Code Generator v1.20 Build 2020-06-05 Func _WritingHand($bSaveBinary = False, $sSavePath = @ScriptDir) Local $WritingHand $WritingHand &= 'R0lGODlhZABGAHAAACH5BAEAAP8ALAAAAABkAEYAhwAAAAAAMwAAZgAAmQAAzAAA/wArAAArMwArZgArmQArzAAr/wBVAABVMwBVZgBVmQBVzABV/wCAAACAMwCAZgCAmQCAzACA/wCqAACqMwCqZgCqmQCqzACq/wDVAADVMwDVZgDVmQDVzADV/wD/AAD/MwD/ZgD/mQD/zAD//zMAADMAMzMAZjMAmTMAzDMA/zMrADMrMzMrZjMrmTMrzDMr/zNVADNVMzNVZjNVmTNVzDNV/zOAADOAMzOAZjOAmTOAzDO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pClF4kgvREkGHygxZcHvhhlbkalItcP51eqDimsW/OC1okV0iBG7KE0Vj0Y4vmGRixWU2+bMNCAXltCBMGFfnpzUrHlpbBFQAtwYO5Y1GbYEi5OQWAhZyMZaSMmNDdwa91oisSUN8IZSzI2kDMa8/6EPjvbzISPhxsU8Rik0JMTeMrRnFMp9UJMrU6EUwRglSfZpLs3LWs7k4pie8aIXF8NYHdHES/TocI+AggZnFKktltjSlhibIhg71CdTLRN4WSMl02qlpEYCEV4yIpiMPOnMWBJDe+mTi/3M+C4m1bGIm0uPqSyZPneUklh0sWYQiVi1RZRQGUtrxxLngoQoVPKiSGXq3w1feMksaUuDx2QSS87ZP6sk8ZusgiNMPmLLcgZUfPQi6DySlEF9Hcl+WHTixJbnrHvOMhmsoqYmbZkJq+ASaMpKouRQypm7geRIyUIlI/d3PZkqMWffVGkc4/jDivbCpwPRxzALFU6E1oWfxhQiFpEqOY5mSqjGPKU1AwIAOw==' Local $bString = _WinAPI_Base64Decode($WritingHand) If @error Then Return SetError(1, 0, 0) Return Binary($bString) EndFunc ;==>_WritingHand Func _WinAPI_Base64Decode($sB64String) Local $aCrypt = DllCall("Crypt32.dll", "bool", "CryptStringToBinaryA", "str", $sB64String, "dword", 0, "dword", 1, "ptr", 0, "dword*", 0, "ptr", 0, "ptr", 0) If @error Or Not $aCrypt[0] Then Return SetError(1, 0, "") Local $bBuffer = DllStructCreate("byte[" & $aCrypt[5] & "]") $aCrypt = DllCall("Crypt32.dll", "bool", "CryptStringToBinaryA", "str", $sB64String, "dword", 0, "dword", 1, "struct*", $bBuffer, "dword*", $aCrypt[5], "ptr", 0, "ptr", 0) If @error Or Not $aCrypt[0] Then Return SetError(2, 0, "") Return DllStructGetData($bBuffer, 1) EndFunc ;==>_WinAPI_Base64Decode
    2 points
  2. Hi folks, @jugador: Your example is pretty nice, thank you 👍 . I don't have the same use case as @mutleey has, but I can definitely use this. @Nine: Thank you too for your example 😀 . @mutleey: I am looking forward how your result will look like, best of luck for it. Best regards Sven
    2 points
  3. basic structure (msgbox list not coded.... ) #include <GUIConstantsEx.au3> #include <EditConstants.au3> #include <WindowsConstants.au3> #include <WinAPI.au3> #include <Array.au3> MsgBox(0, '', '1) Create your virtual keyboard' & @Crlf & _ '2) disable all key' & @Crlf & _ '3) loop [Enable Key List....] to enable/disable required key' & @Crlf & _ '4) press enter to display desired item' ) Global $aKeyWords = __Get_Words() Global $input1, $input2 __ExampleA() Func __ExampleA() Local $hGUI = GUICreate("Filter key", 300, 150) GUICtrlCreateLabel("> Input....", 10, 10) GUICtrlCreateLabel("> Enable Key List....", 10, 75) $input1 = GUICtrlCreateInput("", 10, 35, 280, 25) $input2 = GUICtrlCreateInput('', 10, 100, 280, 30) GUICtrlSetFont($input2, 11) GUICtrlSetState($input2, $GUI_DISABLE) GUICtrlSetData($input2, StringUpper(_ArrayToString(__Get_Char($aKeyWords), ' | ') & @Tab & '(' & __News(GUICtrlRead($input1)) & ')')) GUISetState(@SW_SHOW, $hGUI) GUIRegisterMsg($WM_COMMAND, "WM_COMMAND") While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd GUIDelete($hGUI) EndFunc Func WM_COMMAND($hWnd, $iMsg, $wParam, $lParam) If _WinAPI_LoWord($wParam) = $input1 And _WinAPI_HiWord($wParam) = $EN_CHANGE Then Local $k_newList = '' $k_newList = _ArrayToString(__Get_Char($aKeyWords, GUICtrlRead($input1)), ' | ') & @Tab & '(' & __News(GUICtrlRead($input1)) & ')' GUICtrlSetData($input2, StringUpper($k_newList)) EndIf EndFunc Func __Get_Words() Local $aKeyWords[] = ["fight", "first", "fly", "third", "fire", "wall", "hi", "high", "hello", "world", "win", "winwait", "winclose"] Return _ArrayToString($aKeyWords, '|') EndFunc Func __News($oWord) Local $aItems[] = ["fly high", "Butterfly", "is linux better than window", "win xp", "win 7", "win 10", _ "world cup football 2022", "World Peace Day September 21, 2023", "Autoit winwait", "Autoit winclose"] If $oWord = '' Then Return UBound($aItems) Local $aCount = 0 For $i = 0 To UBound($aItems) - 1 If StringInStr($aItems[$i], $oWord) Then $aCount += 1 Next Return $aCount EndFunc Func __Get_Char($oString, $oLetter = '') If IsArray($oString) Then Return SetError(1) Local $iAlphabet = (($oLetter = '') ? _ StringRegExpReplace($oString, '^(\S)|(\|\S)|(\s|\w+)', '$1$2') : _ StringRegExpReplace($oString, '\b' & $oLetter & '(.)|(\s|\w+)', '$1')) $iAlphabet = StringRegExpReplace($iAlphabet, '[\|]+', '|') Local $i_Alphabet = StringRegExp($iAlphabet, '([^|\s])(?!.*\1)', 3) If StringRegExp($iAlphabet, '\s', 0) Then ReDim $i_Alphabet[UBound($i_Alphabet) + 1] $i_Alphabet[UBound($i_Alphabet) - 1] = '{SPACE}' EndIf If ($oLetter <> '') And StringRegExp($oString, '\b' & $oLetter & '\b', 0) Then IF IsArray($i_Alphabet) Then ReDim $i_Alphabet[UBound($i_Alphabet) + 1] $i_Alphabet[UBound($i_Alphabet) - 1] = '{ENTER}' Else Local $i_Alphabet[1] = ['{ENTER}'] EndIf EndIf Return $i_Alphabet EndFunc
    2 points
  4. Since you're dealing with login information, you might consider using a password manager instead of storing the username/password in plain text in a file. I personally use KeePass with AutoIt and have a UDF that I put together to easily use it. See my signature for a link if you're interested
    1 point
  5. MattyD

    Midi UDF

    Thanks guys for the support - very much appreciate it! Congrats Peter on Peace too, it looks amazing
    1 point
  6. They need either be somwhere in your %PATH% environment or in the executable's folder.
    1 point
  7. lbsl

    Telegram Bot UDF

    There were enough issues with the original UDF, not only this but also other false interpretations taken from the Telegram API that made this UDF not really reliable. Not all the fault of the designer, the API chronological behavior wasn't all too clear either.
    1 point
  8. Here my take on your request. Instead of using your keyboard, I have use a hook that disables unauthorized keys. #include <Constants.au3> #include <GUIConstants.au3> #include <WinAPISys.au3> #include <WinAPIConstants.au3> #include <WinAPIProc.au3> #include <Array.au3> Opt("MustDeclareVars", True) Global $aKeyWords[] = ["fight", "first", "fly", "third", "fire", "wall", "hi", "high", "hello", "world", "window", _ "window 1", "window 2", "window 3", "window 4", "window 5", "window 6", "window 7", "window 8", "window 9", "window 10"] Global $aAllowedChar = EnumerateChar(1, $aKeyWords) Global $hHook, $idList, $idDummy, $bAllowed Local $sSelected = SelectWord() MsgBox($MB_SYSTEMMODAL, "You have selected", $sSelected) Func SelectWord() Local $hGui = GUICreate("Select Word") $idList = GUICtrlCreateInput("", 10, 10, 100, 20) $idDummy = GUICtrlCreateDummy() Local $idKey = GUICtrlCreateDummy() Local $hStub = DllCallbackRegister(WH_KEYBOARD, "LRESULT", "int;wparam;lparam") $hHook = _WinAPI_SetWindowsHookEx($WH_KEYBOARD, DllCallbackGetPtr($hStub), 0, _WinAPI_GetCurrentThreadId()) Local $aAccelKeys[1][2] = [["{ENTER}", $idKey]] GUISetAccelerators($aAccelKeys) GUIRegisterMsg($WM_COMMAND, WM_COMMAND) GUISetState() Local $aWordsLeft = $aKeyWords, $sWordSelected While True Switch GUIGetMsg() Case $GUI_EVENT_CLOSE $sWordSelected = "" ExitLoop Case $idDummy $aWordsLeft = WordsLeft(GUICtrlRead($idList), $aKeyWords) _ArrayDisplay($aWordsLeft) If UBound($aWordsLeft) = 1 Then $sWordSelected = $aWordsLeft[0] ExitLoop EndIf $aAllowedChar = EnumerateChar(StringLen(GUICtrlRead($idList)) + 1, $aWordsLeft) ;_ArrayDisplay($aAllowedChar) Case $idKey $sWordSelected = GUICtrlRead($idList) ExitLoop EndSwitch WEnd GUIDelete($hGui) _WinAPI_UnhookWindowsHookEx($hHook) DllCallbackFree($hStub) Return $sWordSelected EndFunc Func WH_KEYBOARD($iMsg, $wParam, $lParam) ;ConsoleWrite("wm_keyb " & Chr($wParam) & "/" & Hex($wParam, 2) & "/" & $wParam & @CRLF) If $iMsg = 0 And $wParam <> 27 And $wParam <> 8 And $wParam <> 13 Then $bAllowed = _ArraySearch($aAllowedChar, Chr($wParam)) >= 0 If Not $bAllowed Then Return 1 EndIf Return _WinAPI_CallNextHookEx($hHook, $iMsg, $wParam, $lParam) EndFunc ;==>MyProc Func WM_COMMAND($hWnd, $iMsg, $wParam, $lParam) Local $iIDFrom = _WinAPI_LoWord($wParam) Local $iCode = _WinAPI_HiWord($wParam) If $iIDFrom = $idList And $iCode = $EN_CHANGE And $bAllowed Then GUICtrlSendToDummy($idDummy) Return $GUI_RUNDEFMSG EndFunc ;==>_WM_COMMAND Func EnumerateChar($iLen, ByRef $aList) Local $aChar[UBound($aList)] For $i = 0 To UBound($aList) - 1 $aChar[$i] = StringMid($aList[$i], $iLen, 1) Next Return $aChar EndFunc Func WordsLeft($sInclude, ByRef $aList) Local $aLeft = _ArrayFindAll($aList, "^" & $sInclude, Default, Default, Default, 3) For $i = 0 To UBound($aLeft) - 1 $aLeft[$i] = $aList[$aLeft[$i]] Next Return $aLeft EndFunc
    1 point
  9. Real virtual treeviews In first part of Virtual treeviews, only the number of child items for a given node/parent was specified. When only the number of child items is specified, these items must appear in a continuous and uninterrupted row of child items. And only one item can be a node/parent, namely the last one in the row. To work around this limitation, it's necessary to specify child item lists instead of just the number of child items. For each node/parent a list is needed that for each child item indicates the row number in the source file where information about this child item can be found. Thus the source file must also contain information about these child item lists. All code is located in the folder Examples\Part 2\1) Real Virtual TreeViews. Simple example (1) Simple\) Show the two treeviews by double-clicking TVSourceDisplayPlain.au3 and TVSourceDisplayVirtual.au3. This source file is sufficient for a plain or semi-virtual treeview (3 levels, 5 items, Plain.txt) 00|Item0 01|Item1 02|Item2 01|Item3 00|Item4 In a plain treeview texts are stored in the item structures. In a semi-virtual treeview texts are virtual and stored only in the source file. Therefore, a semi-virtual treeview is faster to create than a plain treeview. For both types, the treeview structure is created when the treeview is created. In a virtual treeview, more information is needed (3 levels, 5 items, Virtual.txt) 00| | 7| |Item0 01| 0| 1| |Item1 02| 1| | |Item2 01| 0| | |Item3 00| | | |Item4 Level 0 parents and items = 2 0:1|3| 4: Level 1 parents = 1 0|5 0:7|2 1:11|1 A virtual treeview means a true virtual treeview where all child items and texts are virtual. Information about child items and texts is stored in the source file. Only root items (first level items) are created when the treeview is created. Because the number of root items is usually low, it's very fast to create a virtual treeview. The actual treeview item information at top of the source file is a |-separated list with 5 fields: 1 Treeview item level 2 Row number in source file containing parent item 3 Row number in source file containing child item list 4 Indication of expanded parent 5 Treeview item text The information at bottom of the source file is divided into several sections. There is a section for "Level 0 parents and items", "Level 1 parents", "Level 2 parents", etc. The very last section is a summary section. Level 0 parents and items = 2 The child item list for Item0 (at level 0 = first level = root level) is found in row 7 (zero-based) in the source file. Data in row 7 is 0:1|3|. 0 is the row number where the list is used. 1|3| is the child item list itself. Item0 has 2 direct childs in rows 1 and 3. Data in row 8 is 4:. Item4 in row 4 is a root item without any childs. Level 1 parents = 1 Since the current treeview has 3 levels (level 0, 1 and 2 zero-based), a node/parent at level 1 (second last level) can only have ordinary child items (ie. no nodes/parents). Row 1 in the source file contains a level 1 node/parent. Because the child items are ordinary child items, it's enough to indicate the number of child items. The node/parent in row 1 has 1 child item. This number is stated directly in field 3 instead of the row number for the child item list. Since no child item lists are needed for level 1 (second last level) nodes/parents, the section named "Level 1 parents = 1" is empty. Level 2 parents Because there are only 3 levels, there are no node/parent items at level 2 (zero-based). There are only child items. No child lists for "Level 2 parents". Summary section The lines at bottom of the source file is a summary section. 0|5 means that the actual treeview item information starts in row 0 and includes 5 rows. 0:7|2 means that child item lists for level 0 starts in row 7 and includes 2 rows. 1:11|1 means that child item lists for level 1 starts in row 11 and includes 1 row. But as mentioned above, it's not necessary to specify child item lists for second last level. The last line in the source file 1:11|1 is instead used to calculate the total number of levels. The number of levels is the number before : plus 1. In this case 2 levels (1+1=2 (zero-based)). TVSourceFile.au3 (Includes\TVSourceFile.au3) TVSourceFile.au3 is a so far incomplete version of a UDF to handle treeview source files. This is the function list at top of the file: ; Functions ; --------------------------------- ; TVSourceCreatePlain() Create random plain source file for non-virtual treeview ; TVSourceCreatePlainDbg() Create random plain source file for non-virtual treeview. Debug version. ; TVSourceCreatePlainEx() Based on recursive function with support for 100 levels ; TVSourceCreatePlainExDbg() Based on recursive function with support for 100 levels. Debug version. ; TVSourceCreatePlainExConst() Create constant plain source file for non-virtual treeview. Debug version. Constant source file. ; TVSourceCreatePlainExConstCount() Count number of treeview items generated by TVSourceCreatePlainExConst() above ; TVSourceCreateVirtual() Create random source file for virtual treeview ; TVSourceCreateVirtualDbg() Create random source file for virtual treeview. Debug version. Contains code comments. <<<<<<<<<< ; ; TVSourceConvertPlainToVirtual() Convert plain source file for non-virtual treeview to source file for virtual treeview ; TVSourceConvertVirtualToPlain() Convert source file for virtual treeview to plain source file for non-virtual treeview ; ; TVSourceDisplayPlain() Display non-virtual treeview from plain source file ; TVSourceDisplayVirtual() Display virtual treeview from source file The functions TVSourceCreatePlain(), TVSourceCreatePlainDbg(), TVSourceCreateVirtual() and TVSourceCreateVirtualDbg() are implemented through loops that can generate source files and thus treeviews with up to 10 levels. The Ex-functions TVSourceCreatePlainEx(), TVSourceCreatePlainExDbg() and TVSourceCreatePlainExConst() are based on recursive functions that can generate source files with up to 100 levels. The Dbg- and Const-functions contain debug information in the item texts in the form of an indication of whether an item is a node/parent or a plain item as well as row index in source file and treeview. The other functions generate random item texts. All functions except TVSourceCreatePlainExConst() generate random treeview structures with a random number of items. True virtual treeviews are limited to 10,000,000 items. TVSourceCreatePlainExConst() generates a constant treeview in such a way that the same input parameters will always result in the same treeview. TVSourceCreatePlainExConstCount() calculates the number of items in these treeviews. TVSourceConvertPlainToVirtual() and TVSourceConvertVirtualToPlain() convert back and forth between plain and virtual treeviews. Due to a complicated structure of a source file for a virtual treeview, it's difficult to update the treeview by editing the source file. The idea is to first convert the virtual file to a plain file. Then update the plain source file. And finally convert back to a virtual file. TVSourceDisplayPlain() and TVSourceDisplayVirtual() display treeviews in a GUI. Function examples (2) Sources\) 2) Sources\ contains examples of the use of each function. Run the examples in SciTE with F5. Treeview source files are stored in the Sources\ top folder. These are the examples for TVSourceCreatePlainExConst() and TVSourceCreatePlainExConstCount(). 4) TVSourceCreatePlainExConst.au3: #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 #AutoIt3Wrapper_UseX64=Y Opt( "MustDeclareVars", 1 ) #include "..\Includes\TVSourceFile.au3" Global $sSources = "..\..\..\..\Sources\" ; With many levels and thus many treeview items, it can take some time to generate the source file. It may also ; take a long time to create the entire structure for a non-virtual treeview before it can be displayed in the GUI. ConsoleWrite( "TVSourceCreatePlainExConst( 6, 4, 4, ...) Creating..." & @CRLF ) If TVSourceCreatePlainExConst( 6, 4, 4, $sSources & "6 levels, 26,071 items, Plain, debug, const.txt" ) Then ConsoleWrite( "TVSourceCreatePlainExConst( 6, 4, 4, ...) Displaying..." & @CRLF ) If Not TVSourceDisplayPlain( $sSources & "6 levels, 26,071 items, Plain, debug, const.txt" ) Then _ ConsoleWrite( "TVSourceDisplayPlain: @error = " & @error & @CRLF ) Else ConsoleWrite( "TVSourceCreatePlainExConst: @error = " & @error & @CRLF ) EndIf 5) TVSourceCreatePlainExConstCount.au3: #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 #AutoIt3Wrapper_UseX64=Y Opt( "MustDeclareVars", 1 ) #include "..\Includes\TVSourceFile.au3" Example() Func Example() Local $iItems0, $iCount For $iLevels = 1 To 10 For $iMultiplier = 2 To 10 For $iItems = 1 To 10 $iItems0 = $iItems * $iMultiplier If Not TVSourceCreatePlainExConstCount( $iLevels, $iItems0, $iMultiplier, $iCount ) Then ConsoleWrite( "TVSourceCreatePlainExConstCount: @error = " & @error & " " & _ StringFormat( "%3i, %3i, %3i", $iLevels, $iItems0, $iMultiplier ) & @CRLF ) ExitLoop EndIf ConsoleWrite( "$iLevels, $iItems0, $iMultiplier, $iCount = " & _ StringFormat( "%3i, %3i, %3i, %8i", $iLevels, $iItems0, $iMultiplier, $iCount ) & @CRLF ) Next Next Next EndFunc This is the last part of the output: $iLevels, $iItems0, $iMultiplier, $iCount = 7, 2, 2, 6787 $iLevels, $iItems0, $iMultiplier, $iCount = 7, 4, 2, 13574 $iLevels, $iItems0, $iMultiplier, $iCount = 7, 6, 2, 20361 $iLevels, $iItems0, $iMultiplier, $iCount = 7, 8, 2, 27148 $iLevels, $iItems0, $iMultiplier, $iCount = 7, 10, 2, 33935 $iLevels, $iItems0, $iMultiplier, $iCount = 7, 12, 2, 40722 $iLevels, $iItems0, $iMultiplier, $iCount = 7, 14, 2, 47509 $iLevels, $iItems0, $iMultiplier, $iCount = 7, 16, 2, 54296 $iLevels, $iItems0, $iMultiplier, $iCount = 7, 18, 2, 61083 $iLevels, $iItems0, $iMultiplier, $iCount = 7, 20, 2, 67870 $iLevels, $iItems0, $iMultiplier, $iCount = 7, 3, 3, 52145 $iLevels, $iItems0, $iMultiplier, $iCount = 7, 6, 3, 104290 $iLevels, $iItems0, $iMultiplier, $iCount = 7, 9, 3, 156435 $iLevels, $iItems0, $iMultiplier, $iCount = 7, 12, 3, 208580 $iLevels, $iItems0, $iMultiplier, $iCount = 7, 15, 3, 260725 $iLevels, $iItems0, $iMultiplier, $iCount = 7, 18, 3, 312870 $iLevels, $iItems0, $iMultiplier, $iCount = 7, 21, 3, 365015 $iLevels, $iItems0, $iMultiplier, $iCount = 7, 24, 3, 417160 $iLevels, $iItems0, $iMultiplier, $iCount = 7, 27, 3, 469305 $iLevels, $iItems0, $iMultiplier, $iCount = 7, 30, 3, 521450 $iLevels, $iItems0, $iMultiplier, $iCount = 7, 4, 4, 227671 $iLevels, $iItems0, $iMultiplier, $iCount = 7, 8, 4, 455342 $iLevels, $iItems0, $iMultiplier, $iCount = 7, 12, 4, 683013 $iLevels, $iItems0, $iMultiplier, $iCount = 7, 16, 4, 910684 $iLevels, $iItems0, $iMultiplier, $iCount = 7, 20, 4, 1138355 $iLevels, $iItems0, $iMultiplier, $iCount = 7, 24, 4, 1366026 $iLevels, $iItems0, $iMultiplier, $iCount = 7, 28, 4, 1593697 $iLevels, $iItems0, $iMultiplier, $iCount = 7, 32, 4, 1821368 $iLevels, $iItems0, $iMultiplier, $iCount = 7, 36, 4, 2049039 $iLevels, $iItems0, $iMultiplier, $iCount = 7, 40, 4, 2276710 $iLevels, $iItems0, $iMultiplier, $iCount = 7, 5, 5, 741169 $iLevels, $iItems0, $iMultiplier, $iCount = 7, 10, 5, 1482338 $iLevels, $iItems0, $iMultiplier, $iCount = 7, 15, 5, 2223507 $iLevels, $iItems0, $iMultiplier, $iCount = 7, 20, 5, 2964676 $iLevels, $iItems0, $iMultiplier, $iCount = 7, 25, 5, 3705845 $iLevels, $iItems0, $iMultiplier, $iCount = 7, 30, 5, 4447014 $iLevels, $iItems0, $iMultiplier, $iCount = 7, 35, 5, 5188183 $iLevels, $iItems0, $iMultiplier, $iCount = 7, 40, 5, 5929352 $iLevels, $iItems0, $iMultiplier, $iCount = 7, 45, 5, 6670521 $iLevels, $iItems0, $iMultiplier, $iCount = 7, 50, 5, 7411690 $iLevels, $iItems0, $iMultiplier, $iCount = 7, 6, 6, 1999691 $iLevels, $iItems0, $iMultiplier, $iCount = 7, 12, 6, 3999382 $iLevels, $iItems0, $iMultiplier, $iCount = 7, 18, 6, 5999073 $iLevels, $iItems0, $iMultiplier, $iCount = 7, 24, 6, 7998764 $iLevels, $iItems0, $iMultiplier, $iCount = 7, 30, 6, 9998455 TVSourceCreatePlainExConstCount: @error = 2 7, 36, 6 $iLevels, $iItems0, $iMultiplier, $iCount = 7, 7, 7, 4724257 $iLevels, $iItems0, $iMultiplier, $iCount = 7, 14, 7, 9448514 TVSourceCreatePlainExConstCount: @error = 2 7, 21, 7 TVSourceCreatePlainExConstCount: @error = 2 7, 8, 8 TVSourceCreatePlainExConstCount: @error = 2 7, 9, 9 TVSourceCreatePlainExConstCount: @error = 2 7, 10, 10 $iLevels, $iItems0, $iMultiplier, $iCount = 8, 2, 2, 52147 $iLevels, $iItems0, $iMultiplier, $iCount = 8, 4, 2, 104294 $iLevels, $iItems0, $iMultiplier, $iCount = 8, 6, 2, 156441 $iLevels, $iItems0, $iMultiplier, $iCount = 8, 8, 2, 208588 $iLevels, $iItems0, $iMultiplier, $iCount = 8, 10, 2, 260735 $iLevels, $iItems0, $iMultiplier, $iCount = 8, 12, 2, 312882 $iLevels, $iItems0, $iMultiplier, $iCount = 8, 14, 2, 365029 $iLevels, $iItems0, $iMultiplier, $iCount = 8, 16, 2, 417176 $iLevels, $iItems0, $iMultiplier, $iCount = 8, 18, 2, 469323 $iLevels, $iItems0, $iMultiplier, $iCount = 8, 20, 2, 521470 $iLevels, $iItems0, $iMultiplier, $iCount = 8, 3, 3, 455345 $iLevels, $iItems0, $iMultiplier, $iCount = 8, 6, 3, 910690 $iLevels, $iItems0, $iMultiplier, $iCount = 8, 9, 3, 1366035 $iLevels, $iItems0, $iMultiplier, $iCount = 8, 12, 3, 1821380 $iLevels, $iItems0, $iMultiplier, $iCount = 8, 15, 3, 2276725 $iLevels, $iItems0, $iMultiplier, $iCount = 8, 18, 3, 2732070 $iLevels, $iItems0, $iMultiplier, $iCount = 8, 21, 3, 3187415 $iLevels, $iItems0, $iMultiplier, $iCount = 8, 24, 3, 3642760 $iLevels, $iItems0, $iMultiplier, $iCount = 8, 27, 3, 4098105 $iLevels, $iItems0, $iMultiplier, $iCount = 8, 30, 3, 4553450 $iLevels, $iItems0, $iMultiplier, $iCount = 8, 4, 4, 2223511 $iLevels, $iItems0, $iMultiplier, $iCount = 8, 8, 4, 4447022 $iLevels, $iItems0, $iMultiplier, $iCount = 8, 12, 4, 6670533 $iLevels, $iItems0, $iMultiplier, $iCount = 8, 16, 4, 8894044 TVSourceCreatePlainExConstCount: @error = 2 8, 20, 4 $iLevels, $iItems0, $iMultiplier, $iCount = 8, 5, 5, 7998769 TVSourceCreatePlainExConstCount: @error = 2 8, 10, 5 TVSourceCreatePlainExConstCount: @error = 2 8, 6, 6 TVSourceCreatePlainExConstCount: @error = 2 8, 7, 7 TVSourceCreatePlainExConstCount: @error = 2 8, 8, 8 TVSourceCreatePlainExConstCount: @error = 2 8, 9, 9 TVSourceCreatePlainExConstCount: @error = 2 8, 10, 10 $iLevels, $iItems0, $iMultiplier, $iCount = 9, 2, 2, 455347 $iLevels, $iItems0, $iMultiplier, $iCount = 9, 4, 2, 910694 $iLevels, $iItems0, $iMultiplier, $iCount = 9, 6, 2, 1366041 $iLevels, $iItems0, $iMultiplier, $iCount = 9, 8, 2, 1821388 $iLevels, $iItems0, $iMultiplier, $iCount = 9, 10, 2, 2276735 $iLevels, $iItems0, $iMultiplier, $iCount = 9, 12, 2, 2732082 $iLevels, $iItems0, $iMultiplier, $iCount = 9, 14, 2, 3187429 $iLevels, $iItems0, $iMultiplier, $iCount = 9, 16, 2, 3642776 $iLevels, $iItems0, $iMultiplier, $iCount = 9, 18, 2, 4098123 $iLevels, $iItems0, $iMultiplier, $iCount = 9, 20, 2, 4553470 $iLevels, $iItems0, $iMultiplier, $iCount = 9, 3, 3, 4447025 $iLevels, $iItems0, $iMultiplier, $iCount = 9, 6, 3, 8894050 TVSourceCreatePlainExConstCount: @error = 2 9, 9, 3 TVSourceCreatePlainExConstCount: @error = 2 9, 4, 4 TVSourceCreatePlainExConstCount: @error = 2 9, 5, 5 TVSourceCreatePlainExConstCount: @error = 2 9, 6, 6 TVSourceCreatePlainExConstCount: @error = 2 9, 7, 7 TVSourceCreatePlainExConstCount: @error = 2 9, 8, 8 TVSourceCreatePlainExConstCount: @error = 2 9, 9, 9 TVSourceCreatePlainExConstCount: @error = 2 9, 10, 10 $iLevels, $iItems0, $iMultiplier, $iCount = 10, 2, 2, 4447027 $iLevels, $iItems0, $iMultiplier, $iCount = 10, 4, 2, 8894054 TVSourceCreatePlainExConstCount: @error = 2 10, 6, 2 TVSourceCreatePlainExConstCount: @error = 2 10, 3, 3 TVSourceCreatePlainExConstCount: @error = 2 10, 4, 4 TVSourceCreatePlainExConstCount: @error = 2 10, 5, 5 TVSourceCreatePlainExConstCount: @error = 2 10, 6, 6 TVSourceCreatePlainExConstCount: @error = 2 10, 7, 7 TVSourceCreatePlainExConstCount: @error = 2 10, 8, 8 TVSourceCreatePlainExConstCount: @error = 2 10, 9, 9 TVSourceCreatePlainExConstCount: @error = 2 10, 10, 10 @error = 2 means that more than 10,000,000 items are generated. New 7z-file at bottom of first post.
    1 point
  10. FYI, I wrote a function to handle this when I was previously working on the webdriver BiDi implementation. I just submitted this PR, which adds _WD_GetFreePort to wd_helper. Feel free to test and provide feedback. Also, do you think it would be good to have it default to a predefined range if the min/max values aren't supplied? Edit: This has been merged into the main branch and will be included in the next release.
    1 point
  11. Zedna

    Disable ComboBox editing

    Technically the most correct is to use $GUI_SS_DEFAULT_COMBO style as noted in Helpfile for GUICtrlCreateCombo(). So instead of GUICtrlCreateCombo ("", 2, 2, 100, 20, $CBS_DROPDOWNLIST) You should use GUICtrlCreateCombo ("", 2, 2, 100, 20, BitOR($GUI_SS_DEFAULT_COMBO, $CBS_DROPDOWNLIST)) and in this case there will be also vertical scrollbar which is included in $GUI_SS_DEFAULT_COMBO (among other default styles)
    1 point
×
×
  • Create New...