Leaderboard
Popular Content
Showing content with the highest reputation on 02/10/2023 in all areas
-
AutoIt Snippets
SOLVE-SMART and one other reacted to noellarkin for a topic
Async HTTP Requests I couldn't find the thread for "Async HTTP requests" and the corresponding code snippet, so I rewrote it. This code snippet sents Async GET requests to an array of URLs, and returns response code, response headers and response body as an array. #include-once #include <Array.au3> Local $HTTP_METHOD = "GET" Local $ASYNC_REQUEST = True Local $aURLs = ["https://en.wikipedia.org", "https://en.wikipedia.org/wiki/Forest_raven", "https://en.wikipedia.org/wiki/Stanley_Bruce", "https://en.wikipedia.org/wiki/Beatlemania"] Local $nTotalThreads = UBound($aURLs) Local $aRequestHandles[$nTotalThreads] Local $aThreadStatus[$nTotalThreads] Local $nCompletedThreads = 0 _ArrayColInsert($aURLs, 1) ; stores response code _ArrayColInsert($aURLs, 1) ; stores response headers _ArrayColInsert($aURLs, 1) ; stores response text For $i = 0 To $nTotalThreads - 1 $aRequestHandles[$i] = ObjCreate("WinHttp.WinHttpRequest.5.1") $aRequestHandles[$i].Open($HTTP_METHOD, $aURLs[$i][0], $ASYNC_REQUEST) $aRequestHandles[$i].Send() Next Do For $i = 0 To $nTotalThreads - 1 If $aThreadStatus[$i] = 0 And $aRequestHandles[$i].WaitForResponse(0) = True Then $aURLs[$i][1] = $aRequestHandles[$i].Status $aURLs[$i][2] = $aRequestHandles[$i].GetAllResponseHeaders $aURLs[$i][3] = $aRequestHandles[$i].ResponseText $aThreadStatus[$i] = 1 $nCompletedThreads += 1 EndIf Next Until $nCompletedThreads = $nTotalThreads _ArrayDisplay($aURLs) Explanation: First, we define variables: $HTTP_METHOD is set to "GET" as the request method. $ASYNC_REQUEST is set to True for asynchronous processing. $aURLs is an array of 4 URLs to be requested. $nTotalThreads is set to the upper bound of $aURLs, which is the number of elements in the array. $aRequestHandles is an array to store the request handles, with a length of $nTotalThreads. $aThreadStatus is an array to store the status of each thread, with a length of $nTotalThreads. $nCompletedThreads is a counter for the completed threads, which is initialized to 0. The next 3 lines insert 3 new columns in $aURLs to store the response status code, headers, and text. The next block of code performs a loop from 0 to $nTotalThreads - 1. Inside the loop, an object is created from the "WinHttp.WinHttpRequest.5.1" class and assigned to $aRequestHandles[$i]. The object's Open method is then called, with arguments $HTTP_METHOD, $aURLs[$i][0], and $ASYNC_REQUEST, to initiate the request. The object's Send method is then called to send the request. The next block of code is a do-until loop that waits until all threads have completed. Inside the loop, a nested for loop is performed from 0 to $nTotalThreads - 1. If a thread is not yet completed (indicated by $aThreadStatus[$i] being equal to 0) and has received a response (indicated by $aRequestHandles[$i].WaitForResponse(0) being equal to True), then the response status code, headers, and text are stored in $aURLs[$i][1], $aURLs[$i][2], and $aURLs[$i][3] respectively. The thread status is then set to completed (indicated by $aThreadStatus[$i] being equal to 1) and the $nCompletedThreads counter is incremented. The last line calls the _ArrayDisplay function with $aURLs as an argument, which displays the contents of the array.2 points -
I create purebasic language functions similar to autolt I let the members of the furom improve the concept with a beginning of idea I included some functions it works very well for the moment I let you modify and give your ideas thank add in your purebasic source code (IncludeFile "AutoitCoding.PB") and program as on autolt it remains full of function to program the concept is to improve the languages remain similar AutoIt Code : 415 kb with UPX Interpreted Language $Time=TimerInit() MsgBox (16,"Autoit",StringIsDigit ("123a")) MsgBox (16,"Autoit",StringIsDigit ("123")) $VarBin=StringToBinary("Hello") MsgBox (64,"Autoit",@Hour) MsgBox (64,"Autoit",@TempDir) MsgBox (64,"Autoit",$VarBin) MsgBox (64,"Autoit",BinaryToString($VarBin)) MsgBox (0,"Autoit",StringLen ("bonjour")) MsgBox (1,"Autoit",@DesktopCommonDir) MsgBox (2,"Autoit",@ProgramFilesDir) Sleep (1000) MsgBox (3,"Autoit",FileGetSize("test.pb")) MsgBox (4,"Autoit",Random (1,10,1)) $Variable=FileGetSize("test.pb") MsgBox (0,"Autoit",$Variable) ;InetGet ("https://jardinage.lemonde.fr/images/dossiers/2018-07/language-chat-170054.jpg","image.jpg") MsgBox (0,"Autoit",StringReplace ("Hella","a","o")) MsgBox (0,"Autoit",StringTrimLeft ("Hello",1)) MsgBox (0,"Autoit",StringTrimRight("Hello",1)) If FileExists ("test.pb") Then MsgBox(0,"Title","the file exist") Else MsgBox(0,"Title","the file does not exist") EndIf MsgBox(0,"Autoit",FileGetTime ("UPX.exe",1,1)) MsgBox(0,"Autoit",FileGetTime ("UPX.exe",1,1)) MsgBox(0,"Autoit",FileGetVersion("UPX.exe")) MsgBox(0,"Autoit",TimerDiff($Time)) If IsAdmin() Then MsgBox(0,"Autoit", "IsAdmin You are administrator !.") Else MsgBox(0,"Autoit", "IsAdmin You are not administrator !.") EndIf MsgBox(0,"Autoit",String (10)) MsgBox(0,"Autoit",Ping ("google.fr")) ;################## StringSplit $Split = StringSplit("ABC*DEFG*JKL","*") MsgBox(0,"Autoit",$Split[1]) MsgBox(0,"Autoit",$Split[2]) MsgBox(0,"Autoit",$Split[3]) ;################## StringSplit IniWrite("setup3.ini", "General", "Title", "AutoIt") $inivar= IniRead("setup3.ini", "General", "Title",Default) MsgBox (0,"Autoit",$inivar) PureBasic Code : Executable Size : 12 kb with UPX Real Compiler ( Your source code is secure ) IncludeFile "AutoitCoding.PB" ;MsgBox (16,"Autoit",StringIsDigit ("123a")) ;StringIs.PB be sure to activate it in AutoitCoding.PB this increases the size of the executable ;MsgBox (16,"Autoit",StringIsDigit ("123")) ;StringIs.PB be sure to activate it in AutoitCoding.PB this increases the size of the executable ;InetGet ("https://jardinage.lemonde.fr/images/dossiers/2018-07/language-chat-170054.jpg","image.jpg") ; InetFonctions be sure to activate it in AutoitCoding.PB this increases the size of the executable ;##################Mouse Dim xy (1) MouseGetPos (xy()) Debug "Pos : X : "+xy(0)+" Y : "+xy(1) Debug WinGetHandle ("Notepad") ;################## ProcessList Dim ProcessName.s(1) ; Create array Dim PID.s(1) ; Create array ProcessList (ProcessName (),PID ()) MsgBox(0,"Autoit","ProcessName: "+ProcessName(10)+" YourPID: "+PID (10)) ;################## ProcessList For i = 0 To ArraySize (ProcessName ()) Debug ProcessName (i)+" PID : "+ PID (i) Next MsgBox (0,"Autoit",ProcessorArch ()) Time$=TimerInit() VarBin$=StringToBinary("Hello") MsgBox (0,"Autoit",ComSpec ()) MsgBox (64,"Autoit",GetCPUName ()) MsgBox (64,"Autoit",CpuSerialNumber ()) MsgBox (64,"Autoit",AutoItVersion ()) MsgBox (64,"Autoit","Hello"+CRLF ()+"Hello") MsgBox (64,"Autoit",Hours ()) MsgBox (64,"Autoit",TempDir ()) MsgBox (64,"Autoit",VarBin$) MsgBox (64,"Autoit",BinaryToString(VarBin$)) MsgBox (48,"Autoit",StringLenS ("bonjour")) MsgBox (1,"Autoit",DesktopCommonDir ()) MsgBox (2,"Autoit",ProgramFilesDir ()) Sleep (1000) MsgBox (3,"Autoit",FileGetSize("test.pb")) MsgBox (4,"Autoit",Randoms (1,10)) Variable$=FileGetSize("test.pb") MsgBox (0,"Autoit",Variable$) MsgBox (0,"Autoit",StringReplace ("Hella","a","o")) MsgBox (0,"Autoit",StringTrimLeft ("Hello",1)) MsgBox (0,"Autoit",StringTrimRight("Hello",1)) If FileExists ("test.pb") MsgBox(0,"Autoit","the file exist") Else MsgBox(0,"Autoit","the file does not exist") EndIf MsgBox(0,"Autoit",FileGetTime ("UPX.exe",1,"%mm/%dd/%yyyy %hh:%ii:%ss")) MsgBox(0,"Autoit",FileGetTime ("UPX.exe",1,"%hh:%ii:%ss")) MsgBox(0,"Autoit",FileGetVersion("UPX.exe",#FV_FileVersion)) MsgBox(0,"Autoit",TimerDiff(Time$)) If IsAdmin() MsgBox(0,"Autoit", "IsAdmin You are administrator !.") Else MsgBox(0,"Autoit", "IsAdmin You are not administrator !.") EndIf MsgBox(0,"Autoit",String(10)) MsgBox(0,"Autoit",Ping ("google.fr")) iLife = 42 If IsNumber(iLife) MsgBox(0, "", "Is Number") Else MsgBox(0, "", "Is not Number") EndIf ;################## StringSplit Dim Split.s(1) ; Create array StringSplit (split(), "ABC*DEFG*JKL", "*") MsgBox(0,"Autoit",Split(0)) MsgBox(0,"Autoit",Split(1)) MsgBox(0,"Autoit",Split(2)) ;################## StringSplit IniWrite("setup3.ini", "General", "Title", "AutoIt") inivar$= IniRead("setup3.ini", "General", "Title") MsgBox (0,"Autoit",inivar$) ;Bonus Function MsgBox(0,"Autoit",HostNameToIp ("google.fr")) there is a slight difference but nothing important I am counting on you to improve the project and add functions ! ( Disadvantage purebasic is paying you can not have all ) Functions compatible : Msgbox Sleep FileGetSize ClipPut ClipGet Randoms DirCopy DirCreate DirRemove StringReplace StringLen Add Fonctions : (11/03/2019) StringTrimLeft StringTrimRight FileCopy FileMove StringUpper StringLower Add Fonctions : (12/03/2019) StringIsFloat StringIsAlpha StringIsDigit StringReverse BinaryToString StringToBinary FileExists Msgbox ADD : MB_ICONERROR = 16 MB_ICONQUESTION = 32 MB_ICONWARNING = 48 MB_ICONINFORMATION=64 You can control the size of the executable Division of executable size by 10 ( 119 kb to 12 kb) ( I separated the functions in several file activated if necessary ) ;IncludeFile "FonctionsIncludes\StringIs.PB" I separated the functions into several activated files If necessary remove ;IncludeFile "FonctionsIncludes\InetFonctions.PB" ; I separated the functions into several activated files If necessary remove Add Functions: (20/03/2019) String IsAdmin TimerDiff (thank @JiBe) TimerInit (thank @JiBe) Ping FileGetVersion add : #FV_FileVersion #FV_FileDescription #FV_LegalCopyright #FV_InternalName #FV_OriginalFilename #FV_ProductName #FV_ProductVersion #FV_CompanyName #FV_LegalTrademarks #FV_SpecialBuild #FV_PrivateBuild #FV_Comments #FV_Language FileGetTime Flag : 0 Last modified (default) 1 Created 2 Last accessed Msgbox ADD : MB_DEFBUTTON2 = 256 Flag MB_DEFBUTTON3 = 512 Flag MB_DEFBUTTON4 = 768 Flag MB_SYSTEMMODAL = 4096 Flag MB_TASKMODAL = 8192 Flag MB_DEFAULT_DESKTOP_ONLY = 131072 Flag MB_RIGHT = 524288 Flag MB_RTLREADING = 1048576 Flag MB_SETFOREGROUND = 65536 Flag MB_TOPMOST = 262144 Flag MB_SERVICE_NOTIFICATION = 2097152 Flag Bonus Functions : HostNameToIp Add Functions: (22/03/2019) ----------------------- ADD Macros : (thank @AZJIO) DesktopCommonDir () MyDocumentsDir () ProgramFilesDir () ScriptFullPath () ScriptName () ScriptDir () ----------------------- OSVersions () Add Functions: (26/03/2019) ----------------------- ADD Macros : TempDir () Hours () Min () Sec () MDAY () MON () Years () LF () CR () CRLF () ----------------------- Functions: Floor Ceiling Stringlen ( Update :Return Number) StringlenS (Temporary function asks for reflection) Add Functions: 06/04/2019 Macro : AutoItVersion () ; it's for fun haha SystemDir () UserProfileDir () AppDataDir () ComSpec () ; Bug fixed UserName () LogonServer () HomeShare () HomeDrive () HomePath () HomeDrive () LocalAppDataDir () UserProfilDir () Bonus Macro : ProcessorsThreadNumber () Functions : Change of procedure in macro (optimization) Optimization of msgbox Fix a constant messagebox Beep StringSplit ( thank @AZJIO ) FileGetAttrib Bonus features : CpuSerialNumber() GetCPUName() Add Functions: 16/04/2019 Optimization UserName () Optimization CpuName () change of the name of the function GetCpuName () ProcessList () : Return PID Return ProcessName ProcessClose (); PID or ProcessName IniWrite () IniRead () Macro : ProcessorArch () DesktopHeights () DesktopWidths () DesktopRefresh () DesktopDepths () AutoItX64 () Add Functions: 19/04/2019 Functions: ( THANK @AZJIO ) IniDelete () DriveGetType() DriveGetLabel() DriveGetSerial() DriveSpaceFree() DriveSpaceTotal() DriveGetFileSystem() Add Functions: 30/04/2019 Minor bug fixes : DriveGetLabel() fixed function thank AZJIO DriveGetFileSystem() fixed function thank AZJIO ADD Functions : BlockInput () thank AZJIO FileGetShortName() FileGetLongName() MouseGetPos () WinGetHandle () Sqrt () Add Functions: 23/05/2019 ProcessExists () ClosePID () IniReadSectionNames() WinWait ();2 in 1 finds the same handle with a title or a partial text WinExists ();2 in 1 finds the same handle with a title or a partial text WinWaitClose ();2 in 1 finds the same handle with a title or a partial text WinWaitActive ();2 in 1 finds the same handle with a title or a partial text WinGetProcess ();2 in 1 finds the same handle with a title or a partial text HandleToHex ();x86 management Imitate autoit HexToHandle () ADD Macro : ScriptDir () Complete rewrite of functions with optimization : ProcessList () ProcessClose () WinGetHandle () Delete function : CountProcess () FileGetSize () ;Old function All the old function are put in the OldFonctions.pb file Add Fonctions : (18/07/2019) WinMinimizeAll() Winkill ();title or a partial text SearchHandle ();Bonus function to simplify your life look for the handle of a window with a title or a text patiel WinSetStade ();title or a partial text or Handle #SW_HIDE = 0 #SW_SHOW = 5 #SW_MINIMIZE = 6 #SW_MAXIMIZE = 3 #SW_RESTORE = 9 #SW_DISABLE = 4 #SW_ENABLE = 1 WinActive () Title or Handle WinList (); With the zero flag you can see the invisible windows and the flag 1 for visible windows more simplify than the original Default option : VisibleWindow = 1 WinSetTitle () Title or Handle Update : WinExists () Handle Management WinGetProcess () Handle Management Add Fonctions : (09/04/2020) IsHWnd (Return 0 or 1) PixelGetColor (x,y) WinSetTrans ;title or a partial text 0 To 255 Optimization of the msgbox function smaller and faster code (old msgbox function put in oldfunction.pb) Msgbox Fix minors bug MouseMoveSpeed Function under construction MouseClick Function under construction HibernateAllowed() Suspend() ShutdownPrivilege() Shutdown (Flag) #SD_LOGOFF=0 #SD_SHUTDOWN=1 #SD_REBOOT=2 #SD_FORCE=4 #SD_POWERDOWN=8 #SD_FORCEHUNG=16 #SD_STANDBY=32 #SD_HIBERNATE=64 ProcessSetPriority (Process.s, priority) #PROCESS_LOW =0 #PROCESS_BELOWNORMAL =1 #PROCESS_NORMAL =2 #PROCESS_ABOVENORMAL =3 #PROCESS_HIGH =4 #PROCESS_REALTIME =5 EnvSet () EnvGet () FileRecycleEmpty() add file in GuiExampleAutoitCoding (Hybrid Code) example method for window GuiExampleAutoitCoding (Hybrid Code) update files start of code to convert autoit to pb in construction Add Fonctions : (01/12/2022) #PB_OS_Windows_11 code upgrade OSVersion() WinActivate(hWnd) adding a new function thank @AZJIO #MB_SERVICE_NOTIFICATION1 I changed the name not compatible with purebasic 6 I added a 1 (msgbox) DriveGetLabel bugfix for version 6 of purebasic DriveGetFileSystem bugfix for version 6 of purebasic ProcessorArch () optimization of the function and addition of flag for Purebasic 6 ARM64 ARM ProcessorArch () the old function is moved to the file Old Functions.pb ProcessorArch () bug fixed stack has been corrupted ProcessorArch () add to file Example.pb InitNetwork remove Deprecated function HostNameToIp optimization of the function and addition of flag 0 HostNameToIp the old function is moved to the file Old Functions.pb Ping () optimization of the function and addition of flag and timeout Ping () fix minor bug flag 0 return ping flag 1 return PingStatus also returns errors 1 = Host disconnected 2 = Host unreachable 3 = Wrong destination 4 = Other errors flag 2 return DataSize timeout = 4000 like the original the setting support written web address and ip address (www.google.com or 127.0.0.1) Ping () the old function is moved to the file Old Functions.pb remove ExampleGui I moved the files in the same folder it is more manageable Add Fonctions : (05/09/2024) New Functions Added: DllOpen Implemented a new function DllCall Implemented a new function DllClose Implemented a new function iniWrite: Implemented a new function for writing to INI files. iniRead: Introduced a revised version of the basic function for reading INI files. CpuIdentifier() Combine some values to create a pseudo-unique identifier Function Rewrite: iniDelete: Updated the iniDelete function to enhance management of sections and keys. Ping improve performance Compatibility improved PureBasic 6.11 LTS Legacy Code Management: Moved obsolete functions to Oldfunctions.pb to streamline current codebase. Moved Macro Username to Oldfunctions.pb Moved Macro Blockinput to Oldfunctions.pb Bug fix : (05/09/2024) Bug fix : corrected IniRead procedure to return string instead of numeric value UPX official website to compress the executable : https://upx.github.io/ PureAutoitInclude.7z1 point
-
1 point
-
Is there a way to send copy , no matter what language I have active?
SOLVE-SMART reacted to ioa747 for a topic
@jugador after many tests, a little luck, and a head like a pot, I finally found a solution, thanks to you for showing me the way as i described in the first post he impressed me when Send("^c") selected a word replaced with c ( And why does he send c , and not ψ ? which corresponds to the char c ) during the research process, i changed keyboard layouts, i tried the Send( ) , i changed keyboard layouts, i tried the Send( ) , at some point I noticed that Send("^c") it was not sending c any more, but ψ. for this was responsible the choice Let me use a different input method for each app window it was not checked. After I checked it, I started the tests again. In this situation, things are like this. if I highlight a word and press F5 this working. The Console write the highlighted word it works no matter what keyboard I have active. Send(ChrW(0x005E) & "{" & ChrW(0x0063) &"}") Sleep(100) ConsoleWrite(ClipGet() & @CRLF) ; Sends simulated keystrokes to the active window In this situation not working when I have the native keyboard - language active, then it replaces the word with c it working when I have the eng keyboard - language active #include <GUIConstantsEx.au3> Example() Func Example() GUICreate("My GUI", 320, 120) Local $idFile = GUICtrlCreateInput("Sends simulated keystrokes to the active window.", 10, 5, 300, 20) Local $idBtn = GUICtrlCreateButton("Ok", 40, 75, 60, 20) GUISetState(@SW_SHOW) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $idBtn ControlFocus("My GUI", "", "Edit1") ;~ Send("^c") Send(ChrW(0x005E) & "{" & ChrW(0x0063) &"}") Sleep(100) ConsoleWrite(ClipGet() & @CRLF) EndSwitch WEnd EndFunc ;==>Example In this situation working when I have the native keyboard - language active, it working when I have the eng keyboard - language active #include <GUIConstantsEx.au3> Example() Func Example() GUICreate("My GUI", 320, 120) Local $idFile = GUICtrlCreateInput("Sends simulated keystrokes to the active window.", 10, 5, 300, 20) Local $idBtn = GUICtrlCreateButton("Ok", 40, 75, 60, 20) GUISetState(@SW_SHOW) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $idBtn ControlFocus("My GUI", "", "Edit1") ;~ Send("^c") Send("{ASC 003}") ;<<<< this is working Sleep(100) ConsoleWrite(ClipGet() & @CRLF) EndSwitch WEnd EndFunc ;==>Example if this Send("{"& Chr(3) & "}") is used, regardless of which keyboard - language is active, then close the GUI How ever this showing me the way After that, i UnChecked the Let me use a different input method for each app window, to try and work and this situation conclusion: Is there a way to send copy (Ctrl + c ) , no matter what language I have active? Yes with Send("{ASC 003}") Thank you all for yours suggestions, and yours time1 point -
SciTE PlusBar
ioa747 reacted to SOLVE-SMART for a topic
Fair enough @ioa747 👍 . Yes it is not related to AutoIt like this forum, for sure. It wouldn't make seense to explain GitHub (from my point of view) to you. If you did not needed it so far, it's totally okay. Let's see what the time brings 😀 . You're welcome. Best regards Sven1 point -
ReDim error code
argumentum reacted to pixelsearch for a topic
It seems correct, X * Y calculates the total number of elements, then compares it to AutoIt limit value Edit: we posted at same time. My sentence "It seems correct..." was an answer to your penultimate post.1 point -
SciTE PlusBar
SOLVE-SMART reacted to ioa747 for a topic
@SOLVE-SMART Thank you for your kind words. I really appreciate your intention to support, as you did from the very beginning. 👍 As for the GitHub, I don't know it and it seems more chaotic to me, since it contains scripts from different languages. I believe that anyone who use, and love SciTE in combination with AutoIt and deals with it will pass by here, since this is the home of AutoIt . This is also the reason why I am also here. Thanks again for the interaction1 point -
WebDriver UDF - Help & Support (IV)
SOLVE-SMART reacted to mLipok for a topic
Using FireFox I was able to get more info about the site certs. Then I get http://cacerts.digicert.com/DigiCertTLSHybridECCSHA3842020CA1-1.crt and add them to Windows Certifacte Storage as a trusted certificate . Then my problem with InetGet was past.1 point -
@mLipokI would recommend reposting this as a new thread since it appears to be more of a security / configuration issue than a Webdriver UDF issue. P.S. You may want to post the images / text in English next time. 😉1 point
-
If you prefer using a hook then I would recommend using _WinAPI_RegisterShellHookWindow as it is more appropriate when a window closes. Here an example : #include <APISysConstants.au3> #include <WinAPISysWin.au3> #include <Constants.au3> If WinExists("[CLASS:Notepad]") Then Exit MsgBox($MB_SYSTEMMODAL, "Error", "Close all instance of Notepad") Run("Notepad") Global $hTarget = WinWait("[CLASS:Notepad]") OnAutoItExitRegister(OnAutoItExit) Global $hForm = GUICreate('') GUIRegisterMsg(_WinAPI_RegisterWindowMessage('SHELLHOOK'), WM_SHELLHOOK) _WinAPI_RegisterShellHookWindow($hForm) While 1 Sleep(100) WEnd Func WM_SHELLHOOK($hWnd, $iMsg, $wParam, $lParam) If $lParam <> $hTarget Then Return Switch $wParam Case $HSHELL_WINDOWDESTROYED ConsoleWrite("Notepad has been closed" & @CRLF) Exit EndSwitch EndFunc ;==>WM_SHELLHOOK Func OnAutoItExit() _WinAPI_DeregisterShellHookWindow($hForm) EndFunc ;==>OnAutoItExit The script will stop when you close Notepad...1 point
-
[Sqlite] SELECT: Exec or Query?
mistersquirrle reacted to jchd for a topic
As a general rule, use *_Exec to issue SQL returning no data and *_GetTable[2d] in the general case, including write queries (insert, update, upsert, replace, ... when they have a RETURNING clause). Leave *_Query and friends alone since this way is paved with pitfalls, well unless you have a good reason like when you have frequently running queries you don't want to prepare everytime. But then it's up to you to manage your queries and use *_QueryReset and *_QueryFinalize correctly. Note you also have to handle unexpected errors yourself at each step. I don't get you: the query isn't "displayed". Forget *_Exec and use *_GetTable[2d]. *_Exec is NOT for returning data, even less to process the data row by row. This makes the transaction last longer for no good. Grab the data and process it outside a transaction. This way concurrency is less affected.1 point -
Introduction: CBOR is a binary format that can represent arbitrarily nested data. The principle is basically the same as with JSON. There you can take your variables directly from the program and convert them to this format. This way you can store your data outside the program or exchange it with other programs, which is even easier since almost all programming languages understand the JSON standard. CBOR is quite similar, but the difference is that CBOR is not a text-based format, but a binary format. This of course makes it impossible for a human to read it directly but on the other hand the results are usually smaller than in JSON. How to use?: Now how to work with it? - Here is an example: In this case our AutoIt data structure occupies 29 bytes of space at the end. Since the comparison to JSON is obvious - here is another example (the JSON UDF is also needed) to see how both interact: >>sourcecode and download on github<< Changelog: 2023-02-08: fixed bug when encoding big integer numbers1 point
-
Hello again. I reworked this UDF with maps and structs and a more simple way to interact with. It now supports switching to the next cell with "TAB". Cancel with "ESC" and save with "ENTER" still works. I updated the start post PS: When changing the edited cell with the "Tab" key; the visuals of the cell are not correct until the mouse is moved over the cell... I have no idea what is happening there and tried to mitigate that with a window redraw of the area; Its better, but the focus color and the selection are not displayed correctly. Maybe someone has an idea, what to do about that.1 point