
noellarkin
-
Posts
156 -
Joined
-
Days Won
2
Reputation Activity
-
noellarkin got a reaction from Hashim in HttpApi UDF - HTTP Server API
Been using this for a personal project, love it:)
Just had a suggestion:
In the function _HTTPAPI_HttpSendHttpResponse adding an additional parameter $sResponseType
Func _HTTPAPI_HttpSendHttpResponse($hRequestQueue, $iRequestId, $iStatusCode, $sReason, $sBody, $sResponseType = "text/html") And replacnig "text/html" in the function with $sResponseType.
Allows one to use other formats, like JSON :)
For example:
Switch $sPath Case $path & "/username" $iStatusCode = 200 $sReason = "OK" $sMsg = '{"username":"' & @UserName & '"}' EndSwitch _HTTPAPI_HttpSendHttpResponse($requestqueue, $tRequest.RequestId, $iStatusCode, $sReason, $sMsg, "application/json")
-
noellarkin got a reaction from RTFC in Eigen4AutoIt - Matrix computing with Eigen
hey, this thread doesn't get much love, but just wanted to say thanks for this, I use the vector operations (cosine similarity, primarily) to compare embeddings and do RAG (retrieval augmented generation) with LLMs
-
noellarkin reacted to RTFC in Eigen4AutoIt - Matrix computing with Eigen
E4A Version 5.5 is released.
This is a minor update, mainly providing more support for binary operations on matrices of integer type, notably in file I/O, bitwise & logical operations on a single matrix cell value, CwiseScalarOps with logical operators (+ parsed value), reversing the bit-order in all cells of a matrix (part) with new CwiseUnaryOp operator #37 ("reverseBits"), and Rowwise Pack/Unpack functions for converting integer cells to/from 32 individual bits, 4 bytes, or 2 words. A new test script (#32: BitAndByteOps.au3 in the .\EigenTest subdirectory) illustrates various features. Full details can be found in the History page of the online Help (note that as of this version, the .chm Helpfile is no longer supported/present; just download the latest online Help if you need an offline version). Hope it helps.
-
noellarkin reacted to SOLVE-SMART in Collection of GitHub users (with AutoIt projects)
Hi folks 👋 ,
just for your information: I added @AspirinJunkie to the list in post #1, because his awesome UDFs lay on GitHub too 👌 .
That's all, cheers.
Best regards
Sven
-
noellarkin reacted to seadoggie01 in Which Debugger do you use?
I've written a couple of functions that I use everywhere, saved them as "CustomDebugging.au3" in my includes folder, and included them in every script. The basic idea was:
; Calls Debug with a custom message. Uses '!' as a prefix to make the text red in the debugger. ; I set mine up to let SciTE jump to the right line... like you see with a compile error Func ErrMsg($sMsg = "", $iError = @error, $iExtended = @extended, $iScriptLineNum = @ScriptLineNumber) ; If there is an error, then write the error message If $iError Then ; I also added this later to simplify the function call If IsFunc($sMsg) Then $sMsg = FuncName($sMsg) Local $sText = '"' & @ScriptFullPath & '" (' & $iScriptLineNum & ',5) : (See below for message)' & @CRLF $sText &= "! Error: " & $iError & " - " If $iExtended <> 0 Then $sText &= "Extended: " & $iExtended & " - " Debug($sText & $sMsg, "") EndIf ; Preserve the error Return SetError($iError, $iExtended, $iError) EndFunc ; a wrapper around ConsoleWrite... mostly because I always forget to add a newline Func Debug($sMsg, $sPrefix = "+") If $sPrefix <> "" Then $sPrefix &= " " ConsoleWrite($sPrefix & $sMsg & @CRLF) EndFunc Func Examples() Local $aFiles = _FileListToArray(@UserProfileDir) If ErrMsg(_FileListToArray) Then Exit Debug("Found " & $aFiles[0] & " files") EndFunc I (even) later added options to write messages to a log file (the name of the log and if it should write).
I did a few things right and more than a couple wrong and it's a bit of a mess now because of my refusal to fix all my old scripts. I'd suggest writing your own and making it work for you.
One thing I wish I'd done differently would be to use best practices in naming my functions: _<name of include>_<function name> I'd be much easier for me to fix some of my mistakes if I'd done that. So I would've named the include Debug.au3 and renamed the functions _Debug_Debug and _Debug_ErrMsg, but with the time I saved from not writing _Debug_ so many times, I wrote this post
-
noellarkin reacted to Jos in AutoIt3ExecuteScript doesn't work
Add this to the top of the script:
#pragma compile(AutoItExecuteAllowed, true) Jos
-
noellarkin reacted to Leo1906 in AutoIt3ExecuteScript doesn't work
Ah ok, thanks a lot. I thought that this option would be enabled by default.
-
-
noellarkin reacted to AGlassman in Which Debugger do you use?
I sprinkle my code with calls to this func. Disable/enable with a Ctrl-Q as needed. Shows me the Function , step, and multiple variable names and values on one line. (All of my Func have a "Local Const $ThisFunc = "Func Name" line right after the Func definition).
#include-once ; ===================================================================== ; ; #include "HotRod\hr_Debug_Print.au3" ; ; Example Calls: ; ; hr_Debug_Print( $ThisFunc, "StepName", "MsgText", "$P1Name", $P1Value, ... ) ; hr_Debug_Print( $ThisFunc, "StepName", Default, "$P1Name", $P1Value, ... ) ; hr_Debug_Print( $ThisFunc, Default, Default, "$P1Name", $P1Value, ... ) ; ; hr_Debug_Print( $ThisFunc, "StepName", _ ; "MsgText", _ ; "$P1Name", $P1Value, ... ) ; ; ===================================================================== Func hr_Debug_Print( _ Const $FuncName = Default, _ $StepName = Default, _ $MsgText = Default, _ $P1Name = Default, $P1Value = Default, _ $P2Name = Default, $P2Value = Default, _ $P3Name = Default, $P3Value = Default, _ $P4Name = Default, $P4Value = Default, _ $P5Name = Default, $P5Value = Default, _ $P6Name = Default, $P6Value = Default, _ $P7Name = Default, $P7Value = Default, _ $P8Name = Default, $P8Value = Default, _ $P9Name = Default, $P9Value = Default _ ) Local $MsgStrg = "DEBUG_PRINT" If NOT ( ( $FuncName = Default ) OR ( $FuncName = "") ) Then $MsgStrg = $MsgStrg & " | " & $FuncName EndIf If NOT ( ( $StepName = Default ) OR ( $StepName = "") ) Then $MsgStrg = $MsgStrg & " | " & $StepName EndIf If NOT ( ( $MsgText = Default ) OR ( $MsgText = "") ) Then $MsgStrg = $MsgStrg & " | " & $MsgText EndIf If $P1Name <> Default Then $MsgStrg = $MsgStrg & " | " & $P1Name & ": '" & $P1Value & "'" If $P2Name <> Default Then $MsgStrg = $MsgStrg & " | " & $P2Name & ": '" & $P2Value & "'" If $P3Name <> Default Then $MsgStrg = $MsgStrg & " | " & $P3Name & ": '" & $P3Value & "'" If $P4Name <> Default Then $MsgStrg = $MsgStrg & " | " & $P4Name & ": '" & $P4Value & "'" If $P5Name <> Default Then $MsgStrg = $MsgStrg & " | " & $P5Name & ": '" & $P5Value & "'" If $P6Name <> Default Then $MsgStrg = $MsgStrg & " | " & $P6Name & ": '" & $P6Value & "'" If $P7Name <> Default Then $MsgStrg = $MsgStrg & " | " & $P7Name & ": '" & $P7Value & "'" If $P8Name <> Default Then $MsgStrg = $MsgStrg & " | " & $P8Name & ": '" & $P8Value & "'" If $P9Name <> Default Then $MsgStrg = $MsgStrg & " | " & $P9Name & ": '" & $P9Value & "'" ConsoleWrite( $MsgStrg & @CRLF ) EndFunc
-
noellarkin reacted to Musashi in Which Debugger do you use?
There are some beneficial keyboard shortcuts for debugging.
Example :
Local $iCount = 0 For $i = 1 To 5 $iCount += $i * 2 Next Place the mouse cursor on the $iCount variable in the loop.
Now use ALT-D (without the - character, of course ). This will automatically insert a ConsoleWrite statement.
With CTRL-SHIFT-D a MsgBox is inserted analogously.
With CTRL-ALT-Z all lines inserted in this way can be removed.
-
noellarkin reacted to TheDcoder in Which Debugger do you use?
The full version of SciTE also has a very useful trace feature with ConsoleLog, I've used it several times to track tricky bugs.
-
noellarkin reacted to Melba23 in Which Debugger do you use?
noellarkin,
ConsoleWrite, MsgBox (or ExtMsgBox ) and (Debug)ArrayDisplay have always been sufficient to date.
M23
-
noellarkin reacted to water in Which Debugger do you use?
+ _ArrayDisplay
+ FileWriteLine to write some info to a log file
-
noellarkin reacted to Andreik in Which Debugger do you use?
ConsoleWrite() works just fine for me. I never used something else.
-
noellarkin reacted to rsn in Automating: Logging out as User 1 and then Logging in as User 2
Autologon takes command line arguments so using it might be simpler than you think.
autologon.exe <username> <domain> <password> If the PC in question isn't joined to a Windows Domain, you would use the name of the PC. Example from the command line:
autologon.exe noellarkin %COMPUTERNAME% MyC0mplexP@ssword Right before you trigger your logoff use autologon to set whoever you want to log in next. Example in AutoIt:
$iPID = Run ( @ComSpec & " /c c:\path\to\autologon.exe noellarkin " & @computername & " MyC0mplexP@ssword" , "" , @SW_HIDE ) ProcessWaitClose($iPID) Shutdown (0)
-
noellarkin reacted to water in How I Organize My UDFs
I created a directory named "MyUDFs" and used SciTE Config to have AutoIt search this directory as well.
I spread my UDFs all over the place and simply added a
#include "Path\xx.au3" where xx stands for the name of the UDF.
So there is a central point where AutoIt can find all my UDFs. Each of this UDFs just has to hold the "real" #include statement.
-
noellarkin reacted to Skeletor in How I Organize My UDFs
This was a tiny project I had in my mind and never had time to get to do due to demanding projects. Thank you for providing this.
-
noellarkin got a reaction from Skeletor in How I Organize My UDFs
When I started using AutoIt, I used to dump all the community UDFs as well as my own frequently-used scripts into C:\Program Files (x86)\AutoIt3\Include - - terrible idea, of course, and I wouldn't advise anyone to do this.
These days I have the following folder structure for UDFs:
- I have a folder C:\AutoIt which has subfolders:
- - C:\AutoIt\MyLibraries, which has my own scripts, organized as C:\AutoIt\MyLibraries\MyUDFName\MyUDFName.au3
- - C:\AutoIt\CommunityLibraries, which has scripts from other forum members, organized as:
C:\AutoIt\CommunityLibraries\CommunityMemberUsername\UDFName\UDFName.au3
For example, I've been playing around with TheXman's "jq" UDF, and this is the storage path:
This in itself won't make everything run. Some UDFs will have hardcoded DLL paths which you'll have to edit. And finally, you'll have to make registry edits so you can #include these UDFs without entering the entire path.
Here's what I did:
#include <Array.au3> #include <File.au3> Global Const $CUSTOMINCLUDE_REGKEYNAME = "HKEY_CURRENT_USER\Software\AutoIt v3\AutoIt" Global Const $CUSTOMINCLUDE_REGKEYVALUENAME = "Include" Global Const $CUSTOMINCLUDE_REGKEYVALUETYPE = "REG_SZ" Global Const $FOLDER_COMMUNITYLIBRARIES = "C:\AutoIt\CommunityLibraries" Global Const $FOLDER_MYLIBRARIES = "C:\AutoIt\MyLibraries" Global $CUSTOMINCLUDE_REGKEYVALUE = "" Local $CommunityUsers = _FileListToArray($FOLDER_COMMUNITYLIBRARIES, "*", $FLTA_FOLDERS, False) _ArrayDelete($CommunityUsers, 0) Local $CommunityLibraries = 0 Local $UDFPath = "" For $i = 0 To UBound($CommunityUsers) - 1 $CommunityLibraries = _FileListToArray($FOLDER_COMMUNITYLIBRARIES & "\" & $CommunityUsers[$i], "*", $FLTA_FOLDERS, False) _ArrayDelete($CommunityLibraries, 0) For $j = 0 To UBound($CommunityLibraries) - 1 $UDFPath = $FOLDER_COMMUNITYLIBRARIES & "\" & $CommunityUsers[$i] & "\" & $CommunityLibraries[$j] If FileExists($UDFPath) Then $CUSTOMINCLUDE_REGKEYVALUE &= $UDFPath & ";" Next Next Local $MyLibraries = _FileListToArray($FOLDER_MYLIBRARIES, "*", $FLTA_FOLDERS, False) _ArrayDelete($MyLibraries, 0) For $j = 0 To UBound($MyLibraries) - 1 $UDFPath = $FOLDER_MYLIBRARIES & "\" & $MyLibraries[$j] If FileExists($UDFPath) Then $CUSTOMINCLUDE_REGKEYVALUE &= $UDFPath & ";" Next $CUSTOMINCLUDE_REGKEYVALUE = StringTrimRight($CUSTOMINCLUDE_REGKEYVALUE, 1) ConsoleWrite($CUSTOMINCLUDE_REGKEYVALUE) RegWrite("HKEY_CURRENT_USER\Software\AutoIt v3\AutoIt", "Include", "REG_SZ", $CUSTOMINCLUDE_REGKEYVALUE) This script scans the "CommunityLibraries" and "MyLibraries" folders and adds all the folder paths where the folder name matches the au3 file name to the registry. So far, it has worked out great for me, because now I can use this:
#include <jq.au3> instead of:
#include "C:\AutoIt\CommunityLibraries\TheXman\jq\jq.au3" Okay, that's all, I hope this'll be useful for newbies who want an easy system for storing their UDFs :)
-
noellarkin reacted to pat4005 in Wake on LAN UDF
A tiny UDF that can shoot magic packets at your computers to wake them the heck up. All credits to Olish.
The only parameter it needs to be specified – is your machine's MAC-address (ip address (the second parameter), at which you will be sending magic packet is generating automatically from @IPAddress1 macro)
Example:
_WoL_WakeDevice('001CC0CAED7A') ; the second parameter (if necessery) must be a broadcast address of your local network segment (i.e. 192.168.0.255 for a network 192.168.0.0)
_WakeOnLan.au3
-
noellarkin got a reaction from qsek in Nested Spintax in AutoIt?
Ah I think this may have been it.
The pipes shouldn't be there, of course, that threw me off, but I tried with this simpler example:
$spintext = "{Hello{ooo| There}|Hi}, how's it going?" And got:
Helloooo, how's it going? Hi, how's it going? Hi, how's it going? Hello There, how's it going? So yeah, script works, the input string in the example isn't valid spintax :)
For future reference, a working script an example for nested spintax in Autoit:
;Spintax Test #include <Array.au3> ; Text in Spintax format ;~ Global $a = 1 $spintext = "{Hello{ooo| There}|Hi}, how's it going?" ConsoleWrite(Spintax($spintext) & @CRLF) ConsoleWrite(Spintax($spintext) & @CRLF) ConsoleWrite(Spintax($spintext) & @CRLF) ConsoleWrite(Spintax($spintext) & @CRLF) Func Spintax($sInput) ;~ ConsoleWrite("- Iteration "&$a&" Start -" & @CRLF) $SpinArray = StringRegExp($sInput, '{([^{]*?|[^{]*?)}',3); Global matches ;~ _ArrayDisplay($SpinArray,"") $sfinrep = StringReplace($sInput,"}|{","|") ; look For final replacing If Not IsArray($SpinArray) Then ;~ ConsoleWrite("!No Array!" & @CRLF) If $sfinrep = $sInput then ; Nothing replaced, so free of }|{ --> end string ;~ ConsoleWrite("+EndResult: " & @CRLF) Return $sInput EndIf ;else replace workstring with the string without }|{ for further processing $sInput = $sfinrep $SpinArray = StringRegExp($sInput, '{([^{]*?|[^{]*?)}',3); Global matches ;~ ConsoleWrite("final replaced string:" & @CRLF) ;~ ConsoleWrite($sInput & @CRLF) EndIf $TrimmedText = StringRegExpReplace($sInput, '{([^{]*?|[^{]*?)}',chr(0x1A)); or any other special char to mark where to insert $RNDText = $TrimmedText For $i = 0 To UBound($SpinArray)-1 $WordArray = StringSplit($SpinArray[$i], "|",3) $rnum = Random(0, UBound($WordArray)-1, 1); get random Array index $RNDText = StringReplace($RNDText, chr(0x1A), $WordArray[$rnum],1); replace only the next occurrence Next ;~ ConsoleWrite($RNDText & @CRLF) ;~ ConsoleWrite("- Iteration "&$a&" End -" & @CRLF) ;~ $a += 1 Return Spintax($RNDText) EndFunc Thanks @qsek and @water :)
-
noellarkin got a reaction from argumentum in Nested Spintax in AutoIt?
Ah I think this may have been it.
The pipes shouldn't be there, of course, that threw me off, but I tried with this simpler example:
$spintext = "{Hello{ooo| There}|Hi}, how's it going?" And got:
Helloooo, how's it going? Hi, how's it going? Hi, how's it going? Hello There, how's it going? So yeah, script works, the input string in the example isn't valid spintax :)
For future reference, a working script an example for nested spintax in Autoit:
;Spintax Test #include <Array.au3> ; Text in Spintax format ;~ Global $a = 1 $spintext = "{Hello{ooo| There}|Hi}, how's it going?" ConsoleWrite(Spintax($spintext) & @CRLF) ConsoleWrite(Spintax($spintext) & @CRLF) ConsoleWrite(Spintax($spintext) & @CRLF) ConsoleWrite(Spintax($spintext) & @CRLF) Func Spintax($sInput) ;~ ConsoleWrite("- Iteration "&$a&" Start -" & @CRLF) $SpinArray = StringRegExp($sInput, '{([^{]*?|[^{]*?)}',3); Global matches ;~ _ArrayDisplay($SpinArray,"") $sfinrep = StringReplace($sInput,"}|{","|") ; look For final replacing If Not IsArray($SpinArray) Then ;~ ConsoleWrite("!No Array!" & @CRLF) If $sfinrep = $sInput then ; Nothing replaced, so free of }|{ --> end string ;~ ConsoleWrite("+EndResult: " & @CRLF) Return $sInput EndIf ;else replace workstring with the string without }|{ for further processing $sInput = $sfinrep $SpinArray = StringRegExp($sInput, '{([^{]*?|[^{]*?)}',3); Global matches ;~ ConsoleWrite("final replaced string:" & @CRLF) ;~ ConsoleWrite($sInput & @CRLF) EndIf $TrimmedText = StringRegExpReplace($sInput, '{([^{]*?|[^{]*?)}',chr(0x1A)); or any other special char to mark where to insert $RNDText = $TrimmedText For $i = 0 To UBound($SpinArray)-1 $WordArray = StringSplit($SpinArray[$i], "|",3) $rnum = Random(0, UBound($WordArray)-1, 1); get random Array index $RNDText = StringReplace($RNDText, chr(0x1A), $WordArray[$rnum],1); replace only the next occurrence Next ;~ ConsoleWrite($RNDText & @CRLF) ;~ ConsoleWrite("- Iteration "&$a&" End -" & @CRLF) ;~ $a += 1 Return Spintax($RNDText) EndFunc Thanks @qsek and @water :)
-
noellarkin reacted to water in Nested Spintax in AutoIt?
Which of the code examples did you try? The one by svenadamsson or the one by qsek?
-
noellarkin reacted to water in Nested Spintax in AutoIt?
I have already run this code and - as far as I can tell - the result doesn't look bad.
I tested your first result
Hello World!|Greetings Everyone, C++ is an awesome|n astonishing programming language. and to me it looks correct.
I understand the "extra" pipe character after "World!" and "|n" after "awesome" to be correct as they are - as far as I understand the Spintax syntax - literals.
So maybe the input string isn't fully correct?
Or it is me
-
noellarkin reacted to TheXman in HttpApi UDF - HTTP Server API
What's New in Version v1.4.0
v1.4.0 (2023-08-15) Added the ability to set the Content-Type response header's value in _HTTPAPI_HttpSendHttpResponse(). See the function's header and the example script in order to see how to implement the new functionality. Thanks @noellarkin for the suggestion. Added an additional api link (/json) to the example script in order to show the new content-type functionality in _HTTPAPI_HttpSendHttpResponse().
v1.3.0 (2022-06-14) - These modifications were not previously released. Added 2 new internal functions related to setting response headers: __HTTPAPI_ResetKnownResponseHeaderValue() - Clears a known response header __HTTPAPI_SetKnownResponseHeaderValue() - Set a known response header Did a little code optimization/refactoring in _HTTPAPI_HttpSendHttpResponse() and some of the struct definitions. -
noellarkin reacted to TheXman in HttpApi UDF - HTTP Server API
Thanks, I will definitely check them out.