Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 03/06/2024 in all areas

  1. @Viter Try to use modified version
    2 points
  2. I have given code to ChatGPT and asked it to look for issues. You pretty much have do one thing at a time, ask it if it can be improved, etc. I no longer have any examples but I've had ChatGPT do modifications I wouldn't have thought of by myself. Also I have it write code for me that I can't be bothered with because it gets in the way of my birds eye view of the program.
    2 points
  3. [BUGFIX VERSION] - 6 Apr 24 Fixed: UDF failed if header colours were initialised but not specifically set. New UDF in the zip below. -------------------------------------------------------------------------------------- Note: This is a new recoded and expanded version of my earlier UDF of the same name. If you move to this new version there might well be several script-breaking changes, particularly when setting which columns are to be editable. Please read the "Beginner's Guide" and look at the included example scripts to see where things have changed. -------------------------------------------------------------------------------------- This UDF allows you to do much more with ListView controls (either native or UDF created): Edit the content with plain text, combos or date-time pickers - and edit the headers too Move rows within the ListView Drag rows both within the ListView and to other ListViews in the same GUI (or not as required) Insert and delete columns and rows Sort columns by simply clicking the header Colour individual ListView items and headers Only select a single cell rather then the entire row Save and load entire ListViews For the advanced user: If you use certain Windows message handlers (In particular WM_NOTIFY) in your script, please read the function headers for the equivalent handlers within the UDF. Here is the UDF, with 6 examples and the guide, in zip format: GUIListViewEx.zip Credit to: martin (basic drag code), Array.au3 authors (array functions), KaFu and ProgAndy (font function), LarsJ (colouring code) Happy to take compliments or criticism - preferably the former! M23
    1 point
  4. As discussed here: I created a DLL (x86 and x64) to do a file compare like the FC.exe does (only binary comparison!) but filling up the memory which can be read out by Autoit. UDF _WinAPI_FileCompare.au3: ;Version v0.70 build 2024-03-23 beta #include-once ; #FUNCTION# ==================================================================================================================== ; Name ..........: _WinAPI_FileCompareBinaryString ; Description ...: Reads two files into the memory and compares them byte by byte. Result is saved in the memory. ; Syntax ........: _WinAPI_FileCompareBinaryString($sFile1, $sFile2, Byref $tMemArray) ; Parameters ....: $sFile1 - first file to read. ; $sFile2 - second file to read. ; $tMemArray - a ptr dll struct which holds a ptr entry which is filled by the DLL. ; Return values .: Number of unequal bytes found in both files otherwise negative value on error. ; Author ........: UEZ ; Modified ......: ; Remarks .......: The memory pointer $tMemArray must be released using _MemGlobalFree() which holds the pointer to the result. ; The result contains hex string values (offset, file1, file2) from the differences between the two files. ; Large memory consumption for files > 80 MB as everything is kept in memory! ; Related .......: ; Link ..........: https://www.autoitscript.com/forum/index.php?showtopic=211619 ; Example .......: No ; =============================================================================================================================== Func _WinAPI_FileCompareBinaryString($sFile1, $sFile2, ByRef $tMemArray) If Not FileExists($sFile1) Then Return SetError(-10, 0, 0) If Not FileExists($sFile2) Then Return SetError(-20, 0, 0) If Not FileGetSize($sFile1) Then Return SetError(-30, 0, 0) If Not FileGetSize($sFile2) Then Return SetError(-40, 0, 0) If Not IsDllStruct($tMemArray) Then Return SetError(-50, 0, 0) Local $aReturn = DllCall(@AutoItX64 ? "_WinAPI_FileCompare_x64.dll" : "_WinAPI_FileCompare.dll", "int64", "_WinAPI_FileCompareBinaryString", "str", $sFile1, "str", $sFile2, "struct*", $tMemArray) If @error Then Return SetError(-60, 0, 0) If $aReturn[0] < 0 Then SetError($aReturn[0], 0, 0) Return $aReturn[0] EndFunc ;==>_WinAPI_FileCompareBinaryString ; #FUNCTION# ==================================================================================================================== ; Name ..........: _WinAPI_FileCompareBinary ; Description ...: Reads two files into the memory and compares them byte by byte. Result is saved in the memory. ; Syntax ........: _WinAPI_FileCompareBinary($sFile1, $sFile2, Byref $tMemArray) ; Parameters ....: $sFile1 - first file to read. ; $sFile2 - second file to read. ; $tMemArray - a ptr dll struct which holds a ptr entry which is filled by the DLL. ; Return values .: Number of unequal bytes found in both files otherwise negative value on error. ; Author ........: UEZ ; Modified ......: ; Remarks .......: The memory pointer $tMemArray must be released using _MemGlobalFree() which holds the pointer to the result. ; The result contains integer values (offset, file1, file2) from the differences between the two files. ; Large memory consumption as everything is kept in memory but 1/3 less than _WinAPI_FileCompareBinaryString. ; Related .......: ; Link ..........: https://www.autoitscript.com/forum/index.php?showtopic=211619 ; Example .......: No ; =============================================================================================================================== Func _WinAPI_FileCompareBinary($sFile1, $sFile2, ByRef $tMemArray) If Not FileExists($sFile1) Then Return SetError(-10, 0, 0) If Not FileExists($sFile2) Then Return SetError(-20, 0, 0) If Not FileGetSize($sFile1) Then Return SetError(-30, 0, 0) If Not FileGetSize($sFile2) Then Return SetError(-40, 0, 0) If Not IsDllStruct($tMemArray) Then Return SetError(-50, 0, 0) Local $aReturn = DllCall(@AutoItX64 ? "_WinAPI_FileCompare_x64.dll" : "_WinAPI_FileCompare.dll", "int64", "_WinAPI_FileCompareBinary", "str", $sFile1, "str", $sFile2, "struct*", $tMemArray) If @error Then Return SetError(-60, 0, 0) If $aReturn[0] < 0 Then SetError($aReturn[0], 0, 0) Return $aReturn[0] EndFunc ;==>_WinAPI_FileCompareBinary ; #FUNCTION# ==================================================================================================================== ; Name ..........: _WinAPI_FileComparePrint ; Description ...: Reads two files into the memory and compares them byte by byte. Result will be printed to the console only. ; Syntax ........: _WinAPI_FileComparePrint($sFile1, $sFile2[, $bUnbuffered = False]) ; Parameters ....: $sFile1 - first file to read. ; $sFile2 - second file to read. ; $bUnbuffered - [optional] a boolean value. Default is False. If $bUnbuffered then file will be read ; byte by byte and result will be displayed, otherwise both files will be read into the ; memory and then compared. ; Return values .: 1 if successfull, otherwise 0. ; Author ........: UEZ ; Modified ......: ; Remarks .......: Use #AutoIt3Wrapper_Change2CUI=y when compiling to display result in console. ; Related .......: ; Link ..........: https://www.autoitscript.com/forum/index.php?showtopic=211619 ; Example .......: No ; =============================================================================================================================== Func _WinAPI_FileComparePrint($sFile1, $sFile2, $bUnbuffered = False) If Not FileExists($sFile1) Then Return SetError(-10, 0, 0) If Not FileExists($sFile2) Then Return SetError(-20, 0, 0) If Not FileGetSize($sFile1) Then Return SetError(-30, 0, 0) If Not FileGetSize($sFile2) Then Return SetError(-40, 0, 0) DllCall(@AutoItX64 ? "_WinAPI_FileCompare_x64.dll" : "_WinAPI_FileCompare.dll", "none", "_WinAPI_FileComparePrint", "str", $sFile1, "str", $sFile2, "bool", $bUnbuffered) If @error Then Return SetError(-60, 0, 0) Return 1 EndFunc ;==>_WinAPI_FileComparePrint Func _WinAPI_FileCompareAbout() DllCall(@AutoItX64 ? "_WinAPI_FileCompare_x64.dll" : "_WinAPI_FileCompare.dll", "none", "About") EndFunc ;==>_WinAPI_FileCompareAbout Example1: ;Coded by UEZ build 2024-03-22 beta #AutoIt3Wrapper_UseX64=y #include <WinAPIFiles.au3> #include <Memory.au3> #include "_WinAPI_FileCompare.au3" Global $tMemArray = DllStructCreate("ptr addr") Global $fTimer = TimerInit() Global $iReturn = _WinAPI_FileCompareBinaryString("img1.bmp", "img2.bmp", $tMemArray) ConsoleWrite("Dll runtime: " & TimerDiff($fTimer) & " ms" & @CRLF) If $iReturn Then If _WinAPI_IsBadReadPtr($tMemArray.addr, $iReturn) <> 1 Then ConsoleWrite(@CRLF) ConsoleWrite("Displaying result..." & @CRLF) ConsoleWrite("Offset" & @TAB & @TAB & "File1" & @TAB & "File2" & @CRLF) Global $i, $j, $t, $c = 0 For $i = 0 To $iReturn For $j = 0 To 2 $t = DllStructCreate("char string[15]", Ptr($tMemArray.addr + $i * 15 + ($j = 0 ? $j : 6 + $j * 3))) ConsoleWrite($t.string & ($j = 0 ? ":" : "") & @TAB) Next $c += 1 ConsoleWrite(@CRLF) Next ConsoleWrite(@CRLF) ConsoleWrite("Found " & $c & " differences!" & @CRLF) ConsoleWrite(@CRLF) If $tMemArray.addr Then _MemGlobalFree($tMemArray.addr) Else ConsoleWrite("Access violation to memory address" & @CRLF) EndIf Else ConsoleWrite("Files are equal!" & @CRLF) EndIf Example2: ;Coded by UEZ build 2024-03-22 beta #AutoIt3Wrapper_UseX64=y #include <WinAPIFiles.au3> #include <Memory.au3> #include "_WinAPI_FileCompare.au3" Global $tMemArray = DllStructCreate("ptr addr") Global $fTimer = TimerInit() Global $iReturn = _WinAPI_FileCompareBinary("img1.bmp", "img2.bmp", $tMemArray) ConsoleWrite("Dll runtime: " & TimerDiff($fTimer) & " ms" & @CRLF) If $iReturn Then If _WinAPI_IsBadReadPtr($tMemArray.addr, $iReturn) <> 1 Then ConsoleWrite(@CRLF) ConsoleWrite("Displaying result..." & @CRLF) ConsoleWrite("Offset" & @TAB & @TAB & "File1" & @TAB & "File2" & @CRLF) Global $i, $j, $t, $c = 0 For $i = 0 To $iReturn For $j = 0 To 2 Switch $j Case 0 $t = DllStructCreate("ulong offset", Ptr($tMemArray.addr + $i * 8)) ConsoleWrite(Hex($t.offset, 8) & ":" & @TAB) Case 1 $t = DllStructCreate("ubyte hex1", Ptr($tMemArray.addr + $i * 8 + 4)) ConsoleWrite(Hex($t.hex1, 2) & @TAB) Case 2 $t = DllStructCreate("ubyte hex2", Ptr($tMemArray.addr + $i * 8 + 5)) ConsoleWrite(Hex($t.hex2, 2) & @TAB) EndSwitch Next $c += 1 ConsoleWrite(@CRLF) Next ConsoleWrite(@CRLF) ConsoleWrite("Found " & $c & " differences!" & @CRLF) ConsoleWrite(@CRLF) If $tMemArray.addr Then _MemGlobalFree($tMemArray.addr) Else ConsoleWrite("Access violation to memory address" & @CRLF) EndIf Else ConsoleWrite("Files are equal!" & @CRLF) EndIf Example3: ;Coded by UEZ build 2024-03-22 beta #AutoIt3Wrapper_UseX64=n #AutoIt3Wrapper_Change2CUI=y #include "_WinAPI_FileCompare.au3" _WinAPI_FileComparePrint("img1.bmp", "img2.bmp") I used the two images from here: Examples output should look like this here (always hex values): Dll runtime: 5.6315 ms Displaying result... Offset File1 File2 0009AB99: F0 C7 0009AB9A: EF CB 0009AB9B: 81 34 0009C795: 23 00 0009C796: 7C 80 0009C797: F5 FF Found 6 differences! You can read out the result and put it to an array... With this version you should be able to use multi-threading / multi-calls of the DLL as the memory is now allocated with each call. For x86 it may fail when the memory cannot be allocated (2GB limit) and the dll will return 0. I may add another feature to the DLL to get around the x86 limitation at the expense of speed by using chunked memory allocation if it makes sense... All files can be found also in the 7-Zip archive. _WinAPI_FileCompare DLL v0.70 build 2024-03-22.7z
    1 point
  5. yes CTRL+J also try to use:
    1 point
  6. I have unlocked this thread and will allow it as it is using a standard api not using for automation according the OP.
    1 point
  7. jaberwacky

    function tooltip

    Yeah, the calltip stuff I made has really been hit hard by bit rot. I need to get around to updating all of that.
    1 point
  8. I think _GUICtrlEdit_SetSel($g_idMemo, $start, $linelength+1) needs to be _GUICtrlEdit_SetSel($g_idMemo, $start, $start + $linelength+1)
    1 point
  9. I haven't seen this before but would try with starting to play with this setting adding it to SciTEUser.properties:
    1 point
  10. ioa747

    Beep Player

    the other day I saw a post 129594-piano-autoplayer that inspired me to do this. Here I must say that I have no idea about music. I googled a bit and found this page, with which I tuned my instrument. the letters were selected based on the page https://virtualpiano.net/ Just for fun #include <Array.au3> Local $iTempo = 120 Local $sSong = "" #Region ; ===( Pink Panther )=== ;https://virtualpiano.net/music-sheet/pink-panther-main-theme/ ;Pink Panther (Main Theme) ;TARGET LENGTH 00:57 ;<<|>> transposition -5 ;TEMPO 110 $sSong &= "Q w W e|||" $sSong &= "W w Q q|||" $sSong &= "Q w W e|||" $sSong &= "W w Q q|||" $sSong &= "Q w [WO] [ep]||a s||O" $sSong &= "p a s g f [Wp] [ws] [Qf]" $sSong &= "[qD]| |dspop| |" $sSong &= "Q w [WO] [ep]||a s||O" $sSong &= "p a s g f [ws] [Wf] [ej]" $sSong &= "[EH]|||" $sSong &= "Q w [WO] [ep]||a s||" $sSong &= "O p a s g f [Wp] [ws] [Qf]" $sSong &= "[qD]| |dspop| |" $sSong &= "Q w W e| j h f d s p" $sSong &= "[qD]d| Dd| [0D]d| Dd|" $sSong &= "[es]pop p|" $sSong &= "W w Q" $sSong &= "[qs]pop p| Q w W" $sSong &= "[es]pop p| W w Q" $sSong &= "[qs]pop p||[0f]|" $sSong &= "[6j] " #EndRegion ; ===( Pink Panther )=== _PlaySong($sSong, $iTempo) ;-------------------------------------------------------------------------------------------------------------------------------- Func _PlaySong($sSong, $iTempo = 220, $iLayer = 0) Local $sKey = "" $sKey &= "1=65.41;!=69.30;2=73.42;@=77.78;3=82.41;4=87.31;$=92.50;5=98.00;%=103.83;6=110.00;^=116.54;7=123.47" $sKey &= ";8=130.81;*=138.59;9=146.83;(=155.56;0=164.81;q=174.61;Q=185.00;w=196.00;W=207.65;e=220.00;E=233.08;r=246.94" $sKey &= ";t=261.63;T=277.18;y=293.66;Y=311.13;u=329.63;i=349.23;I=369.99;o=392.00;O=415.30;p=440.00;P=466.16;a=493.88" $sKey &= ";s=523.25;S=554.37;d=587.33;D=622.25;f=659.26;g=698.46;G=739.99;h=783.99;H=830.61;j=880.00;J=932.33;k=987.77" $sKey &= ";l=1046.50;L=1108.73;z=1174.66;Z=1244.51;x=1318.51;c=1396.91;C=1479.98;v=1567.98;V=1661.22;b=1760.00;B=1864.66;n=1975.53" $sKey &= ";m=2093.00" Local $aVal, $mKey[], $aKey = StringSplit($sKey, ";", 1) For $i = 1 To $aKey[0] $aVal = StringSplit($aKey[$i], "=", 1) $mKey[$aVal[1]] = $aVal[2] Next Local $aSong = StringSplit($sSong, "") Local $Frequency, $iScale = 1 Local $aSynChorTone[9], $bSynChor = False Local $hTimer1 = TimerInit() Local $hTimer For $i = 1 To $aSong[0] $hTimer = TimerInit() ConsoleWrite("->" & $aSong[$i] & "<- ") ConsoleWrite($mKey[$aSong[$i]]) Switch $aSong[$i] Case " " Sleep(20) ConsoleWrite("slp:20") Case "|" Sleep(700) ConsoleWrite("slp:700") Case ":" ;Sleep($iTempo + $iTempo) ConsoleWrite(":::::") Case "]" ;Sleep($iTempo + $iTempo) ConsoleWrite("]]]]]] [") $bSynChor = False For $x = 1 To $aSynChorTone[0] Run(@AutoItExe & ' /AutoIt3ExecuteLine "Beep(' & $aSynChorTone[$x] & ', ' & $iTempo & ')"') ConsoleWrite(' +' & $aSynChorTone[$x]) Next ConsoleWrite("]") $aSynChorTone[0] = 0 Sleep($iTempo) Case "[" ;Sleep($iTempo + $iTempo) ConsoleWrite("[[[[[[") $bSynChor = True Case Else If $bSynChor = False Then Beep(($mKey[$aSong[$i]] * $iScale), $iTempo) Else $aSynChorTone[0] += 1 $aSynChorTone[$aSynChorTone[0]] = $mKey[$aSong[$i]] * $iScale ConsoleWrite(" [" & $mKey[$aSong[$i]] * $iScale & "]") EndIf EndSwitch ConsoleWrite(" metro:" & Round(TimerDiff($hTimer) / 1000, 3) & " seconds " & @LF) Next ConsoleWrite("> Total time:" & Round(TimerDiff($hTimer1) / 1000, 0) & " seconds " & @LF) EndFunc ;==>_PlaySong
    1 point
×
×
  • Create New...