Leaderboard
Popular Content
Showing content with the highest reputation on 02/05/2025 in all areas
-
Visual Studio Code Extension currently available and future plans for SciTE?
seadoggie01 and 3 others reacted to Jos for a topic
Let's not make this topic more difficult than it is and stick for now to VSCode/SciTE. One can always decide to go down an alternative path later when VSCode is working.4 points -
Based on the input string provided by OP, it seems that the list is already pre-sorted, so shouldn't be just : Local $sValue = "'133.0.3','133.0','133.0b7','133.0b8','133.0b9','134.0.1','134.0.2','134.0','134.0b1','134.0b3','134.0b5','134.0b9','135.0','135.0.1','135.0.2','135.0b1','135.0b3','135.0b5','135.0b9','136.0b1'" Local $aVersion = StringRegExp($sValue, "(?>\d+\.)+\d+\b", 3) ConsoleWrite($aVersion[UBound($aVersion) - 1] & @CRLF) But if it is not the case, here my take on it : Local $sValue = "'133.0.3','133.0','133.0b7','133.0b8','133.0b9','134.0.1','134.0.2','134.0','134.0b1','134.0b3','134.0b5','134.0b9','135.0','135.0.1','135.0.2','135.0b1','135.0b3','135.0b5','135.0b9','136.0b1'" Local $aVersion = StringRegExp($sValue, "(?>\d+\.)+\d+\b", 3) ConsoleWrite(GetLatestVersion($aVersion, 3, 3) & @CRLF) Func GetLatestVersion(ByRef $aList, $iNum, $iWidth) Local $sVal, $sMax, $aMax, $iMax For $i = 0 To UBound($aList) - 1 $aMax = StringSplit($aList[$i], ".") For $j = 1 To $iNum $sVal &= StringFormat("%0" & $iWidth & "i.", $j > $aMax[0] ? 0 : Int($aMax[$j])) Next If $sVal > $sMax Then $sMax = $sVal $iMax = $i EndIf $sVal = "" Next Return $aList[$iMax] EndFunc2 points
-
Visual Studio Code Extension currently available and future plans for SciTE?
SOLVE-SMART and one other reacted to genius257 for a topic
Look at your current selected language mode: If it says "AutoIt" then it's Damien.autoit, if it says "AutoIt3" then it's my extension running. I just tested it myself, and it does not seem like any functionality overlap between the extensions, because of this. Multiple extensions can be active at the same time, even for the same language. It requires that the same activation requirements are met, like the language mode. It can however introduce unexpected issues. Some functionality might be merged (like suggestions), but others depend on the order, the extensions are loaded and register features/events with the extension. Mostly it's best to stick with one, when it comes to things like IntelliSense, to avoid inconsistent user experience.2 points -
Get Maximum number that has digits to get stable latest version
Davidyese and one other reacted to AspirinJunkie for a topic
1. To extract only the version numbers without beta or anything else, you can use the following pattern (there are many alternative approaches for such a pattern, but this is based on your specific example): (?>\d+\.)+\d+\b 2. A normal _ArrayMax/_ArraySort etc. is not sufficient to determine the actual maximum including all secondary versions. The elements are strings and a classic AutoIt string comparison, on which _ArrayMax/_ArraySort is based, compares character by character. In this specific case, this would even work, but if you imagine that you now have the elements '135.0.3' and '135.0.20' in the list, then '135.0.3' would still be returned as the result. You have tried to get around this by setting the size comparison for _ArrayMax to “numeric”, but that doesn't help here either, as it means that the strings are first converted into a number. And that means that “135.0.2” simply becomes 135. So you either need a function that sorts the array with its own comparison function or returns the maximum, or you create a value for each value yourself that can be correctly compared by _ArrayMax. For the former, there are already UDFs such as >>this<<. The solution to your question would look like this: #include "ArrayPlus.au3" ; input string $sValue = "'133.0.3','133.0','133.0b7','133.0b8','133.0b9','134.0.1','134.0.2','134.0','134.0b1','134.0b3','134.0b5','134.0b9','135.0','135.0.1','135.0.2','135.0b1','135.0b3','135.0b5','135.0b9','136.0b1'" ; extract stable versions $aStables = StringRegExp($sValue, "(?>\d+\.)+\d+\b", 3) ; determine max version number $sMax = _ArrayGetMax($aStables, __ap_cb_comp_Natural) ; present result MsgBox(0,"max stable version", $sMax) 3. _ArraySort($sValue, 1) does nothing at all. As the name suggests, it sorts arrays. $sValue, on the other hand, is a string. (What @error also tells you, if it had been analyzed.)2 points -
Get Maximum number that has digits to get stable latest version
SOLVE-SMART reacted to Davidyese for a topic
Thank you all for help All codes are working now.1 point -
trying to get JSON from output
SOLVE-SMART reacted to gcue for a topic
this worked!!! -w "%%header{Dropbox-Api-Result}" thank you both VERY much!! 🕺1 point -
trying to get JSON from output
SOLVE-SMART reacted to TheXman for a topic
The "%" in StringForma()t has to be escaped when you actually want a literal "%" character. You do it by using %% (like %%header{Dropbox-Api-Result}). If you would have used ConsoleWrite to view your command line, you would have seen that it did not produce your desired result.1 point -
trying to get JSON from output
SOLVE-SMART reacted to TheXman for a topic
Instead of parsing the values of http response headers manually, why don't you use something that will retrieve individual header values for you like: winhttp api, winhttp com, or curl? What are you currently using to get the http response?1 point -
Version 1.6.3.0
17,639 downloads
Extensive library to control and manipulate Microsoft Active Directory. Threads: Development - General Help & Support - Example Scripts - Wiki Previous downloads: 30467 Known Bugs: (last changed: 2020-10-05) None Things to come: (last changed: 2020-07-21) None BTW: If you like this UDF please click the "I like this" button. This tells me where to next put my development effort1 point -
Visual Studio Code Extension currently available and future plans for SciTE?
SOLVE-SMART reacted to WildByDesign for a topic
Another interesting and legitimate future possibility here would be to distribute/fork VSCodium (truly open-source VSCode) and bundle the AutoIt-related extensions plus the bundling of AutoIt3Wrapper, SciTE4AutoIt3 full, etc.1 point -
Get Maximum number that has digits to get stable latest version
Davidyese reacted to SOLVE-SMART for a topic
Hi @Davidyese 👋 , here a different variant which I use in a project. Of course I adjusted the non stable version indicator for your case (beta "b") a bit. See foot note comments. #AutoIt3Wrapper_AU3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 #AutoIt3Wrapper_AU3Check_Stop_OnWarning=y ;~ #include-once ;~ #include <Array.au3> _Main() Func _Main() Local Const $sValue = "'133.0.3','133.0','133.0b7','133.0b8','133.0b9','134.0.1','134.0.2','134.0','134.0b1','134.0b3','134.0b5','134.0b9','135.0','135.0.1','135.0.2','135.0b1','135.0b3','135.0b5','135.0b9','136.0b1'" Local Const $iZeroBasedFlag = 2 Local Const $aVersionList = StringSplit(StringReplace($sValue, "'", ''), ',', $iZeroBasedFlag) ;~ _ArrayDisplay($aVersionList) ConsoleWrite(_GetLatestStableVersion($aVersionList) & @CRLF) EndFunc Func _GetLatestStableVersion($aVersionList) Local Const $iCount = UBound($aVersionList) - 1 Local Const $sBetaIndicator = 'b' ; * Local $sVersion Local $sLatestStableVersion = '0.0.0' For $i = 0 To $iCount $sVersion = $aVersionList[$i] If StringInStr($sVersion, $sBetaIndicator) Then ; ** ContinueLoop EndIf If _IsVersionNewer($sLatestStableVersion, $sVersion) Then $sLatestStableVersion = $sVersion EndIf Next Return $sLatestStableVersion ;~ *, **: ;~ This could also be a RegEx pattern and StringRegExp() ;~ as non valid indicator for a stable version. EndFunc Func _IsVersionNewer($sCurrentLatestStableVersion, $sComparedVersion) $sCurrentLatestStableVersion = _EnsureSemVerFormat($sCurrentLatestStableVersion) $sComparedVersion = _EnsureSemVerFormat($sComparedVersion) Local Const $aCurrentLatestStableVersion = StringSplit($sCurrentLatestStableVersion, '.') Local Const $aComparedVersion = StringSplit($sComparedVersion, '.') Local $iLTSPart, $iComparedPart For $i = 1 To 3 $iLTSPart = Number($aCurrentLatestStableVersion[$i]) $iComparedPart = Number($aComparedVersion[$i]) If $iLTSPart < $iComparedPart Then Return True ElseIf $iLTSPart > $iComparedPart Then Return False EndIf Next Return False EndFunc Func _EnsureSemVerFormat($sVersion) ; Expected version formart is "Major.Minor.Patch". ; https://semver.org/ ; ; If the version does not have Minor or Patch, ; then it will be added as 0. StringReplace($sVersion, '.', '') Switch @extended Case 0 Return $sVersion & '.0.0' Case 1 Return $sVersion & '.0' Case Else Return $sVersion EndSwitch EndFunc By the way: Very very good (as usually) @AspirinJunkie 😀 . The main difference to your more mature approach is that my return value will alway return a "Major.Minor.Patch" version string instead of the input version string. That means if 136 or 136.2 are the input version, the output would be 136.0.0 or 136.2.0 to fulfill SemVer syntax. I don't know whether this is a problem for you @Davidyese or not? Best regards Sven1 point -
I've been using VSCode as my primary coding tool for a while, so anything that can be done to improve integration with AutoIt is welcomed. FWIW, I have both of these extensions installed / enabled at the same time, and it's working ok for me.1 point
-
I updated it.1 point
-
Resize GUI & controls font
SOLVE-SMART reacted to pixelsearch for a topic
Hi everybody The purpose of this post is to indicate how simple it is to change your "too small" Gui for a bigger one, resizing (or not) the associated controls font. 1) SampleControls.au3 The original example is found in AutoIt package (subfolder ..\Example\GUI) and displays its GUI like this : 2) "SampleControls (resizable Gui).au3" [ based on SampleControls.au3 ] If you want to enlarge the Gui because it appears too small depending on your screen resolution, here are the changes to apply, where the Gui is resizable but the control fonts are unchanged : ; Added ; ----- #include <StaticConstants.au3> ; center the label control #include <WindowsConstants.au3> ; $WS_OVERLAPPEDWINDOW Opt("GUIResizeMode", $GUI_DOCKAUTO) ;0 = (default) keep default control resizing , <1024 = any type of resizing ; Modified ; -------- ; GUICreate("Sample GUI", 400, 400) GUICreate("Sample GUI", 400, 400, -1, -1, $WS_OVERLAPPEDWINDOW) ; GUICtrlCreateLabel("Green" & @CRLF & "Label", 350, 165, 40, 40) GUICtrlCreateLabel("Label", 350, 165, 40, 40, BitOr($SS_CENTERIMAGE, $SS_CENTER)) 3) "SampleControls (resizable Gui & fonts).au3" [ based on "SampleControls (resizable Gui).au3" ] If you want to enlarge the Gui AND resize the controls font so they appear bigger, here are the changes to apply : ; Added ; ----- Global $hGUI, $iGUIInitSizeW = 400, $iLast_DummyControl $iLast_DummyControl = GUICtrlCreateDummy() ; just before GUISetState(@SW_SHOW) GUIRegisterMsg($WM_SIZE, "WM_SIZE") Func WM_SIZE($hWnd, $iMsg, $wParam, $lParam) #forceref $iMsg, $wParam If $hWnd = $hGUI Then Local Static $iFontSize_Old = 0 Local $iParentW = BitAND($lParam, 0xFFFF) ; low word (new width of the client area) ; Local $iParentH = BitShift($lParam, 16) ; high word (new height of the client area) Local $iFontSize = Int(2 * (.5 + (8 * $iParentW / $iGUIInitSizeW))) / 2 If $iFontSize_Old <> $iFontSize Then For $i = 3 To $iLast_DummyControl - 1 ; 1st control in GUI is always 3 GUICtrlSetFont($i, $iFontSize) Next $iFontSize_Old = $iFontSize EndIf EndIf Return $GUI_RUNDEFMSG EndFunc ;==>WM_SIZE ; Modified ; -------- ; GUICreate("Sample GUI", 400, 400, -1, -1, $WS_OVERLAPPEDWINDOW) $hGUI = GUICreate("Sample GUI", $iGUIInitSizeW, 400, -1, -1, $WS_OVERLAPPEDWINDOW) Below, a bolder font appears when more resizing is applied to the GUI : I just tried all this on a personal script and the results looked fine, hope it will be same for you. Big thanks to @Melba23 for his script, found here Mods, I don't know where this post should be placed on the Forum. Please move it if you think its place isn't the appropriate one, thanks.1 point -
This script allows the usage of the QRCode UDF (QRCode UDF) from the console. It allows the output of a QRCode to the console or as image file. When creating an image, another image can be provided to automatically draw into the middle of the qrcode. The size will be automatically adjusted depending on the "error correction level" The newest version is 1.1 Man page: Changelog: QRCodeGenerator-CLI.zip QRCodeGenerator-CLI-Executable.zip QRCodeGenerator-CLI_v1.1.zip QRCodeGenerator-CLI-Executable_v1.1.zip1 point
-
This QRCode UDF makes it possible to generate QRCodes and create an image or print it to the console. It provides functions to create a 2D-Boolean-Array of the QRCode, get a Bitmap (_GDIPlus) of that QRCode or to draw it directly at a GraphicsContext (_GDIPlus). To achieve this, I created a .dll in rust, which uses the "QR Code generator library (Rust)" by Project Nayuki (https://www.nayuki.io/page/qr-code-generator-library). Currently the following functions are included in the UDF: _QRCode_StartUp - Startup needed before using most other functions (Includes _GDIPlus_Startup) _QRCode_Shutdown - Shutdown should be called at the and to clean up (Includes _GDIPlus_Shutdown) _QRCode_GetQRCode - Generate a QRCode as 2D-Boolean-Array, where the first index = lines, the second index=cols, normally False=White, True=Black _QRCode_GetBitmap - Creates a GDIPlus-Bitmap with the QRCode _QRCode_DrawQRCode - Draws a QRCode on a provides GDIPlus-GraphicsContext _QRCode_DrawQRCodeFast - Same as _QRCode_DrawQRCode, but without error checks and requires brushes for the colors to be provided (=> higher FPS) _QRCode_ConsoleWrite - Print the QRCode to the console _QRCode_GetSize - Get the size of the generated QRCode _QRCode_GetECLMaxLoss - Get the maximum allowed loss before the qrcode becomes unreadable (decimal multiplier) Possible error correction levels: $_QRCode_ECL_LOW = 1 $_QRCode_ECL_MEDIUM = 2 $_QRCode_ECL_QUARTILE = 3 $_QRCode_ECL_HIGH = 4 - Default Here is an example, how the UDF could be used: Another example can be found with the QRCodeGenerator-cli: QRCode generator cli That is a console application with detailed possibilities for settings to generate qrcodes from the commandline. While developing in rust, I first created a .exe instead of the .dll. Calling the .exe and parsing the result was relatively slow (~1 sec), so I ditched that for the .dll. You can find the created .exe in the files as Rust-Executable (QRCode-Wrapper-Console-Rust-Exe.zip). It is a commandline utility to be called with a text with the corresponding qrcode being written to the console with 0 (white), 1 (black), 2 (new line). With --human the qrcode will be printed humanreadable and with --errorlvl low/medium/quartile/high, the error correction level can be provided. But this appilcation is inferior to the QRCodeGenerator-cli mentioned above and is just included for completeness. Files: The QRCode UDF with all needed files: qrcode.zip The Rust-Sourcecode of the .dll and .exe: QRCode-Dll-Exe-Rust-Src.zip The Rust-Executable: QRCode-Wrapper-Console-Rust.zip QRCode-Wrapper-Console-Rust-Exe.zip qrcode.zip QRCode-Dll-Exe-Rust-Src.zip1 point
-
Bring the window to the front of the screen
Xandy reacted to JockoDundee for a topic
Post code, or it didn’t happen.1 point