Leaderboard
Popular Content
Showing content with the highest reputation on 05/13/2025 in all areas
-
SciTE AI assistant
argumentum and one other reacted to SOLVE-SMART for a topic
You are such a nice person @ioa747. In my opinion there is no apology necessary at all. There was a misunderstanding and that's it. But thanks for the clarification - no worries and thanks for your effort regarding this LLM <==> AutoIt thingy π . Best regards Sven2 points -
SciTE AI assistant
argumentum and one other reacted to ioa747 for a topic
I apologize, π I still didn't understand what had happened and it wasn't working for you. Then when I saw here that you started escaping control characters, I was surprised. (I still didn't understand what had happened) That's why I passed you just '__JSON_FormatString($sPrompt) ' I thought you just removed the __JSON_FormatString($sPrompt) Even after you showed me here with the scary StringRegExpReplace($sString & '\\\b\f\n\r\t\"', '(?s)(?|\\(?=.*(\\\\))|[\b](?=.*(\\b))|\f(?=.*(\\f))|\r\n(?=.*(\\n))|\n(?=.*(\\n))|\r(?=.*(\\r))|\t(?=.*(\\t))|"(?=.*(\\")))', '\1'), I thought it was your addition because something didn't work for you, or you have some old version of JSON.au3 and that's why I asked you (and which is the right one? ; Version .......: 0.10 ? ) because I checked on github what the current version is, and it was 10, which is the one I had (I didn't go and see if the function was the same, I just looked at the header) I got the full picture today when I read all the relevant posts. I concluded that, I was misusing a UDF function, which is intended for internal use only. After all this I came to the conclusion. That I need to make an internal function for escaping control characters, so that I have better control. and since my JSON parser requirements are basic, for a specific JSON format, I will also make a fake JSON parser, so that I can extract the data I need from JSON, without external additions (at least until needed) This will also help me to better understand the JSON format thanks for understanding I apologize to everyone for the upset I caused you, it was not my intention.2 points -
JSON UDF in pure AutoIt
SOLVE-SMART and one other reacted to AspirinJunkie for a topic
Ok, so let's just say that the function is not βbrokenβ after all, does what it is supposed to do and does it correctly without any known errors? It has always been the responsibility of the application code to use their respective dependencies correctly. Especially as non-public interfaces are used here, which were never intended to be used by the user. The _JSON_Generate() function is intended to format a string in a JSON-compliant manner as a user. Its behavior has not changed over time. A change would have no effect on the described functionality of the UDF, which is why there is no need for action from my point of view.2 points -
DarkMode UDF for AutoIt's Win32GUIs
argumentum reacted to UEZ for a topic
Is there a way to check if visible GUI is in dark mode? Edit: this seems to work: ;Coded by UEZ build 2025-05-14 #include <AutoItConstants.au3> #include <StringConstants.au3> #include <WinAPISysWin.au3> Const $DWMWA_USE_IMMERSIVE_DARK_MODE = @OSBuild < 18362 ? 19 : 20 Func _WinAPI_IsWindowDarkMode($hWnd) Local $value = DllStructCreate("int dm") Local $ret = DllCall("dwmapi.dll", "long", "DwmGetWindowAttribute","hwnd", $hWnd, "uint", $DWMWA_USE_IMMERSIVE_DARK_MODE, "struct*", $value, "uint", DllStructGetSize($value)) If @error Or $ret[0] <> 0 Then Return 0 Return $value.dm <> 0 EndFunc Global $aWinList = WinList(), $i, $iStatus For $i = 1 To $aWinList[0][0] If _WinAPI_IsWindowVisible($aWinList[$i][1]) Then If IsHWnd($aWinList[$i][1]) Then $iStatus = _WinAPI_IsWindowDarkMode($aWinList[$i][1]) ConsoleWrite($aWinList[$i][1] & ": " & $iStatus & " -> " & StringRegExpReplace($aWinList[$i][0], "[\r\n]+", "") & @CRLF) EndIf EndIf Next1 point -
And you can also use other methods, especially if this is just a text file. A very simple approach if you know your insertion point, and it is based on unique text, is to FileRead your file, then use StringSplit with the unique text, then add all three parts together and then FileWrite back to the file with that, overwriting it. The only tricky bit, is if you are not familiar with an array, which is what StringSplit creates. But as suggested, back your file up first, just in case. Have a play, and any further questions, keep asking here.1 point
-
Overwrite a file without destroying the previous contents
pixelsearch reacted to Musashi for a topic
Or maybe this : #include <Constants.au3> Global $bInsert = "0xFFFFFF" Global $hFile = FileOpen("mslogo.jpg", BitOR($FO_APPEND, $FO_BINARY)) FileSetpos($hFile, 20, $FILE_BEGIN ) ; Pos = 20 FileWrite($hfile, $bInsert) FileClose($hFile) ==> Info : A better way to work with binary data is to use a struct ! I would advise you to always create a backup of the file before you change it - safety first1 point -
SciTE AI assistant
argumentum reacted to ioa747 for a topic
With internal JSON functions (at least until needed)1 point -
Maybe this : #include <Constants.au3> Local $hFile = FileOpen("Test.txt", $FO_APPEND) FileSetPos($hFile, 5, $FILE_BEGIN) FileWrite($hFile, "12345") FileClose($hFile)1 point
-
JSON UDF in pure AutoIt
argumentum reacted to SOLVE-SMART for a topic
Thank you both (@argumentum and @AspirinJunkie) for the clarification π . I hope you folks continue to have a nice week, best regards, Sven.1 point -
_StringToTable
pixelsearch reacted to ioa747 for a topic
Congratulations π₯ @pixelsearch Thank you very much. Very insightful, my mind didn't go there. When I was building this pattern my mind was, not to catch the heading I updated the original (in the same version) π1 point -
JSON UDF in pure AutoIt
SOLVE-SMART reacted to argumentum for a topic
Not the input. In "SciTE AI assistant" code, he coded it as: ... If $Seed = "" Or $Seed = -1 Or $Seed = Default Then $Seed = 0 __JSON_FormatString($sPrompt) Local $sRequest = '{' ... with the expectation of ByRef. The code I posted works with both so that the old expectation of ByRef will work, and as a function returning the value will work too. The request is not for me particularly. Either you change your code or he does his, for his project/code to work as expected. He is using an older version. You have a newer version. What I presented keeps it backwards compatible to not brake code. Do as you see fit. To me is all good either way.1 point -
JSON UDF in pure AutoIt
SOLVE-SMART reacted to AspirinJunkie for a topic
It may be obvious to you, but it still isn't to me. You have now written the function again but still haven't explained which input values cause it to fail. I have fed several test strings to it and all came back as expected. That's why I'm asking again: For which specific data does the function not return the desired result? About the byref/return story: In old versions, the function was designed to process the variable directly (a "procedure"). However, since you cannot include the function call in string definitions, this was later changed to a return the target value (a "function"). This has simplified the code that uses this function. The way in which the function must be used has of course changed: Before you had to make a single call and got the variable changed, now you have to use the return value instead. The ByRef was left in (for performance reasons at the time) to avoid additional copies. We had already covered the fact that these considerations are not fulfilled in reality in the discussion on _JSON_Parse(). This function is therefore also a candidate where the ByRef can be removed if the opportunity arises. But until then, this is simply irrelevant for the functionality of the function and has no influence. ByRef and Return are not incompatible. Edit: Ok, a little more thought: Could it be that it's not about the function being faulty, but that you just want a feature extension so that you can process variables directly and at the same time get them back as return values? Well of course you can discuss that but this function is not part of the user interface (it begins with 2 underscores) but an internal helper function for a specific purpose. So far it has fulfilled this purpose, so I have no compulsion to change it accordingly. If someone absolutely needs a function that processes a variable accordingly in-place, then this is a three-liner for him. But that would just be a feature request. In fact, the function was said to be βbrokenβ. But I can't see that so far.1 point -
_StringToTable
ioa747 reacted to pixelsearch for a topic
Hello @ioa747 Example 4, first number is 1.691 If we replace this number with .6 (for example) then the following test in __FormatCell() will fail : If StringRegExp($text, "^-?\d+(\.\d+)?$") Then The output will be .6 instead of 0.600 Same for numbers like +6 or 12. etc... (though 12. shouldn't happen too often but who knows...) I tried this pattern which seems to cover all 4 cases : If StringRegExp($text, "^[+-]?(\d*\.\d+|\d+\.?)$") Then 4 cases being : 12.34 12. 12 .34 ...preceded by an optional + or - sign Could you please try it to see if it suits you ? Thanks and have a great day1 point -
SciTE AI assistant
genius257 reacted to argumentum for a topic
Good to know. Since am not familiar with git, going to get "the file" and is not it, ..is frustrating. I code so I can debug it but those that expect the stuff to run ( because is stuff we/they discover, run it, and if it didn't, meh, it does not work, next... ) will miss in using it and participating with bugs or code or anything. I've found myself uploading files for those occasions when I have them ( and I have them because I hoard them ). Maybe I went overboard in my rant, maybe. I should have advised to include all the external includes and that is a better solution1 point