Leaderboard
Popular Content
Showing content with the highest reputation since 09/11/2025 in Posts
-
So maybe i just haven't been looking hard enough, but i could not find how to make toast notifications in win8+ from AutoIt. I looked at it on and off, and finally made some progress. Github repository: https://github.com/genius257/au3toast Zip download: https://github.com/genius257/au3toast/archive/52f6eb0c5e6543777e19010a6c64f46e4dbe8fe0.zip I am still working on event support, but would like some feedback from the forum so far Thanks!6 points
-
Released v1.1.0 yesterday! Added Support for running the Format Document command via the Command Palette or hotkey using Tidy.exe on scripts, including automatic formatting on save Jest testing framework with test suite for language features and services Changed Refactored monolithic command code Upgraded build toolchain Diagnostic system overhaul with encoding handling and problem script source tracking Fixed Restored Go to Definition functionality for symbols declared outside of current script Restored Open Include file (Alt+i) functionality Path handling improvements Completion provider accuracy with user-defined functions View and Rate on VSCode Marketplace View and Rate on OpenVSX Star, Submit Issues, and Contribute on GitHub6 points
-
Added File path validation to prevent path traversal attacks Parameter safety warnings for autoit.consoleParams to detect potentially dangerous shell metacharacters Workspace symbol performance optimizations with batch processing to prevent UI freezing on large projects Configuration options autoit.workspaceSymbolMaxFiles (default: 500) and autoit.workspaceSymbolBatchSize (default: 10) Configuration option autoit.symbolMaxLines (default: 50000) to control maximum lines processed for symbol information Warning message when files exceed symbol processing limit with actionable instructions Comprehensive unit tests for completion provider with 8 test cases Comprehensive README documentation improvements with installation guide, quick start section, platform support matrix, troubleshooting guide, and reorganized configuration Distribution scripts for packaging the extension to multiple marketplaces: package-all.js for simultaneous packaging to VS Code Marketplace and OpenVSX package-openvsx.js for OpenVSX-specific packaging with publisher name handling Fixed Command injection risk in registry update functionality by replacing exec with execFile for safer argument handling Multiple global output panels opening for AutoIt on startup Memory leak in completion provider where include cache grew indefinitely across document switches Incorrect array comparison logic in completion cache invalidation Cross-document contamination of completion items from include files Changed Simplified ESLint configuration by using globals package and removing redundant rules Workspace symbol cache now uses incremental updates instead of full invalidation on file changes Completion provider now uses per-document Map-based caching with LRU eviction (50 document limit) Include cache automatically cleans up when documents are closed Symbol processing limit increased from hardcoded 10,000 to configurable 50,000 lines by default Removed The unused autoit.YAML-tmLanguage file Rate and View on VS Code Marketplace Star & Submit Issues on GitHub5 points
-
I compiled Zint v2.15.09 source and it has 30 functions! ZBarcode_BarcodeName|0x0001CBA0 ZBarcode_Buffer|0x0001CC20 ZBarcode_Buffer_Vector|0x0001CC60 ZBarcode_Cap|0x0001CCA0 ZBarcode_Clear|0x0001D270 ZBarcode_Create|0x0001D390 ZBarcode_Default_Xdim|0x0001D3C0 ZBarcode_Delete|0x0001D5D0 ZBarcode_Dest_Len_ECI|0x0001D630 ZBarcode_Encode|0x0001D6D0 ZBarcode_Encode_File|0x0001D710 ZBarcode_Encode_File_and_Buffer|0x0001DB00 ZBarcode_Encode_File_and_Buffer_Vector|0x0001DB50 ZBarcode_Encode_File_and_Print|0x0001DBA0 ZBarcode_Encode_Segs|0x0001DBE0 ZBarcode_Encode_Segs_and_Buffer|0x0001E890 ZBarcode_Encode_Segs_and_Buffer_Vector|0x0001E8F0 ZBarcode_Encode_Segs_and_Print|0x0001E950 ZBarcode_Encode_and_Buffer|0x0001E990 ZBarcode_Encode_and_Buffer_Vector|0x0001EA10 ZBarcode_Encode_and_Print|0x0001EA90 ZBarcode_HaveGS1SyntaxEngine|0x0001EAF0 ZBarcode_NoPng|0x0001EB00 ZBarcode_Print|0x0001EB10 ZBarcode_Reset|0x0001EC30 ZBarcode_Scale_From_XdimDp|0x0001ECA0 ZBarcode_UTF8_To_ECI|0x0001EE80 ZBarcode_ValidID|0x0001EF40 ZBarcode_Version|0x0001EF80 ZBarcode_XdimDp_From_Scale|0x0001EF90 I will update the code in the next days. I compiled also a x64 Zint DLL but I don't know if it is working yet...4 points
-
AutoIt v3.3.18.0 has been released - mainly a UDF release. Thanks to @jpm and the MVPs who were responsible for the majority of code in this version. Download it here. Complete list of changes: History4 points
-
No need to click for see it, just put your mouse on the left side of your screen Why on the left? Because the taskbar is already crowded, on the right side we scroll, and at the top when we use our browser tab by tab, it's not convenient to have a GUI in the way. You can add Shortcut, InternetShortcut, Files, and Folder by drag and drop on any button (special folders not supported) Right click menu on it for delete item See tray menu for options To exit, click on the InfoBar at the bottom of the GUI or by tray menu SlidingToolbar.7z3 points
-
read and write xlsx files without Excel
ermar and 2 others reacted to AspirinJunkie for a topic
Several adjustments were made within the UDF. 1. Writing Excel function cells _xlsx_WriteFromArray() can now write Excel functions. For this, the element value in the input array must be a string that starts with `=`. The string itself is then interpreted as an Excel function. Example: =IF(F2>E2,"yes","no") Note: For Excel to interpret this correctly, only the English notation is permitted. If you need to write a string that starts with `=` but should not be interpreted as a function, escape the first `=` by doubling it (`==`). 2. Smallest possible .xlsx output files The .xlsx file generated with _xlsx_WriteFromArray() has been consistently optimized for minimal size. Files produced this way are close to the minimum possible for the format given the data. Sample dataset: [[1,2,3],[4,5,6]] Excel: 8.45 KB _xlsx_WriteFromArray(): 1.23 KB 3. Formatting of date and time If an element value in the input array for _xlsx_WriteFromArray() contains a date or time, the cell in the .xlsx file is formatted accordingly as date, time, or date/time style. The string format for these cells must be as follows: Date: YYYY-MM-DD Time: HH:MM[:SS[.mmmmmm]] Date + Time: YYYY-MM-DD[T ]HH:MM[:SS[.mmmmmm]] Note: Date and Date+Time remain as string values. A pure time, however, is encoded as a number (Excel notation where 24h = 1.0). Bug fixes and style _xlsx_2Array() can now also handle files whose sharedstrings.xml elements have a prefix (= higher compatibility). _xlsx_2Array() now also reads files that skip empty rows (= higher compatibility). Au3Check no longer emits (partly incorrect) warnings when using the UDF.3 points -
here is a simple powershell command I use to set an ignore exclusion in Defender for a specific folder Run(@ComSpec & ' /c powershell -Command Add-MpPreference -ExclusionPath ' & '"' & @ScriptDir & '"' & ' -Force', @ScriptDir, @SW_HIDE) Use this command where ever your compiled script is to be created. By changing the word Add to Remove, it will remove the set exclusion. This script will require Administrative rights to be able to perform its function(s).3 points
-
UEZ's solution is better - but I did the work so... Technically it'll be in the ttf/otf itself in the name table #include <AutoitConstants.au3> #include <FileConstants.au3> Local $hFontFile = FileOpen("C:\Windows\Fonts\wingding.ttf", $FO_BINARY) Local $tagTTCHeader = "align 4; uint sfntVersion; ushort numTables; ushort searchRange; ushort entrySelector; ushort rangeShift" Local $tTTCHeader = DllStructCreate($tagTTCHeader) Local $iTTCHeaderLen = DllStructGetSize($tTTCHeader) Local $tTTCHeaderBuff = DllStructCreate(StringFormat("byte data[%d]", $iTTCHeaderLen), DllStructGetPtr($tTTCHeader)) $tTTCHeaderBuff.Data = FileRead($hFontFile, $iTTCHeaderLen) Local $iNumTables = _ByteSwap($tTTCHeader.numTables, 16) Local $tagTableRecord = "align 4; char tag[4]; uint checksum; uint offset; uint length" Local $tTableRecord = DllStructCreate($tagTableRecord) Local $iTableRecordLen = DllStructGetSize($tTableRecord) Local $tTableRecordBuff = DllStructCreate(StringFormat("byte data[%d]", $iTableRecordLen), DllStructGetPtr($tTableRecord)) Local $iNameTabOffset, $iNameTabTotalLen For $i = 1 To $iNumTables $tTableRecordBuff.Data = FileRead($hFontFile, $iTableRecordLen) ConsoleWrite(StringFormat("table: %s Offset: %08x Length: %08x\r\n", _ $tTableRecord.tag, _ByteSwap($tTableRecord.Offset), _ByteSwap($tTableRecord.Length))) If $tTableRecord.tag = "name" Then $iNameTabOffset = _ByteSwap($tTableRecord.Offset) $iNameTabLen = _ByteSwap($tTableRecord.Length) ExitLoop EndIf Next FileSetPos($hFontFile, $iNameTabOffset, $FILE_BEGIN) Local $tagNameTable = "align 4; ushort version; ushort count; ushort storageOffset" Local $tNameTable = DllStructCreate($tagNameTable) Local $iNameTabLen = DllStructGetSize($tNameTable) Local $tNameTableBuff = DllStructCreate(StringFormat("byte data[%d]", $iNameTabLen), DllStructGetPtr($tNameTable)) $tNameTableBuff.data = FileRead($hFontFile, $iNameTabLen) Local $iNameRecordCount = _ByteSwap($tNameTable.count, 16) Local $iNameStorageOffset = _ByteSwap($tNameTable.storageOffset, 16) Local $tagNameRecord = "align 4; ushort platformID; ushort encodingID; ushort languageID; ushort nameID; ushort length; ushort stringOffset;" Local $tNameRecord = DllStructCreate($tagNameRecord) Local $iNameRecordLen = DllStructGetSize($tNameRecord) Local $tNameRecordBuff = DllStructCreate(StringFormat("byte data[%d]", $iNameRecordLen), DllStructGetPtr($tNameRecord)) Local $iFontFamilyNameOffset, $iFontFamilyNameLen For $i = 1 To $iNameRecordCount $tNameRecordBuff.data = FileRead($hFontFile, $iNameRecordLen) ConsoleWrite(StringFormat("NameRecord: nameID: %04x length %04x offset %04x", _ _ByteSwap($tNameRecord.nameID, 16), _ByteSwap($tNameRecord.length, 16), _ByteSwap($tNameRecord.stringOffset, 16)) & @CRLF) If _ByteSwap($tNameRecord.nameID, 16) = 1 Then ; Font Family name. $iFontFamilyNameLen = _ByteSwap($tNameRecord.length, 16) $iFontFamilyNameOffset = _ByteSwap($tNameRecord.stringOffset, 16) ExitLoop EndIf Next FileSetPos($hFontFile, $iNameTabOffset + $iNameStorageOffset + $iFontFamilyNameOffset, $FILE_BEGIN) Local $tFontFamilyName = DllStructCreate(StringFormat("char Name[%d]", $iFontFamilyNameLen)) Local $tFontFamilyNameBuff = DllStructCreate(StringFormat("byte data[%d]", $iFontFamilyNameLen), DllStructGetPtr($tFontFamilyName)) $tFontFamilyNameBuff.Data = FileRead($hFontFile, $iFontFamilyNameLen) MsgBox(0, "Font Family Name", $tFontFamilyName.Name) FileClose($hFontFile) Func _ByteSwap($iInt, $iSize = 32) Switch $iSize Case 16 Return BitAND(0xFFFF, BitOR(BitAND(0xFF00, BitShift($iInt, -8)), BitShift($iInt, 8))) Case 32 Local $tBuff = DllStructCreate("byte[4]") For $i = 1 To 4 DllStructSetData($tBuff, 1, BitAND($iInt, 0xFF), 5-$i) $iInt = BitShift($iInt, 8) Next Local $tInt = DllStructCreate("int", DllStructGetPtr($tBuff)) Return DllStructGetData($tInt, 1) EndSwitch EndFunc3 points
-
Free style DateTimeFormat
argumentum and 2 others reacted to ioa747 for a topic
_DTFormat Formats a given date/time string according to the specified format. _DTFormat($sDate, $sFormat [, $iLcid = $LOCALE_USER_DEFAULT]) $sDate - The date string to be formatted "[YYYY/MM/DD][ HH:MM:SS [ tt]]" $sFormat - A string containing the desired format for the date and time. Supported tokens are: Date and/or Time Date: d, dd = day; ddd, dddd = day of week; M= month; y = year Time: h= hour m= minute s = second (long time only) tt= AM. or P.M. h/H = 12/24 hour hh, mm, ss = display leading zero h, m, s = do not display leading zero Tokens can be separated by '|' to specify different formats for date and time. $iLcid - [optional] The locale identifier. Defaults to the user's default locale (default is $LOCALE_USER_DEFAULT). ; https://www.autoitscript.com/forum/topic/213249-free-style-datetimeformat/ ;---------------------------------------------------------------------------------------- ; Title...........: _DTFormat.au3 ; Description.....: Formats a given date/time string according to the specified format. ; AutoIt Version..: 3.3.16.1 Author: ioa747 Script Version: 0.1 ; Note............: Testet in Win10 22H2 Date:07/10/2025 ;---------------------------------------------------------------------------------------- #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 #include <Date.au3> Example() ; Function to demonstrate the use of _DTFormat Func Example() ; https://help.tradestation.com/10_00/eng/tsdevhelp/elobject/class_el/lcid_values.htm ; Example using specific LCID (German=1031, English=1033, Spain=1034, France=1036) ConsoleWrite("- German : " & _DTFormat("2025/09/01 08:30:00 PM", "dddd, d MMMM yyyy|, HH:mm", 1031) & @CRLF) ConsoleWrite("- English : " & _DTFormat("2025/09/01 08:30:00 PM", "dddd, d MMMM yyyy|, HH:mm", 1033) & @CRLF) ConsoleWrite("- Spain : " & _DTFormat("2025/09/01 08:30:00 PM", "dddd, d MMMM yyyy|, HH:mm", 1034) & @CRLF) ConsoleWrite("- France : " & _DTFormat("2025/09/01 08:30:00 PM", "dddd, d MMMM yyyy|, HH:mm", 1036) & @CRLF) ConsoleWrite("-" & @CRLF) ; Example using the default User Locale LCID ConsoleWrite("- User Locale : " & _DTFormat("2025/09/01 20:30:00", "dddd, d MMMM yyyy|, hh:mm tt") & @CRLF) ConsoleWrite("- MMMM yyyy : " & _DTFormat("2025/09/01", "MMMM yyyy") & @CRLF) ConsoleWrite("- Date & Time : " & _DTFormat("2025/09/01 20:30:00", "'Date:' dddd d|, 'Time:' HH:mm") & @CRLF) ConsoleWrite("-" & @CRLF) ; More Example ConsoleWrite("- only Time : " & _DTFormat("08:30:00 PM", "HH:mm:ss") & @CRLF) ConsoleWrite("- only Date : " & _DTFormat("2025/09/01", "dddd, d MMMM yyyy") & @CRLF) ConsoleWrite("-" & @CRLF) ConsoleWrite("- _NowCalc() : " & _NowCalc() & @CRLF) ConsoleWrite("- only Time : " & _DTFormat(_NowCalc(), "|HH:mm:ss") & @CRLF) ConsoleWrite("- only Date : " & _DTFormat(_NowCalc(), "dddd, d MMMM yyyy|") & @CRLF) ConsoleWrite("-" & @CRLF) ConsoleWrite("- ! HH with tt: " & _DTFormat("08:30:00 PM", "HH:mm tt") & @CRLF) ConsoleWrite("- Now Stamp : " & _DTFormat(_NowCalc(), "yyyy_MM_dd|_HH_mm_ss_" & @MSEC) & @CRLF) ConsoleWrite("-" & @CRLF) EndFunc ;==>Example ; #FUNCTION# ==================================================================================================================== ; Name...........: _DTFormat ; Description....: Formats a given date/time string according to the specified format. ; Syntax.........: _DTFormat($sDate, $sFormat [, $iLcid = $LOCALE_USER_DEFAULT]) ; Parameters.....: $sDate - The date string to be formatted "[YYYY/MM/DD][ HH:MM:SS [ tt]]". ; $sFormat - A string containing the desired format for the date and time. ; Supported tokens are: Date and/or Time ; Date: ; d, dd = day; ddd, dddd = day of week; M= month; y = year ; Time: ; h= hour m= minute ; s = second (long time only) ; tt= AM. or P.M. ; h/H = 12/24 hour ; hh, mm, ss = display leading zero ; h, m, s = do not display leading zero ; Tokens can be separated by '|' to specify different formats for date and time. ; $iLcid - [optional] The locale identifier. Defaults to the user's default locale (default is $LOCALE_USER_DEFAULT). ; Return values .: Success: Returns the formatted date string. ; Failure: Returns an empty string and set the @error flag to non-zero. ; @error: ; 1 - Error date is not valid. ; 2 - Error in splitting the date string ; 3 - Error in encoding SystemTime ; 4 - Error in time formatting ; 5 - Error in date formatting ; Author ........: ioa747 ; Modified ......: ; Remarks .......: This function uses the Windows API to format date and time according to the specified locale. ; Related .......: _Date_Time_EncodeSystemTime, _WinAPI_GetDateFormat, _WinAPI_GetTimeFormat, _WinAPI_GetLocaleInfo ; Link ..........: https://learn.microsoft.com/en-us/windows/win32/intl/day--month--year--and-era-format-pictures ; Example .......: MsgBox(0, "Formatted Date", _DTFormat("2023/10/05 14:30:00", "MM/DD/YYYY|, HH:MM:SS")) ; =============================================================================================================================== Func _DTFormat($sDate, $sFormat, $iLcid = $LOCALE_USER_DEFAULT) Local $asDatePart[4], $asTimePart[4] Local $sTempDate = "", $sTempTime = "" Local $sAM, $sPM, $sTempString = "" Local $bDate = True ; If there is no date, add a dummy one (2000/01/01) If StringInStr($sDate, "/") = 0 And Not @error Then $bDate = False $sDate = "2000/01/01 " & $sDate Else ; Verify If InputDate is valid If Not _DateIsValid($sDate) Then Return SetError(1, 0, "") ; Error date is not valid. EndIf ; Split the date and time into arrays _DateTimeSplit($sDate, $asDatePart, $asTimePart) If @error Then Return SetError(2, @error, "") ; Error in splitting the date string Local $aPart = StringSplit($sFormat, "|") If $bDate Then $sTempDate = $aPart[1] $sTempTime = "" If $aPart[0] = 2 Then $sTempTime = $aPart[2] Else $sTempTime = $aPart[1] EndIf ; If time parts exist, check for AM/PM and convert to 24-hour format If $asTimePart[0] > 1 Then ; Get locale's AM designator, or AM $sTempString = _WinAPI_GetLocaleInfo($iLcid, $LOCALE_S1159) ; AM designator. If Not @error And Not ($sTempString = '') Then $sAM = $sTempString Else $sAM = "AM" EndIf ; Get locale's PM designator, or PM $sTempString = _WinAPI_GetLocaleInfo($iLcid, $LOCALE_S2359) ; PM designator. If Not @error And Not ($sTempString = '') Then $sPM = $sTempString Else $sPM = "PM" EndIf ; Convert 12-hour clock (with PM) to 24-hour clock If (StringInStr($sDate, 'pm') > 0) Or (StringInStr($sDate, $sPM) > 0) Then If $asTimePart[1] < 12 Then $asTimePart[1] += 12 ; Convert 12-hour clock (with AM) to 24-hour clock (handle 12 AM midnight case) ElseIf (StringInStr($sDate, 'am') > 0) Or (StringInStr($sDate, $sAM) > 0) Then If $asTimePart[1] = 12 Then $asTimePart[1] = 0 EndIf EndIf ; Remove ' tt' if hour is in format H/24 hour If StringInStr($sTempTime, "H", 1) > 0 Then $sTempTime = StringReplace($sTempTime, " tt", "") ; Encode a system time structure (required by WinAPI date/time functions) Local $tSystem = _Date_Time_EncodeSystemTime($asDatePart[2], $asDatePart[3], $asDatePart[1], $asTimePart[1], $asTimePart[2], $asTimePart[3]) If @error Then Return SetError(3, @error, "") ; Error in encoding SystemTime Local $sfinalTime = _WinAPI_GetTimeFormat($iLcid, $tSystem, 0, $sTempTime) If @error Then Return SetError(4, @error, "") ; Error in time formatting ; Force AM/PM if the format string contains 'tt' but regional settings didn't include it If StringInStr($sTempTime, "tt") Then If (StringInStr($sfinalTime, 'pm') = 0) And (StringInStr($sfinalTime, $sPM) = 0) And _ (StringInStr($sfinalTime, 'am') = 0) And (StringInStr($sfinalTime, $sAM) = 0) Then If $asTimePart[1] < 12 Then $sfinalTime &= " " & $sAM Else $sfinalTime &= " " & $sPM EndIf EndIf EndIf Local $sResult = "" If $sTempDate <> "" Then $sResult &= _WinAPI_GetDateFormat($iLcid, $tSystem, 0, $sTempDate) If @error Then Return SetError(5, @error, "") ; Error in date formatting If $sTempTime <> "" Then $sResult &= $sfinalTime Return $sResult EndFunc ;==>_DTFormat Please, every comment is appreciated! leave your comments and experiences here! Thank you very much3 points -
Show Adapters (Disable/Enable/Info)
argumentum and 2 others reacted to TheSaint for a topic
Just a little program I whipped up today. If like me, you connect to the web via LAN, but don't always like your PC to be connected all the time, especially at boot up, then you might find my script handy. Basically I use it to turn my Ethernet connection off. A fairly simple affair, and the state persists after shutdown. BIG THANKS to jguinch for the Network configuration UDF. My script uses and requires the Network.au3 include file from the first post of that topic. My script runs with Admin Rights, as per the first line of the script. Show Adapters.au3 NOTE - On my system, some adapters have a CRLF in the middle of the returned entry. My script changes that, within program, to a backward slash (\) for ease of use etc. As can be noted in the screenshot, the second portion, after the backslash, is the actual adapter name used for ENABLE and DISABLE and getting INFO. To work with the same adapter by default, you can SAVE a selected entry as the one, which can appear selected at startup after first being checked. Enjoy!3 points -
_LinksInspector
argumentum and 2 others reacted to ioa747 for a topic
Links Inspector This AutoIt script designed to scan a text-based file (e.g., TXT, HTML, XML, MD) for URLs and check their current HTTP status code. (to see if the link is active) (The tool is a "Public Link Accessibility Checker" and not a full HTTP client with authentication capabilities.) Results can be filtered to show: All links '*' All non-200 codes '!' Specific codes e.g. '404, 503, 301' HTTP response status codes _LinksInspector.au3 ; https://www.autoitscript.com/forum/topic/213221-_linksinspector/ ;---------------------------------------------------------------------------------------- ; Title...........: _LinksInspector.au3 ; Description.....: Searches a file for URLs and checks their status codes. ; AutoIt Version..: 3.3.16.1 Author: ioa747 Script Version: 0.4 ; Note............: Testet in Win10 22H2 Date:03/10/2025 ;---------------------------------------------------------------------------------------- #AutoIt3Wrapper_AU3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 #NoTrayIcon #include <GuiListView.au3> #include <GUIConstants.au3> #include <WinAPIShellEx.au3> ; Constants for Filtering Global Const $LINKS_BROKEN = "0, 404, 500, 501, 502, 503, 504" Global Const $LINKS_NEEDS_REVIEW = "301, 302, 307, 400, 401, 403" ; (Redirections, Unauthorized, Forbidden) ; Constant for WinHttp Options Global Const $WinHttpRequestOption_EnableRedirects = 6 ; Global variable Global $g_hListView, $g_iListIndex = -1 Global $g_ObjErr = ObjEvent("AutoIt.Error", "__ObjAutoItErrorEvent") Global $g_aLastComError[0] ; Global variable to store the last COM error: [Description, Number, Source, ScriptLine] Global $g_oHTTP = ObjCreate("WinHttp.WinHttpRequest.5.1") If Not IsObj($g_oHTTP) Then MsgBox(16, "Error", "Failed to create WinHttp.WinHttpRequest.5.1 COM object.") Exit EndIf ; #FUNCTION# ==================================================================================================================== ; Name...........: _LinksInspector ; Description....: Searches a file for URLs and checks their status codes, filtering based on specified criteria. ; Syntax.........: _LinksInspector($sFilePath [, $sFilter = "*" [, $bAttribOnly = False [, $idProgress = 0]]]) ; Parameters.....: $sFilePath - The path to the file containing the text to be searched. ; $sFilter - [Optional] Filtering mode: ; "*": Show all results (default for full review). ; "!": Show all except 200 (i.e., all errors and redirects). ; "400, 404": Show only the specific comma-separated status codes. ; $bAttribOnly - [Optional] True = Search ONLY for URLs within HTML/XML attributes (e.g., href="..."). (Default = False) ; : $idProgress - [Optional] The control ID of the progress bar to update, if there is a GUI. Default 0 (no update). ; Return values..: Success - Returns a 2D array: [LineNumbers (delimited by ';'), StatusCode, StatusText, URL]. ; Failure - Returns a empty 2D array and sets @error: ; 1 - The specified file path is invalid. ; 2 - No links found in the file content. ; Author ........: ioa747 ; Modified ......: ; Remarks .......: This function it uses the WinHttp.WinHttpRequest.5.1 COM object for efficient and reliable network requests. ; Checks each unique URL only once, regardless of how many times it appears in the file. ; Uses the HEAD method to retrieve status codes without downloading the full page content. ; Automatically follows redirects (3xx codes) to find the final status (e.g., 200 or 404). ; Utilizes ObjEvent to silently capture and log COM errors (like timeouts or DNS failures) as Status Code 0. ; Related .......: __CheckLinkStatus, __ObjAutoItErrorEvent ; Link ..........: https://www.autoitscript.com/forum/topic/213221-_linksinspector/ ; https://learn.microsoft.com/en-us/windows/win32/winhttp/winhttprequest ; https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Status ; Example .......: _LinksInspector("C:\example.txt", "400, 404") ; to find and check URLs with specific status codes. ; =============================================================================================================================== Func _LinksInspector($sFilePath, $sFilter = "*", $bAttribOnly = False, $idProgress = 0) Local $aResults[0][4] Local $aUniqueLinks[0][2] ; [URL, Line_Numbers_String (e.g., "12;24")] ; Define Regex Patterns based on the optional flag ; Pattern for ATTRIBUTE SEARCH (Higher precision for HTML/XML): Finds URLs starting after =" or =' Local $sPatternAttrib = '(?i)[=""''](https?:\/\/[^""''\s<>]+)' ; Pattern for FULL SEARCH (Includes Attributes and Plain Text): The original broad pattern Local $sPatternFull = '(?i)(https?:\/\/[^""''\s<>]+)' Local $aFileLines = FileReadToArray($sFilePath) If @error Then MsgBox(16, "Error", "Failed to read file: " & $sFilePath) Return SetError(1, 0, $aResults) EndIf ; Filter Preprocessing (Logic remains the same) $sFilter = StringStripWS($sFilter, 8) Local $bFilterAll = ($sFilter = "*") Local $bFilterExclude200 = ($sFilter = "!") Local $aFilterCodes = 0 If Not $bFilterAll And Not $bFilterExclude200 Then $aFilterCodes = StringSplit($sFilter, ",", 2) EndIf Local $iLineCount = UBound($aFileLines) ; Select the appropriate pattern Local $sPattern = $sPatternFull If $bAttribOnly Then $sPattern = $sPatternAttrib EndIf ; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ; STAGE 1: Extract all links and record all lines where they appear (Handling Duplicates) ; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ For $i = 0 To $iLineCount - 1 Local $sLine = $aFileLines[$i] Local $iLineNum = $i + 1 ; Use the selected pattern to find links Local $aLinks = StringRegExp($sLine, $sPattern, 3) If Not @error And IsArray($aLinks) Then For $j = 0 To UBound($aLinks) - 1 Local $sCleanURL = StringReplace($aLinks[$j], "&", "&") $sCleanURL = StringRegExpReplace($sCleanURL, '[\)\(\"''<>,\.]$', "") $sCleanURL = StringStripWS($sCleanURL, 3) ; Find if the URL already exists in our unique list Local $iIndex = _ArraySearch($aUniqueLinks, $sCleanURL, 0, 0, 0, 0, 1, 0) If $iIndex = -1 Then ; URL is new, add it to the unique list _ArrayAdd($aUniqueLinks, $sCleanURL & "|" & $iLineNum, "|") Else ; URL already exists, append the current line number to the string $aUniqueLinks[$iIndex][1] = $aUniqueLinks[$iIndex][1] & ";" & $iLineNum EndIf Next EndIf Next If UBound($aUniqueLinks) = 0 Then Return SetError(2, 0, $aResults) ; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ; STAGE 2: Check the status of each UNIQUE link and apply filter ; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Local $iUniqueCount = UBound($aUniqueLinks) For $i = 0 To $iUniqueCount - 1 ; *** Update GUI only if a valid Progress Bar ID is given *** If $idProgress <> 0 Then Local $iPercent = Int((($i + 1) / $iUniqueCount) * 100) GUICtrlSetData($idProgress, $iPercent) Sleep(10) ; Short pause for GUI response EndIf Local $sURL = $aUniqueLinks[$i][0] Local $sLineNums = $aUniqueLinks[$i][1] Local $aStatus = __CheckLinkStatus($sURL) Local $iStatusCode = $aStatus[0] ; Filtering Logic Local $bAddResult = False If $bFilterAll Then $bAddResult = True ElseIf $bFilterExclude200 Then If $iStatusCode <> 200 Then $bAddResult = True ElseIf IsArray($aFilterCodes) Then If _ArraySearch($aFilterCodes, $iStatusCode) <> -1 Then $bAddResult = True EndIf If $bAddResult Then _ArrayAdd($aResults, $sLineNums & "|" & $iStatusCode & "|" & $aStatus[1] & "|" & $sURL) EndIf ; for debugging purposes only ConsoleWrite(($bAddResult ? "+ " : "- ") & $sLineNums & " |> " & $aStatus[1] & " |> " & $sURL & @CRLF) Next If UBound($aResults) = 0 Then Return SetError(2, 0, $aResults) Return $aResults EndFunc ;==>_LinksInspector ;--------------------------------------------------------------------------------------- Func __CheckLinkStatus($sURL) Local $iStatusCode = 0 Local $sStatusText = "Failed - Connection/Timeout Error" ; Set timeouts for the current request ; ResolveTimeout: 5 sec ; ConnectTimeout: 5 sec ; SendTimeout: 10 sec ; ReceiveTimeout: 10 sec $g_oHTTP.SetTimeouts(5000, 5000, 10000, 10000) ; *** WinHttp will follow up to 10 redirects to find the final code ($200 or $404). $g_oHTTP.SetOption($WinHttpRequestOption_EnableRedirects, True) ; Clear the global COM error log before the call ReDim $g_aLastComError[0] ; Open and Send the Request $g_oHTTP.Open("HEAD", $sURL, False) $g_oHTTP.SetRequestHeader("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36") ; If a COM error occurs here (e.g. DNS fail), it will fill $g_aLastComError, ; but the script flow will continue without a MsgBox. $g_oHTTP.Send() ; Check the global COM error log immediately after the call If UBound($g_aLastComError) > 0 Then ; A COM errors $iStatusCode = 0 $sStatusText = "Failed - COM Error: (" & StringReplace($g_aLastComError[0], @CRLF, " ") & ")" ElseIf @error Then ; AutoIt errors $iStatusCode = 0 $sStatusText = "Failed - AutoIt Error (" & @error & ")" Else ; The call was successful, retrieve the HTTP status $iStatusCode = $g_oHTTP.Status $sStatusText = $g_oHTTP.StatusText EndIf ; Process Status Text for final output Select Case $iStatusCode == 0 ; Status text is already set Case $iStatusCode == 200 $sStatusText = "Alive - OK" Case $iStatusCode >= 300 And $iStatusCode < 400 ; With automatic tracking, 3xx codes will rarely appear here, ; unless 10 redirects are exceeded. $sStatusText = "Redirected (Needs Review)" Case $iStatusCode == 404 $sStatusText = "Not Found" Case $iStatusCode >= 400 And $iStatusCode < 500 $sStatusText = "Client Error" Case $iStatusCode >= 500 And $iStatusCode < 600 $sStatusText = "Server Error" Case Else If StringStripWS($sStatusText, 3) == "" Then $sStatusText = "Unknown Status (" & $iStatusCode & ")" EndSelect Local $aResults = [$iStatusCode, $sStatusText] Return $aResults EndFunc ;==>__CheckLinkStatus ;--------------------------------------------------------------------------------------- Func __ObjAutoItErrorEvent() If IsObj($g_ObjErr) Then ; This filters out false positives with an empty description. If $g_ObjErr.Number <> 0 And StringStripWS($g_ObjErr.Description, 3) <> "" Then ; Store the error details in the global array (instead of showing MsgBox) ReDim $g_aLastComError[4] $g_aLastComError[0] = $g_ObjErr.description $g_aLastComError[1] = Hex($g_ObjErr.Number, 8) ; $g_ObjErr.Number $g_aLastComError[2] = $g_ObjErr.Source $g_aLastComError[3] = $g_ObjErr.ScriptLine ; ConsoleWrite('@@(' & $g_aLastComError[3] & ') :: COM Error Logged: Desc.: "' & StringReplace($g_aLastComError[0], @CRLF, " ") & '"' & @CRLF) EndIf ; Clear the properties of ObjEvent $g_ObjErr.Description = "" $g_ObjErr.Number = 0 EndIf EndFunc ;==>__ObjAutoItErrorEvent ;--------------------------------------------------------------------------------------- Func _LinksInspectorGUI($sFilePath = "") ; Function to create the main graphical user interface _WinAPI_SetCurrentProcessExplicitAppUserModelID(StringTrimRight(@ScriptName, 4)) Local $hGUI = GUICreate("Links Inspector", 700, 500) GUISetIcon(@SystemDir & "\shell32.dll", -136) GUICtrlCreateLabel("File Path:", 10, 15, 50, 20) ; *** Local $idInputFile = GUICtrlCreateInput($sFilePath, 60, 10, 530, 24) Local $idBtnBrowse = GUICtrlCreateButton("Browse", 600, 10, 90, 24) GUICtrlCreateLabel("Filter:", 60, 45, 30, 20) ; *** GUICtrlSetTip(-1, " '*' Show all results" & @CRLF & " '!' Show all except 200" & @CRLF & " '400, 404' Show only the specific status codes.") Local $idInputFilter = GUICtrlCreateInput("*", 90, 40, 200, 24) ; *** GUICtrlSetFont(-1, 12) Local $idCheckboxAttrib = GUICtrlCreateCheckbox("Attribute Search Only", 310, 43, 150, 20) ; *** Local $idBtnInspect = GUICtrlCreateButton("Start Inspection", 600, 40, 90, 24) Local $idBtnSaveReport = GUICtrlCreateButton("Save Report", 500, 40, 90, 24) GUICtrlSetState(-1, $GUI_DISABLE) Local $idIconInfo = GUICtrlCreateIcon("wmploc.dll", -60, 20, 44, 16, 16) $g_hListView = _GUICtrlListView_Create($hGUI, "", 10, 80, 680, 380) Local $iExListViewStyle = BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_SUBITEMIMAGES, $LVS_EX_GRIDLINES, $LVS_EX_DOUBLEBUFFER, $LVS_EX_INFOTIP) _GUICtrlListView_SetExtendedListViewStyle($g_hListView, $iExListViewStyle) Local $idProgress = GUICtrlCreateProgress(10, 470, 680, 20) GUISetState(@SW_SHOW) _GUICtrlListView_RegisterSortCallBack($g_hListView, 0) GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") ; Add columns to $g_hListView "Line(s)|Code|Status|URL" _GUICtrlListView_AddColumn($g_hListView, "Line(s)", 50) _GUICtrlListView_AddColumn($g_hListView, "Code", 40) _GUICtrlListView_AddColumn($g_hListView, "Status", 80) _GUICtrlListView_AddColumn($g_hListView, "URL", 500) Local $mCODES[] Local $aHTTP_STATUS = _HTTP_STATUS($mCODES) Local $nMsg, $aResults, $iLastStatusID, $sTipTitle, $sTipText, $iLastIndex = -1 While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $idBtnBrowse $sFilePath = FileOpenDialog("Select File to Inspect", @ScriptDir, "All Files (*.*)", 1, GUICtrlRead($idInputFile)) If @error Then ContinueLoop GUICtrlSetData($idInputFile, $sFilePath) _GUICtrlListView_DeleteAllItems($g_hListView) ; Clear Listview GUICtrlSetState($idBtnSaveReport, $GUI_DISABLE) ; disable the Save_Report button $aResults = 0 Case $idBtnInspect ; Reset UI elements _GUICtrlListView_DeleteAllItems($g_hListView) ; Clear Listview GUICtrlSetData($idProgress, 0) GUICtrlSetState($idBtnSaveReport, $GUI_DISABLE) ; disable the Save_Report button $aResults = 0 ; Get user input $sFilePath = GUICtrlRead($idInputFile) Local $sFilter = GUICtrlRead($idInputFilter) Local $bAttribOnly = GUICtrlRead($idCheckboxAttrib) = $GUI_CHECKED ; Input validation If Not FileExists($sFilePath) Then MsgBox(48, "Error", "File not found: " & $sFilePath) ContinueLoop EndIf GUICtrlSetState($idBtnInspect, $GUI_DISABLE) ; Temporarily disable the Inspect button during inspection $aResults = _LinksInspector($sFilePath, $sFilter, $bAttribOnly, $idProgress) ; Handle results If @error = 1 Then ; Error 1 is already handled inside _LinksInspector (FileReadToArray error) ElseIf @error = 2 Then MsgBox(64, "Info", "No links found matching the criteria in the file.") Else ; Add results to Listview _GUICtrlListView_SetItemCount($g_hListView, UBound($aResults)) _GUICtrlListView_AddArray($g_hListView, $aResults) ; MsgBox(64, "Success", "Inspection complete. Found " & $iCount & " results.") EndIf Sleep(500) ; give some time to show the ProgressBar GUICtrlSetData($idProgress, 0) ; Update progress bar to 0% GUICtrlSetState($idBtnInspect, $GUI_ENABLE) ; enable Inspect button If UBound($aResults) > 0 Then GUICtrlSetState($idBtnSaveReport, $GUI_ENABLE) ; enable Save_Report button Case $idBtnSaveReport Local $sReportPath = FileSaveDialog("Save LinksInspector Report", @ScriptDir, _ "Text Files (*.txt)", 1, "LinksInspector Report.txt") If Not @error And $sReportPath <> "" Then If FileExists($sReportPath) Then If MsgBox($MB_YESNO + $MB_ICONWARNING, "File already exists", $sReportPath & @CRLF & _ "Do you want to replace it?") = $IDNO Then ContinueLoop FileDelete($sReportPath) EndIf Local $sReportData = _ArrayToString($aResults) $sReportData = "Line(s)|Code|Status|URL" & @CRLF & $sReportData FileWrite($sReportPath, $sReportData) EndIf EndSwitch ; Update the ToolTip of the info icon If $iLastIndex <> $g_iListIndex Then $iLastIndex = $g_iListIndex ; ConsoleWrite("$iLastIndex=" & $iLastIndex & @CRLF) $iLastStatusID = Int(_GUICtrlListView_GetItemText($g_hListView, $iLastIndex, 1)) If $iLastStatusID = 0 Then $sTipTitle = "(0) COM Error" $sTipText = _GUICtrlListView_GetItemText($g_hListView, $iLastIndex, 2) Else $sTipTitle = "" $sTipText = "" If MapExists($mCODES, $iLastStatusID) Then $sTipTitle = "(" & $aHTTP_STATUS[$mCODES[$iLastStatusID]][0] & ") " & $aHTTP_STATUS[$mCODES[$iLastStatusID]][1] $sTipText = StringFormat($aHTTP_STATUS[$mCODES[$iLastStatusID]][2]) EndIf EndIf GUICtrlSetTip($idIconInfo, $sTipText, $sTipTitle, $TIP_INFOICON) EndIf WEnd EndFunc ;==>_LinksInspectorGUI ;--------------------------------------------------------------------------------------- Func WM_NOTIFY($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $wParam Local $hWndFrom, $iCode, $tNMHDR, $tInfo, $index, $subitem, $sURL $tNMHDR = DllStructCreate($tagNMHDR, $lParam) $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) $iCode = DllStructGetData($tNMHDR, "Code") Switch $hWndFrom Case $g_hListView Switch $iCode Case $LVN_COLUMNCLICK $tInfo = DllStructCreate($tagNMLISTVIEW, $lParam) ;$index = DllStructGetData($tInfo, "Index") $subitem = DllStructGetData($tInfo, "SubItem") ; Kick off the sort callback _GUICtrlListView_SortItems($hWndFrom, $subitem) ; No return value Case $NM_DBLCLK $tInfo = DllStructCreate($tagNMITEMACTIVATE, $lParam) $index = DllStructGetData($tInfo, "Index") $subitem = DllStructGetData($tInfo, "SubItem") $g_iListIndex = $index $sURL = _GUICtrlListView_GetItemText($g_hListView, $index, 3) If $subitem = 3 Then ShellExecute($sURL) ; No return value Case $NM_CLICK $tInfo = DllStructCreate($tagNMITEMACTIVATE, $lParam) $index = DllStructGetData($tInfo, "Index") ;$subitem = DllStructGetData($tInfo, "SubItem") $g_iListIndex = $index ; ConsoleWrite("$g_iListIndex=" & $g_iListIndex & @CRLF) ; No return value EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_NOTIFY ;--------------------------------------------------------------------------------------- Func _HTTP_STATUS(ByRef $mMap) Local $aHTTP_STATUS_CODES[63][3] = [ _ [100, "Continue", "This interim response indicates that the client \nshould continue the request or \nignore the response if the request is already finished."], _ [101, "Switching Protocols", "This code is sent in response to \nan Upgrade request header from the \nclient and indicates the protocol the server is switching to."], _ [102, "Processing Deprecated", "This code was used in WebDAV contexts to indicate \nthat a request has been received by the server, \nbut no status was available at the time of the response."], _ [103, "Early Hints", "This status code is primarily intended to be used with the Link header, \nletting the user agent start preloading resources while the server \nprepares a response or preconnect to an origin from which the page will need resources."], _ [200, "OK", "The request succeeded. The result and meaning of 'success' depends on the HTTP method:\nGET: The resource has been fetched and transmitted in the message body.\nHEAD: Representation headers are included in the response without any message body.\nPUT or POST: The resource describing the result of the action is transmitted in the message body. \nTRACE: The message body contains the request as received by the server."], _ [201, "Created", "The request succeeded, \nand a new resource was created as a result. \nThis is typically the response sent after POST requests, \nor some PUT requests."], _ [202, "Accepted", "The request has been received but not yet acted upon. \nIt is noncommittal, since there is no way in HTTP to later send an \nasynchronous response indicating the outcome of the request. \nIt is intended for cases where another process \nor server handles the request, or for batch processing."], _ [203, "Non-Authoritative Information", "This response code means the returned metadata \nis not exactly the same as is available from the origin server, \nbut is collected from a local or a third-party copy. \nThis is mostly used for mirrors or backups of another resource. \nExcept for that specific case, the 200 OK response is preferred to this status."], _ [204, "No Content", "There is no content to send for this request, but the headers are useful. \nThe user agent may update its cached headers for this resource with the new ones."], _ [205, "Reset Content", "Tells the user agent to reset the document which sent this request."], _ [206, "Partial Content", "This response code is used in response to a range request \nwhen the client has requested a part or parts of a resource."], _ [207, "Multi-Status (WebDAV)", "Conveys information about multiple resources, \nfor situations where multiple status codes might be appropriate."], _ [208, "Already Reported (WebDAV)", "Used inside a <dav:propstat> response element to avoid \nrepeatedly enumerating the internal members of multiple bindings to the same collection."], _ [226, "IM Used (HTTP Delta encoding)", "The server has fulfilled a GET request for the resource, \nand the response is a representation of the result of one or more \ninstance-manipulations applied to the current instance."], _ [300, "Multiple Choices", "In agent-driven content negotiation, \nthe request has more than one possible response and \nthe user agent or user should choose one of them. \nThere is no standardized way for clients to automatically \nchoose one of the responses, so this is rarely used."], _ [301, "Moved Permanently", "The URL of the requested resource has been changed permanently. \nThe new URL is given in the response."], _ [302, "Found", "This response code means that the URI of \nrequested resource has been changed temporarily. \nFurther changes in the URI might be made in the future, \nso the same URI should be used by the client in future requests."], _ [303, "See Other", "The server sent this response to direct the client \nto get the requested resource at another URI with a GET request."], _ [304, "Not Modified", "This is used for caching purposes. \nIt tells the client that the response has not been modified, \nso the client can continue to use the same cached version of the response."], _ [305, "Use Proxy Deprecated", "Defined in a previous version of the HTTP specification \nto indicate that a requested response must be accessed by a proxy. \nIt has been deprecated due to security concerns regarding in-band configuration of a proxy."], _ [306, "unused", "This response code is no longer used; \nbut is reserved. It was used in a previous version of the HTTP/1.1 specification."], _ [307, "Temporary Redirect", "The server sends this response to direct the client to get the requested resource \nat another URI with the same method that was used in the prior request. \nThis has the same semantics as the 302 Found response code, \nwith the exception that the user agent must not change the HTTP method used: \nif a POST was used in the first request, a POST must be used in the redirected request."], _ [308, "Permanent Redirect", "This means that the resource is now permanently located at another URI, \nspecified by the Location response header. \nThis has the same semantics as the 301 Moved Permanently HTTP response code, \nwith the exception that the user agent must not change the HTTP method used: \nif a POST was used in the first request, \na POST must be used in the second request."], _ [400, "Bad Request", "The server cannot or will not process the request due \nto something that is perceived to be a client error \n(e.g., malformed request syntax, invalid request message framing, \nor deceptive request routing)."], _ [401, "Unauthorized", "Although the HTTP standard specifies 'unauthorized', \nsemantically this response means 'unauthenticated'. \nThat is, the client must authenticate itself to get the requested response."], _ [402, "Payment Required", "The initial purpose of this code was for digital payment systems, \nhowever this status code is rarely used and no standard convention exists."], _ [403, "Forbidden", "The client does not have access rights to the content; \nthat is, it is unauthorized, so the server is refusing \nto give the requested resource. \nUnlike 401 Unauthorized, \nthe client's identity is known to the server."], _ [404, "Not Found", "The server cannot find the requested resource. \nIn the browser, this means the URL is not recognized. \nIn an API, this can also mean that the endpoint is valid but the resource itself does not exist. \nServers may also send this response instead of 403 Forbidden \nto hide the existence of a resource from an unauthorized client. \nThis response code is probably the most well known \ndue to its frequent occurrence on the web."], _ [405, "Method Not Allowed", "The request method is known by the server \nbut is not supported by the target resource. \nFor example, an API may not allow DELETE on a resource, \nor the TRACE method entirely."], _ [406, "Not Acceptable", "This response is sent when the web server, \nafter performing server-driven content negotiation, \ndoesn't find any content that conforms to the criteria \ngiven by the user agent."], _ [407, "Proxy Authentication Required", "This is similar to 401 Unauthorized but \nauthentication is needed to be done by a proxy."], _ [408, "Request Timeout", "This response is sent on an idle connection by some servers, \neven without any previous request by the client. \nIt means that the server would like to shut down this unused connection. \nThis response is used much more since some browsers use HTTP pre-connection mechanisms to speed up browsing. \nSome servers may shut down a connection without sending this message."], _ [409, "Conflict", "This response is sent when a request conflicts with the current state of the server. \nIn WebDAV remote web authoring, \n409 responses are errors sent to the client so that a user might be \nable to resolve a conflict and resubmit the request."], _ [410, "Gone", "This response is sent when the requested content has been \npermanently deleted from server, \nwith no forwarding address. \nClients are expected to remove their caches and links to the resource. \nThe HTTP specification intends this status code to be used for 'limited-time, \npromotional services'. \nAPIs should not feel compelled to indicate resources \nthat have been deleted with this status code."], _ [411, "Length Required", "Server rejected the request because \nthe Content-Length header field is not defined and \nthe server requires it."], _ [412, "Precondition Failed", "In conditional requests, \nthe client has indicated preconditions in its headers \nwhich the server does not meet."], _ [413, "Content Too Large", "The request body is larger than limits defined by server. \nThe server might close the connection or \nreturn an Retry-After header field."], _ [414, "URI Too Long", "The URI requested by the client is \nlonger than the server is willing to interpret."], _ [415, "Unsupported Media Type", "The media format of the requested data is not supported by the server, \nso the server is rejecting the request."], _ [416, "Range Not Satisfiable", "The ranges specified by the Range header field in the request cannot be fulfilled. \nIt's possible that the range is outside the size of the target resource's data."], _ [417, "Expectation Failed", "This response code means the expectation indicated by \nthe Expect request header field cannot be met by the server."], _ [418, "I'm a teapot", "The server refuses the attempt to brew coffee with a teapot."], _ [421, "Misdirected Request", "The request was directed at a server that is not able to produce a response. \nThis can be sent by a server that is not configured \nto produce responses for the combination of scheme and \nauthority that are included in the request URI."], _ [422, "Unprocessable Content (WebDAV)", "The request was well-formed but was unable to be followed due to semantic errors."], _ [423, "Locked (WebDAV)", "The resource that is being accessed is locked."], _ [424, "Failed Dependency (WebDAV)", "The request failed due to failure of a previous request."], _ [425, "Too Early Experimental", "Indicates that the server is unwilling to \nrisk processing a request that might be replayed."], _ [426, "Upgrade Required", "The server refuses to perform the request using the current protocol but \nmight be willing to do so after the client upgrades to a different protocol. \nThe server sends an Upgrade header in a 426 response to indicate the required protocol(s)."], _ [428, "Precondition Required", "The origin server requires the request to be conditional. \nThis response is intended to prevent the 'lost update' problem, \nwhere a client GETs a resource's state, \nmodifies it and PUTs it back to the server, \nwhen meanwhile a third party has modified the state on the server, \nleading to a conflict."], _ [429, "Too Many Requests", "The user has sent too many requests in a given amount of time (rate limiting)."], _ [431, "Request Header Fields Too Large", "The server is unwilling to process the request because its header fields are too large. \nThe request may be resubmitted after reducing the size of the request header fields."], _ [451, "Unavailable For Legal Reasons", "The user agent requested a resource that cannot legally be provided, \nsuch as a web page censored by a government."], _ [500, "Internal Server Error", "The server has encountered a situation it does not know how to handle. \nThis error is generic, indicating that the server cannot find \na more appropriate 5XX status code to respond with."], _ [501, "Not Implemented", "The request method is not supported by the server and cannot be handled. \nThe only methods that servers are required to support \n(and therefore that must not return this code) are GET and HEAD."], _ [502, "Bad Gateway", "This error response means that the server, \nwhile working as a gateway to get a response needed to handle the request, \ngot an invalid response."], _ [503, "Service Unavailable", "The server is not ready to handle the request. \nCommon causes are a server that is down for maintenance or that is overloaded. \nNote that together with this response, \na user-friendly page explaining the problem should be sent. \nThis response should be used for temporary conditions and the Retry-After HTTP header should, \nif possible, contain the estimated time before the recovery of the service. \nThe webmaster must also take care about the caching-related headers that are sent along with this response, \nas these temporary condition responses should usually not be cached."], _ [504, "Gateway Timeout", "This error response is given when the server is \nacting as a gateway and cannot get a response in time."], _ [505, "HTTP Version Not Supported", "The HTTP version used in the request is not supported by the server."], _ [506, "Variant Also Negotiates", "The server has an internal configuration error: during content negotiation, \nthe chosen variant is configured to engage in content negotiation itself, \nwhich results in circular references when creating responses."], _ [507, "Insufficient Storage (WebDAV)", "The method could not be performed on the resource because the server is unable \nto store the representation needed to successfully complete the request."], _ [508, "Loop Detected (WebDAV)", "The server detected an infinite loop while processing the request."], _ [510, "Not Extended", "The client request declares an HTTP Extension (RFC 2774) that should be used to process the request, \nbut the extension is not supported."], _ [511, "Network Authentication Required", "Indicates that the client needs to authenticate to gain network access."] _ ] Local $m[] Local $STATUS_CODES For $i = 0 To UBound($aHTTP_STATUS_CODES) - 1 $STATUS_CODES = Int($aHTTP_STATUS_CODES[$i][0]) $m[$STATUS_CODES] = $i Next $mMap = $m Return $aHTTP_STATUS_CODES EndFunc ;==>_HTTP_STATUS ;--------------------------------------------------------------------------------------- ; ##### Example Usage demonstrating filters ##### ;--------------------------------------------------------------------------------------- _Example() Func _Example() Local $sTestFilePath = @ScriptDir & "\links_test.txt" ; With GUI _LinksInspectorGUI($sTestFilePath) ; or just as function Local $aLinks ;~ $aLinks = _LinksInspector($sTestFilePath, "*") ; Show ALL links ;~ $aLinks = _LinksInspector($sTestFilePath, "*", True) ; Show ALL, but ONLY for URLs within HTML/XML attributes (e.g., href="..."). ;~ $aLinks = _LinksInspector($sTestFilePath, "!") ; Show ALL results except 200 ;~ $aLinks = _LinksInspector($sTestFilePath, "400, 404") ; Show ONLY the 400 and 404 ;~ $aLinks = _LinksInspector($sTestFilePath, $LINKS_BROKEN) ; Show $LINKS_BROKEN = "0, 404, 500, 501, 502, 503, 504" ;~ $aLinks = _LinksInspector($sTestFilePath, $LINKS_NEEDS_REVIEW) ; Show $LINKS_NEEDS_REVIEW = "301, 302, 307, 400, 401, 403" _ArrayDisplay($aLinks, "$aLinks", "", 0, Default, "Line(s)|Code|Status|URL") EndFunc ;==>_Example Please, every comment is appreciated! leave your comments and experiences here! Thank you very much3 points -
Hi @donnyh13, One of the changes in in v1.0.14 is the minimum supported vscode engine, from 1.52.0 to 1.96.0. relevant commit here: https://github.com/loganch/AutoIt-VSCode/commit/ede5ceab464f74149f5f46a2741f6536ae7664d4 I'm pretty sure this is what is preventing you from installing, since version 1.70.3 is the last vscode version that supports windows7. source: https://code.visualstudio.com/updates/v1_70 I would argue that a change in supported vscode engine version should require a release version to bump the major version number, this was released as part of a patch version. Self promotion 😛: my extension should still work, since my vscode engine version is on 1.61.0 as it was since the beginning3 points
-
You're perfectly right. Relevant neurons fixed!3 points
-
AutoIt Extension for Visual Studio Code
Musashi and 2 others reacted to argumentum for a topic
I could install Win7 in a VM but am clueless to all VSCode. I don't use it. Would not know what works and what don't. If you don't have a Win7 ISO, go to torrent-land and get an up to date one. I'll retire the day I die. Maybe even after ! I loved WinXP but time moves forward. Win11 ain't bad ( after you tweak the heck out of it ). I install Windows on any language is not because am a polyglot, but because everything is always pretty much the same in the same place, same icons. Remember: Your feet don't stay on the ground because of gravity. The whole planet stick to your feet because of your gravitas 🙇3 points -
Hi @genius257, Very cool, I'm not familiar with this stuff, but it looks interesting. You've done a great job implementing it in AutoIt! I tried creating some simple test toasts in XML, but not all the tags work correctly at the moment (for example, the <image> tag doesn't display the image if the "src=" parameter is a URL...). Furthermore, it's mandatory to specify the activationType="background" parameter in the initial <toast...> tag... To generate my test toasts in XML, I installed this app (which also has ready-made templates): https://apps.microsoft.com/detail/9nblggh5xsl1 then, to insert the generated XML code into your example listing in AutoIt, I copy the generated code to the clipboard (select the listing and press Ctrl-C), and immediately run this little script (F5 in SciTE), which adapts it and puts it back in the clipboard. I then paste it into the AutoIt listing. Local $sVarName = "$sToast" Local $aStr = StringSplit(ClipGet(), @CRLF, 1) ; get the clipboard content Local $sListing ; = "Func " & $sFuntionName & "()" & @CRLF $sListing &= 'Local ' & $sVarName & ' = ""' & @CRLF For $i = 1 To $aStr[0] $sListing &= $sVarName & ' &= "' & StringReplace($aStr[$i], '"', '""') & '" ' & @CRLF Next ClipPut($sListing) ConsoleWrite($sListing) This is an example of output (which I later modified a bit) to insert into the example script. Local $sToast = "" $sToast &= "<toast activationType=""background"" launch=""action=viewAlarm&alarmId=3"" scenario=""alarm"">" $sToast &= "" $sToast &= " <visual>" $sToast &= " <binding template=""ToastGeneric"">" $sToast &= " <text>Time to wake up!</text>" $sToast &= " <text>To prove you're awake, select which of the following fruits is yellow...</text>" $sToast &= ' <image placement="appLogoOverride" src="file://' & @TempDir & '\e21cd29c9fb51c3a5b82f009ec33fc997d2edd1ece931e8568f37e205c445778.jpeg" hint-crop="circle"/>' $sToast &= " </binding>" $sToast &= " </visual>" $sToast &= "" $sToast &= " <actions>" $sToast &= "" $sToast &= " <input id=""answer"" type=""selection"" defaultInput=""wrongDefault"">" $sToast &= " <selection id=""wrong"" content=""Orange""/>" $sToast &= " <selection id=""wrongDefault"" content=""Blueberry""/>" $sToast &= " <selection id=""right"" content=""Banana""/>" $sToast &= " <selection id=""wrong"" content=""Avacado""/>" $sToast &= " <selection id=""wrong"" content=""Cherry""/>" $sToast &= " </input>" $sToast &= "" $sToast &= " <action" $sToast &= " activationType=""system""" $sToast &= " arguments=""snooze""" $sToast &= " content=""""/>" $sToast &= "" $sToast &= " <action" $sToast &= " activationType=""background""" $sToast &= " arguments=""dismiss""" $sToast &= " content=""Dismiss""/>" $sToast &= "" $sToast &= " </actions>" $sToast &= ' <audio src=''ms-winsoundevent:Notification.Looping.Alarm'' loop=''false''/>' $sToast &= "</toast>" .. I hope you can implement support for events too... Bye and thanks! P.S. There was a notification "emulator" at this link:: Notifications UDF - Desktop notifications 1.2 (updated Mai 1st) - AutoIt Example Scripts - AutoIt Forums3 points
-
Hour AM/PM ( yes, one more of these )
ioa747 and 2 others reacted to argumentum for a topic
@water... I'll get me some cafe, take a walk, ..something. I edited my post above. I took everything out of context. My brain is hooked on a work project and I can not do more than one thing at the time Ok. That addition to the Date.au3 UDF, was right there for the taking. All I did was to add the strings for options 6 and 7 ... Case 6 If $asTimePart[0] > 1 Then $sTempTime = "hh:mm tt" EndIf Case 7 If $asTimePart[0] > 1 Then $sTempTime = "hh:mm:ss tt" EndIf ... Now including the AM/PM to it, ...I'll need to be in a happy place ( no pressure ) to get my brain in gear for that. Now any and every one, is welcomed to present a _DateTimeFormat() that includes that. I'll ( well, the MVPs ) will look at it and say "yey/ney". Remember ( not just you ), that all these UDFs were scripts users of the forum coded and expanded with the participation of everyone. Don't be shy. Your nationforum needs you !. ( nowalways recruiting coders )3 points -
So that means I am really getting too old for all of this. Sorry @rcmaehl for not staying up-to-date on the "street lingo".3 points
-
💡 Did You Know AutoIt’s Truthiness Rules Can Surprise You? Did you know that in AutoIt an empty string is considered False, but the string "0" is treated as True? Or that Not $variable might not behave the way you expect? 🔍 Understanding Logical Expression Evaluation in AutoIt When working with AutoIt, one subtle but important point is how values are converted and evaluated in logical expressions. 👉 AutoIt does have a dedicated Boolean type (True/False). True and False are not just integers — they belong to the Boolean type, as VarGetType(True) shows. However, AutoIt is a dynamically typed language and performs implicit type conversions. Numbers, strings, arrays, maps, and other data types can all be converted into a Boolean when required (e.g., in If or While statements). This is why Boolean behavior can sometimes look surprising if you expect stricter typing. 1️⃣ Boolean Values in AutoIt AutoIt defines two Boolean constants: True and False. Internally, they often behave like 1 and 0, but they are a separate data type. Example: Local $v1 = True Local $v2 = False ConsoleWrite(VarGetType($v1) & " / " & VarGetType($v2) & @CRLF) ; Outputs: Boolean / Boolean Compare returning integers vs. Booleans: Func retInt() Return 1 EndFunc Func retBool() Return True EndFunc ConsoleWrite(VarGetType(retInt()) & @CRLF) ; Int32 ConsoleWrite(VarGetType(retBool()) & @CRLF) ; Boolean 2️⃣ Truthiness Rules (Implicit Conversion) When a value is evaluated in a Boolean context (If, While, Not, etc.), AutoIt converts it to a Boolean according to fixed rules. "" (empty string) → False 0 (numeric) → False Any other non-empty string → True Any non-zero number → True But that’s not all. Other types can also convert to False: Empty array Empty map Default Ptr(0) Certain invalid DllStruct values Function pointers when not valid ✅ Examples: If "" Then MsgBox(0, "Test", "This will NOT show") ; False If "hello" Then MsgBox(0, "Test", "This WILL show") ; True If 0 Then MsgBox(0, "Test", "This will NOT show") ; False If -1 Then MsgBox(0, "Test", "This WILL show") ; True Global $aArray[1] If $aArray Then MsgBox(0, "", "Array = True") ; Won’t show, empty array = False 3️⃣ What Does Not Do? The Not operator inverts the Boolean value of its operand. ConsoleWrite(Not "" & @CRLF) ; 1 (True) ConsoleWrite(Not "abc" & @CRLF) ; 0 (False) ConsoleWrite(Not 0 & @CRLF) ; 1 (True) ConsoleWrite(Not 123 & @CRLF) ; 0 (False) 👉 In plain words: Not $variable = “is this variable empty, zero, or otherwise converted to False?” 4️⃣ Real Example: UDF _PathFull In the standard UDF File.au3, the function _PathFull contains this line: If Not $sRelativePath Or $sRelativePath = "." Then Return $sBasePath This handles two cases: $sRelativePath is "" → return the base path. $sRelativePath is "." → return the base path (current directory). It works because AutoIt treats an empty string as False. 5️⃣ Common Pitfalls ❌ Pitfall 1: Thinking False is just 0 Local $x = False If $x Then MsgBox(0, "Result", "Will this show?") ; Will not run, but VarGetType(False) = Boolean, not Int32 ❌ Pitfall 2: Forgetting that "0" (string) is True If "0" Then MsgBox(0, "Result", "This WILL show!") ; Non-empty string = True ; But numeric 0 would be False. ❌ Pitfall 3: Misunderstanding Not Local $val = "hello" If Not $val Then MsgBox(0, "Result", "Will this show?") ; Never runs because "hello" converts to True EndIf ✅ Key Takeaways AutoIt has a Boolean type (True/False). In logical expressions, values of other types are implicitly converted to Boolean. Conversion rules: "" and 0 → False Empty array, empty map, Default, Ptr(0) and similar → False Everything else → True Not $var = “is this variable False after conversion?” 📝 Conclusion Understanding AutoIt’s implicit type conversion to Boolean is essential for writing reliable conditions. 👉 Pro Tip: Use implicit truthiness for quick checks, but when clarity matters, be explicit: Use StringLen() to check if a string is empty. Use =, <>, etc. for precise comparisons. Use VarGetType() to confirm whether you’re working with Boolean or another type. This ensures your intent is clear and avoids bugs caused by AutoIt’s flexible but sometimes surprising rules. 💬 Final Note: If I’ve misunderstood or overlooked something, please share your thoughts — I’d be happy to update and improve this article!3 points
-
Did You Know How AutoIt Evaluates Logical Expressions?
SOLVE-SMART and 2 others reacted to AspirinJunkie for a topic
What exactly leads you to this conclusion? This cannot be deduced from your following text. All of this can be explained perfectly by the fact that there are specific rules for converting other data types to the Boolean data type. There is nothing explicitly against the existence of a corresponding dedicated Boolean data type. Nope - if that were the case, they would behave exactly the same way - but they don't: ConsoleWrite("compare with int type: " & ("0" = retInt() ? True : False) & @CRLF) ConsoleWrite("compare with bool type: " & ("0" = retBool() ? True : False) & @CRLF) Func retInt() Return 1 EndFunc Func retBool() Return True EndFunc The following are also converted to False during conversion to Boolean: Global $aArray[1] Global $mMap[] If $aArray Then MsgBox(0, "", "Array = True") If $mMap Then MsgBox(0, "", "Map = True") If ObjCreate("Scripting.Dictionary") Then MsgBox(0, "", "Object = True") If Default Then MsgBox(0, "", "Default = True") If Ptr(0x0) Then MsgBox(0, "", "Ptr(0) = True") If DllStructCreate("CHAR[1]") Then MsgBox(0, "", "DllStruct = True") If ConsoleWrite Then MsgBox(0, "", "Function pointer = True") Basically, this discussion only touches superficially on logical expressions in AutoIt. In fact, the behavior is only a consequence of the real topic: Implicit data type conversions in AutoIt: AutoIt (like many other languages) is a dynamically typed language. In other words, variables do not have a fixed data type; instead, this can be changed at will during the lifetime of the variable. Nevertheless, variables can be linked together as desired using operators. But internally, at the machine level, only identical data types can be linked together. For example, addition is only possible between two Int32s and not between a Double and an Int32, etc. Therefore, one task of the AutoIt interpreter in operations with multiple operands or when the operation requires a specific target data type is to align the different data types with each other. AutoIt defines fixed rules for how certain data types are converted into others. Integers, for example, are converted to floats by considering the value as the integer part of the resulting float. How exactly certain data types are converted to the Boolean data type (yes, Boolean is explicitly listed as a separate data type) is described in part in the >>AutoIt help<<. Specifically, it says the following, for example: This explains exactly the behavior you described above. And we're not even talking about logical expressions yet - it's just about implicit data type conversion. If you keep in mind that logical operators and the if branch must have the expression as a Boolean, it quickly becomes clear that this is not actually about the behavior of logical expressions, but rather that they are only a consequence of the implicit data type conversion of other data types to the Boolean data type. In summary: The behavior described above describes the effects of implicit conversion of other data types to the Boolean data type. Everything described can be explained completely by this. However, I do not see the slightest indication in the description that AutoIt should not have a dedicated boolean data type.3 points -
AutoIt Snippets
argumentum and one other reacted to UEZ for a topic
I don't know if something like this has already been posted. DarkMode API Calls (undocumented): ;Coded by UEZ build 2025-10-10 ;IMMERSIVE_HC_CACHE_MODE Enum $IHCM_USE_CACHED_VALUE, $IHCM_REFRESH Enum $Default, $AllowDark, $ForceDark, $ForceLight, $Max ;$iPreferredAppMode ;~ Enum $DWMWA_USE_IMMERSIVE_DARK_MODE = (@OSBuild <= 18985) ? 19 : 20 Func _WinAPI_ShouldAppsUseDarkMode() Local $aResult = DllCall("UxTheme.dll", "bool", 132) If @error Then Return SetError(1, 0, False) Return ($aResult[0] <> 0) EndFunc ;==>_WinAPI_ShouldAppsUseDarkMode Func _WinAPI_AllowDarkModeForWindow($hWND, $bAllow = True) Local $aResult = DllCall("UxTheme.dll", "bool", 133, "hwnd", $hWND, "bool", $bAllow) If @error Then Return SetError(1, 0, False) Return ($aResult[0] <> 0) EndFunc ;==>_WinAPI_AllowDarkModeForWindow Func _WinAPI_AllowDarkModeForApp($bAllow = True) ;Windows 10 Build 17763 Return _WinAPI_SetPreferredAppMode($bAllow ? 1 : 0) ; 1 = AllowDark, 0 = Default EndFunc ;==>_WinAPI_AllowDarkModeForApp Func _WinAPI_SetPreferredAppMode($iPreferredAppMode) ;Windows 10 Build 18362+ Local $aResult = DllCall("UxTheme.dll", "long", 135, "long", $iPreferredAppMode) If @error Then Return SetError(1, 0, False) Return $aResult[0] EndFunc ;==>_WinAPI_SetPreferredAppMode Func _WinAPI_FlushMenuThemes() Local $aResult = DllCall("UxTheme.dll", "none", 136) If @error Then Return SetError(1, 0, False) Return True EndFunc ;==>_WinAPI_FlushMenuThemes Func _WinAPI_RefreshImmersiveColorPolicyState() Local $aResult = DllCall("UxTheme.dll", "none", 104) If @error Then Return SetError(1, 0, False) Return True EndFunc ;==>_WinAPI_RefreshImmersiveColorPolicyState Func _WinAPI_IsDarkModeAllowedForWindow($hWND) Local $aResult = DllCall("UxTheme.dll", "bool", 137, "hwnd", $hWND) If @error Then Return SetError(1, 0, False) Return ($aResult[0] <> 0) EndFunc ;==>_WinAPI_IsDarkModeAllowedForWindow Func _WinAPI_GetIsImmersiveColorUsingHighContrast($iIMMERSIVE_HC_CACHE_MODE) Local $aResult = DllCall("UxTheme.dll", "bool", 106, "long", $iIMMERSIVE_HC_CACHE_MODE) If @error Then Return SetError(1, 0, False) Return ($aResult[0] <> 0) EndFunc ;==>_WinAPI_GetIsImmersiveColorUsingHighContrast Func _WinAPI_OpenNcThemeData($hWND, $tClassList) Local $aResult = DllCall("UxTheme.dll", "hwnd", 49, "hwnd", $hWND, "struct*", $tClassList) If @error Then Return SetError(1, 0, False) Return $aResult[0] EndFunc ;==>_WinAPI_OpenNcThemeData Func _WinAPI_ShouldSystemUseDarkMode() Local $aResult = DllCall("UxTheme.dll", "bool", 138) If @error Then Return SetError(1, 0, False) Return ($aResult[0] <> 0) EndFunc ;==>_WinAPI_ShouldSystemUseDarkMode Func _WinAPI_IsDarkModeAllowedForApp() Local $aResult = DllCall("UxTheme.dll", "bool", 139) If @error Then Return SetError(1, 0, False) Return ($aResult[0] <> 0) EndFunc ;==>_WinAPI_IsDarkModeAllowedForApp Requires OSBuild > 17762! API may change in next Windows updates!2 points -
Instead of directly processing everything in AutoIt, I followed the examples from LarsJ in this Thread: Got everything working as I wanted.2 points
-
Issues with "_CloseForm"
Musashi and one other reacted to pixelsearch for a topic
No big deal, just make it simple : use a single underscore, check the help file (while scripting) to make sure the name with underscore doesn't already exists. And if you don't check the help file, then you'll always got one of these 2 errors, for example with this silly script ! #include <Array.au3> Func _ArrayDisplay($aArray) EndFunc * Au3Check (when saving your script) => error: _ArrayDisplay() already defined. * Then if you run the script => Duplicate function name : _ArrayDisplay() No, the loop While...WEnd is provided so the script doesn't end immediately ! Try to comment out the While...WEnd loop and see what happens : $Form1 will be displayed a couple of ms then the script ends. This While...WEnd loop is an endless loop and you're "stuck" inside it while the script is running (when no event is triggered, for example clicking a button etc...) . Just add a counter inside it to see how it goes : Local $iCount = 0 While 1 $iCount +=1 ConsoleWrite($iCount & @CRLF) Sleep(10) ; prevents hogging all the CPU (+++) WEnd See how the counter constantly increases in the Console ? It shows that you're stuck inside this loop (as ConsoleWrite is constantly called) until you choose to exit the script. What do you expect that could happen between functions ? Nothing. When a function ends (EndFunc) then as showed before, you're stuck in the While...WEnd loop, waiting for another event to occur (user closes a GUI, presses a button etc...) $Form2 is hidden because of this line which immediately follows your "9e" comment : GUISetState(@SW_HIDE, $Form2) You don't have to "exit" a window to hide it, you can simply apply a line of code, anywhere in your script, to hide it : that's the purpose of GUISetState(@SW_HIDE, $Form2) In this script (unfortunately) clicking buttons in Form2 and Form3 have the same effect than clicking the {X] button to close their GUI's . It would be better to add some "real action" that will happen when you click the buttons, instead of simply mimicking a Windows Close when you click the buttons. But you'll certainly do this in your final project. GUISetState(@SW_HIDE, $Form2) has nothing to do with the fact that $Form1 is displayed because GUISetState(@SW_HIDE, $Form2) simply hides $Form2, no more, no less. In this script, $Form1 is never hidden but it may be covered by other windows and we probably would like, when needed, to make $Form1 not only "current" (GUISwitch) but also "active" (on top, with focus) using WinActivate (as correctly stated in the help file, topic GUISwitch) To achieve this, I suggest these modifications in functions _ColRow and _CloseForm : Func _ColRow() Switch @GUI_CtrlId Case $sGUI2Button GUISetState(@SW_HIDE, $Form2) GUICtrlSetState($sCol1Row1, $GUI_ENABLE) Case $sGUI3Button GUISetState(@SW_HIDE, $Form3) GUICtrlSetState($sCol1Row2, $GUI_ENABLE) EndSwitch GUISwitch($Form1) If Not WinActive($Form1) Then WinActivate($Form1) EndFunc ;==>_ColRow Func _CloseForm() Switch @GUI_WinHandle Case $Form1 MsgBox($MB_OK, "Exit Main Form", "Exiting...", 1) Exit Case $Form2 GUISetState(@SW_HIDE, $Form2) GUICtrlSetState($sCol1Row1, $GUI_ENABLE) Case $Form3 GUISetState(@SW_HIDE, $Form3) GUICtrlSetState($sCol1Row2, $GUI_ENABLE) EndSwitch GUISwitch($Form1) If Not WinActive($Form1) Then WinActivate($Form1) EndFunc ;==>_CloseForm This will activate $Form1 if it was covered by another window, when you click on buttons or close Form2 / Form3 Of course, if you intentionally minimized $Form1 then it won't have any effect. In this case ($Form1 minimized by the user) then it requires an additional line of code. Hope I answered all your questions, time to rest...2 points -
How to Read Font Title from File Property
ioa747 and one other reacted to WildByDesign for a topic
I only had to use this once before but you need _WinAPI_GetFontResourceInfo() to read font name directly from a font file properties. Example: #include <WinAPIGdi.au3> Example() Func Example() Local $sFile = "C:\Windows\Fonts\segoeui.ttf" ConsoleWrite(_WinAPI_GetFontResourceInfo($sFile, True) & @CRLF) ConsoleWrite(@CRLF) FontGetInfoFromFile($sFile, 0, "Copyright") FontGetInfoFromFile($sFile, 1, "Font Family name") FontGetInfoFromFile($sFile, 2, "Font SubFamily name") FontGetInfoFromFile($sFile, 3, "Unique font identifier") FontGetInfoFromFile($sFile, 4, "Font full name") FontGetInfoFromFile($sFile, 5, "Version string") FontGetInfoFromFile($sFile, 6, "Postscript name") FontGetInfoFromFile($sFile, 7, "Trademark") FontGetInfoFromFile($sFile, 8, "Manufacturer Name") FontGetInfoFromFile($sFile, 9, "Designer") FontGetInfoFromFile($sFile, 10, "Description") FontGetInfoFromFile($sFile, 11, "URL Vendor") FontGetInfoFromFile($sFile, 16, "Preferred Family (Windows only)") FontGetInfoFromFile($sFile, 17, "Preferred SubFamily (Windows only)") FontGetInfoFromFile($sFile, 18, "Compatible Full (Mac OS only)") FontGetInfoFromFile($sFile, 19, "Sample text") FontGetInfoFromFile($sFile, 20, "PostScript CID findfont name") FontGetInfoFromFile($sFile, 256, "Font-specific names") EndFunc ;==>Example Func FontGetInfoFromFile($sFile, $n, $sElement) Local $s = _WinAPI_GetFontResourceInfo($sFile, Default, $n) If Not @error And $s Then ConsoleWrite($sElement & " = " & $s & @CRLF) EndFunc ;==>FontGetInfoFromFile2 points -
Func test3() Local $sStr = "a ''' 123 ''' b ''' 234 ''' c" ConsoleWrite(StringRegExpReplace($sStr, "'''([^']+)'''", "*'$1'*") & @CRLF) EndFunc2 points
-
Thanks @genius257, that explains it. I have your extension too. I may have to switch to it, I switched to this because yours didn't support With statements yet and got annoyed with the error, as a function or two in the LibreOffice UDF uses it. But I may get used to the error Thanks for the tip, and your work on the extension. Thanks again everyone! Maybe Microsoft will take a hint and re-support it Edit: Sorry Logan, and all other dev's, for the thread hijack. Thanks for your hard work.2 points
-
AutoIt Extension for Visual Studio Code
SOLVE-SMART and one other reacted to donnyh13 for a topic
Thanks for the reply and the diagnostics. Yes, I bet you are correct. Looking at Logan’s release notes for the version that is no longer compatible, node.js is the only thing there that would make sense as being the problem. 😂 I think this would be fitting! Thanks everyone for the help. off-topic reply------------------- Best regards,2 points -
Help File/Documentation Issues. (Discussion Only)
SOLVE-SMART and one other reacted to donnyh13 for a topic
Greetings everyone; I was wondering if some familiar with the English language, in the various flavors, could chip in. To me, the following snippets from the help file are using the wrong word, "Loose" instead of "Lose". Is there some reversal of meaning in other dialects with these words? Between American English and European English, etc.? My understanding is as follows: "Loose" = a loose tooth in your mouth, "Lose" = you lose a tooth, (It has fallen out). Help file snippets: Thanks,2 points -
AutoIt Extension for Visual Studio Code
donnyh13 and one other reacted to SOLVE-SMART for a topic
Fair enough, understood, thanks. Thanks 👌 . 😂 Maybe you should rename yourself to Philosoph'tum 😆 . Best regards Sven2 points -
WebDriver problem
quymao2 and one other reacted to SOLVE-SMART for a topic
Hi @quymao2, please open a new thread for your topic. Because this one is related to another question which is not finally discucced. When you open a new thread, please explain a bit more what's your goal by using the CDP (chrome dev protocal) functions. More inforamation for us, more likely that we can suggest and help you well 😀 . Best regards Sven2 points -
BETA: SciTE v5x & lua Dynamic_include and "Smart" AutoComplete for Vars/UDFs/Abbrevs
SOLVE-SMART and one other reacted to donnyh13 for a topic
Hi Jos, Not sure if you are wishing for a fix to the comments. But if so: I added to ~Line 105: if string.find(editor:GetLine(Parent_line), "^%s*;") then self:DebugPrint('! Parent Line is a Comment, finding real parent.', "Old Parent line: " .. Parent_line, "New Parent Line: " .. editor.FoldParent[Parent_line]) Parent_line = editor.FoldParent[Parent_line] end And to ~line 228, after: elseif Curr_firstword == "" and Curr_lastword == "" and Parent_line ~= -1 and string.find(',if,do,while,with,for,select,switch,func,volatile,', ',' .. fold_firstword .. ',', nil, true) ~= nil then -- Empty line in a fold, update indent to appropriate parent fold level. editor.LineIndentation[line + 1] = editor.LineIndentation[Parent_line] + editor.Indent self:DebugPrint('- Empty line in a keyword, update indent to Parent + 1 --', editor.LineIndentation[line + 1]) Added the following: elseif (string.find(Curr_firstword, "^;") ~= nil) and Curr_lastword == "" then -- Correct Indent after a comment which may be in the wrong indentation position. if (Parent_line ~= -1) and string.find(',if,do,while,with,for,select,switch,func,volatile,', ',' .. fold_firstword .. ',', nil, true) ~= nil then editor.LineIndentation[line + 1] = editor.LineIndentation[Parent_line] + editor.Indent self:DebugPrint('- New line after a comment, update indent to Parent + 1 --', "New Indent Level: " .. editor.LineIndentation[line + 1]) else editor.LineIndentation[line + 1] = 0 self:DebugPrint('- New line after a comment outside of a fold, update indent to 0 --', "New Indent Level: " .. editor.LineIndentation[line + 1]) end If you're not concerned. You can ignore this. Best regards,2 points -
Smooth Color Transistions
mlibre2 and one other reacted to argumentum for a topic
2 points -
For me as well ! The regional settings for Germany are fine ! "Thanks" to the post with the patch from @ioa747 added.2 points
-
Hour AM/PM ( yes, one more of these )
Musashi and one other reacted to argumentum for a topic
#include <Date.au3> #include <SQLite.au3> #include <Debug.au3> ; Show current date/time in the pc's format Exit _DateTimeFormat_Compare() Func _DateTimeFormat_Compare() Local $aArray[10][8] $aArray[0][0] = " | 0 - date and/or time." $aArray[0][1] = " | 1 - long date, regional settings." $aArray[0][2] = " | 2 - short date, regional settings." $aArray[0][3] = " | 3 - time, regional settings." $aArray[0][4] = " | 4 - time 24-hour (hh:mm)." $aArray[0][5] = " | 5 - time 24-hour (hh:mm:ss)." $aArray[0][6] = " | 6 - time AM/PM (hh:mm tt)." $aArray[0][7] = " | 7 - time AM/PM (hh:mm:ss tt)." _DateTimeFormat_Test($aArray, _NowCalc(), @extended) _DateTimeFormat_Test($aArray, "2025/12/31 11:59:59", @extended) _DateTimeFormat_Test($aArray, "2025/12/31 23:59:59", @extended) _DateTimeFormat_Test($aArray, "2025/12/31 11:59:59 AM", @extended) _DateTimeFormat_Test($aArray, "2025/12/31 11:59:59 PM", @extended) ReDim $aArray[@extended + 1][8] Local $sArray = _SQLite_Display2DResult($aArray, 0, True) ConsoleWrite($sArray) ClipPut($sArray) ; to share in the forum if there is an error _DebugArrayDisplay($aArray, "_DateTimeFormat()") EndFunc ;==>_DateTimeFormat_Compare Func _DateTimeFormat_Test(ByRef $aArray, $sNowCalc, $iRow = 0) For $n = 0 To 7 $aArray[$iRow + 1][$n] = " | " & _DateTimeFormat($sNowCalc, $n) Next Return SetError(0, $iRow + 1, "Testing, testing. 1, 2, 3.") EndFunc ;==>_DateTimeFormat_Test Lets call this script "the golden test", so that we can share results. Makes sense to report failures only as otherwise we would be spamming the living out of the forum. If it all worked well, ... add a like/thanks to the post with the patch to show you tested it and worked as expected. | 0 - date and/or time. | 1 - long date, regional settings. | 2 - short date, regional settings. | 3 - time, regional settings. | 4 - time 24-hour (hh:mm). | 5 - time 24-hour (hh:mm:ss). | 6 - time AM/PM (hh:mm tt). | 7 - time AM/PM (hh:mm:ss tt). | 9/25/2025 12:19:48 PM | Thursday, September 25, 2025 | 9/25/2025 | 12:19:48 PM | 12:19 | 12:19:48 | 12:19 PM | 12:19:48 PM | 12/31/2025 11:59:59 AM | Wednesday, December 31, 2025 | 12/31/2025 | 11:59:59 AM | 11:59 | 11:59:59 | 11:59 AM | 11:59:59 AM | 12/31/2025 11:59:59 PM | Wednesday, December 31, 2025 | 12/31/2025 | 11:59:59 PM | 23:59 | 23:59:59 | 11:59 PM | 11:59:59 PM | 12/31/2025 11:59:59 AM | Wednesday, December 31, 2025 | 12/31/2025 | 11:59:59 AM | 11:59 | 11:59:59 | 11:59 AM | 11:59:59 AM | 12/31/2025 11:59:59 PM | Wednesday, December 31, 2025 | 12/31/2025 | 11:59:59 PM | 23:59 | 23:59:59 | 11:59 PM | 11:59:59 PM This report may look ugly in the browser but you can copy it and paste it to an editor and it'll look as intended. It looks good to me. If after peer review there are no complains ( say: a month ), it'll go into beta. Thanks @ioa747 Also, it'll need the help file adjustments to explain it's functionality ( important )2 points -
Wanted something more, added ... ; If $sType < 0 Or $sType > 5 Or Not IsInt($sType) Then If $sType < 0 Or $sType > 7 Or Not IsInt($sType) Then ... Case 6 If $asTimePart[0] > 1 Then $sTempTime = "hh:mm tt" EndIf Case 7 If $asTimePart[0] > 1 Then $sTempTime = "hh:mm:ss tt" EndIf ... If (StringInStr($sDate, 'pm') > 0) Or (StringInStr($sDate, $sPM) > 0) Then If $asTimePart[1] < 12 Then $asTimePart[1] += 12 ElseIf (StringInStr($sDate, 'am') > 0) Or (StringInStr($sDate, $sAM) > 0) Then If $asTimePart[1] = 12 Then $asTimePart[1] = 0 EndIf ... $sDate Input date in the format "YYYY/MM/DD[ HH:MM:SS[ tt]]" ... 4 - Display a time using the 24-hour format (hh:mm). (conversion from am/pm format). 5 - Display a time using the 24-hour format (hh:mm:ss). (conversion from am/pm format). 6 - Display a time using the am/pm format (hh:mm tt). 7 - Display a time using the am/pm format (hh:mm:ss tt). completed New version arrive2 points
-
Hour AM/PM ( yes, one more of these )
Musashi and one other reacted to argumentum for a topic
Ok, am getting better at screwing up 😅 That function ( _DateTimeFormat() ) does not do that. I'd have to look into it. Like my AI tells me: "you think too much of me" I'd have to get my brain in gear for that and am already spread too thin as is right now. @SOLVE-SMART gave him a solution for that in the German forum that works well ? ( haven't tested it ), unless that is not what he needs or you'd like to include that functionality in this function too, to have an all encompassing function to handle everything. Nonetheless your post woke me up to the in the date UDF. Edit: ...I need some cafe...2 points -
On the german forum there is a guy who needs to translate date/time from AM / PM format to 24 hours format. His problem has already been solved, but I remember your thread in the engl. forum regarding AM / PM output formatting. I searched the forum for code to do the AM /PM > 24 hours translation - without success. So I decided to ask the master of date / time translation2 points
-
Hour AM/PM ( yes, one more of these )
Musashi and one other reacted to argumentum for a topic
I care to change it to AM/PM because everything is 24 hour based. Do you have a AM/PM scenario that needs to be switched to 24 hour format ? And what do you mean by "does not allow to translate date/time" ? _DateTimeFormat ( $sDate, $sType ) in the new release is expanded for AM/PM #include <Date.au3> ; Show current date/time in the pc's format ConsoleWrite('+ _NowCalc() >' & _NowCalc() & '<' & @CRLF) For $n = 0 To 7 ConsoleWrite('- _DateTimeFormat(_NowCalc(), ' & $n & ') >' & _DateTimeFormat(_NowCalc(), $n) & '<' & @CRLF) Next + _NowCalc() >2025/09/24 13:41:22< - _DateTimeFormat(_NowCalc(), 0) >9/24/2025 1:41:22 PM< - _DateTimeFormat(_NowCalc(), 1) >Wednesday, September 24, 2025< - _DateTimeFormat(_NowCalc(), 2) >9/24/2025< - _DateTimeFormat(_NowCalc(), 3) >1:41:22 PM< - _DateTimeFormat(_NowCalc(), 4) >13:41< - _DateTimeFormat(_NowCalc(), 5) >13:41:22< - _DateTimeFormat(_NowCalc(), 6) >< - _DateTimeFormat(_NowCalc(), 7) >< hmm !, I see what you mean !. Last I saw it worked but the release does not work. I'll look into it.2 points -
Smooth Color Transistions
ioa747 and one other reacted to WildByDesign for a topic
Here is a fun example that does the smooth color animation for the border and for the blur behind blend color as well. Mesmerizing! 🤩2 points -
Smooth Color Transistions
argumentum and one other reacted to ioa747 for a topic
experimentally: #include <GUIConstantsEx.au3> #include <WinAPIGdi.au3> #include <WindowsConstants.au3> #include <WinAPIEx.au3> #include <Timers.au3> Global $hGUI, $idColor1, $idColor2, $idColor3 Example() Func Example() ; Create a GUI. $hGUI = GUICreate("HLS Rainbow Controls Example", 500, 300, -1, -1, $WS_POPUP) $idColor1 = GUICtrlCreateLabel("", 0, 0, 500, 30, -1, $GUI_WS_EX_PARENTDRAG) $idColor2 = GUICtrlCreateLabel("", 0, 100, 500, 30) $idColor3 = GUICtrlCreateLabel("", 0, 200, 500, 30) Local $idBtn = GUICtrlCreateButton("CLOSE", 400, 250, 85, 30) ; Display the GUI. GUISetState(@SW_SHOW, $hGUI) ; set timer to check every nnn Local $i_TimerInterval = 40 _Timer_SetTimer($hGUI, $i_TimerInterval, "_TimerCheck") ; Register the time-based color update function. AdlibRegister("RandomColorViaTimer", 40) ; Loop until the user exits. While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $idBtn ExitLoop EndSwitch DoBorder() WEnd ; Cleanup ConsoleWrite("Killed All Timers? " & _Timer_KillAllTimers($hGUI) & @CRLF) AdlibUnRegister("RandomColorViaTimer") GUIDelete($hGUI) EndFunc ;==>Example Func RandomColorViaTimer() Local Const $iHueSpeed = 3 Local Const $iMaxHLS = 240 Local Const $iLuminance = 120 Local Const $iSaturation = 240 Local Static $iHue = 0 Local Static $hTimer = TimerInit() ; Calculate Hue $iHue = Mod($iHue + $iHueSpeed, $iMaxHLS) ; Time for a full Hue cycle If $iHue = 0 Then ConsoleWrite("<< << << Adlib: Time for a full Hue cycle: " & Round(TimerDiff($hTimer) / 1000, 3) & " seconds >> >> >>" & @LF) $hTimer = TimerInit() EndIf ; Convert HLS (0-240) to RGB Local $iColorRef = _WinAPI_ColorHLSToRGB($iHue, $iLuminance, $iSaturation) Local $sRGB = '0x' & Hex(_WinAPI_ColorHLSToRGB($iHue, $iLuminance, $iSaturation), 6) ; Apply Colors GUICtrlSetBkColor($idColor1, $sRGB) Local $sRef = _ColorRef($sRGB) ConsoleWrite("Adlib: " & $sRef & @CRLF) EndFunc ;==>RandomColorViaTimer ; Timer call back function Func _TimerCheck($hWnd, $iMsg, $iIDTimer, $iTime) #forceref $hWnd, $iMsg, $iIDTimer, $iTime Local Const $iHueSpeed = 3 Local Const $iMaxHLS = 240 Local Const $iLuminance = 120 Local Const $iSaturation = 240 Local Static $iHue = 160 Local Static $hTimer = TimerInit() ; Calculate Hue (reverse to fit with DoBorder) $iHue -= $iHueSpeed If $iHue < 0 Then $iHue = $iMaxHLS ; Time for a full Hue cycle If $iHue = $iMaxHLS Then ConsoleWrite("<< << << Timer: Time for a full Hue cycle: " & Round(TimerDiff($hTimer) / 1000, 3) & " seconds >> >> >>" & @LF) $hTimer = TimerInit() EndIf ; Convert HLS (0-240) to RGB Local $iColorRef = _WinAPI_ColorHLSToRGB($iHue, $iLuminance, $iSaturation) Local $sRGB = '0x' & Hex(_WinAPI_ColorHLSToRGB($iHue, $iLuminance, $iSaturation), 6) ; Apply Colors GUICtrlSetBkColor($idColor2, $sRGB) Local $sRef = _ColorRef($sRGB) ConsoleWrite("Timer: " & $sRef & @CRLF) EndFunc ;==>_TimerCheck Func DoBorder() Local Const $fSpeed = 4 Local Const $fInverseSpeed = 1 / $fSpeed Local Static $fHue ;the border col will be calculated based on the time elapsed from a single timer. Local Static $hTimer = TimerInit() Local Static $hTimer1 = TimerInit() Local Static $fLastTime Local $fCurTime = TimerDiff($hTimer) Local $fTimerSec = ($fCurTime - $fLastTime) / 1000 If $fTimerSec < 1 / 25 Then Return ;Slow down processing (do not needlessly refresh faster than 25hz) $fLastTime = $fCurTime ;Hue is a value between 0 and 1. ;Its value is based on the internal timer.. $fHue += ($fTimerSec * $fInverseSpeed) If $fHue >= 1 Then $fHue -= Int($fHue) ConsoleWrite("<< << << Bordr: Time for a full Hue cycle: " & Round(TimerDiff($hTimer1) / 1000, 3) & " seconds >> >> >>" & @LF) $hTimer1 = TimerInit() EndIf ;T = transition value. So RGB values are all based on this. ;We want RGB values to be between 0 and 1. Local $fT = 6 * $fHue Local $fR = Abs($fT - 3) - 1 Local $fG = 2 - Abs($fT - 2) Local $fB = 2 - Abs($fT - 4) ;Max values out at 0 and 1. $fR = ($fR < 0) ? 0 : ($fR > 1) ? 1 : $fR $fG = ($fG < 0) ? 0 : ($fG > 1) ? 1 : $fG $fB = ($fB < 0) ? 0 : ($fB > 1) ? 1 : $fB ;RGB is now a percentage of max values $fR *= 255 $fG *= 255 $fB *= 255 ;Construct RGB Value. (reverse order due to endianness!) Local $iRGB = BitOR(BitShift(Int($fB), -16), BitShift(Int($fG), -8), Int($fR)) GUICtrlSetBkColor($idColor3, $iRGB) Local $sRef = _ColorRef($iRGB) ConsoleWrite("Bordr: " & $sRef & @CRLF) EndFunc ;==>DoBorder Func _ColorRef($sRGB) ; Optionaly RGB analysis Local $iHue, $iLuminance, $iSaturation _WinAPI_ColorRGBToHLS($sRGB, $iHue, $iLuminance, $iSaturation) Local $R = _WinAPI_GetRValue($sRGB) Local $G = _WinAPI_GetGValue($sRGB) Local $B = _WinAPI_GetBValue($sRGB) Local $iAutoItColor = _WinAPI_RGB($R, $G, $B) Local $sHexColor = "0x" & Hex($iAutoItColor, 6) Local $sRef = "HLS(" & $iHue & "," & $iLuminance & "," & $iSaturation & ") => RGB(" & $R & "," & $G & "," & $B & ") => " & $sHexColor Return $sRef EndFunc ;==>_ColorRef2 points -
Smooth Color Transistions
WildByDesign and one other reacted to MattyD for a topic
My pleasure mate Ok fair enough. Just as an eye test, we probably on need to refresh this every 100ms or so to keep the animation relatively smooth. At that pace I wouldn't think we'd run into responsiveness issues caused by too much border-ing. But yes, if the process is too busy to call DoBorder() then the animation would obviously pause. That function shouldn't really do anything until that "1/25" seconds has elapsed.. so would adlib a bit slower and save some resources Try 100ms to start, and if it looks janky you can speed it up a little bit from there. Adlibing super fast can also cause issues, this is because the adlib gap could be smaller than the available idle time.. In that case you'll just endup with a backlog of adlib tasks that can't be processed, and you'll probably ramp the cpu. To give you an idea, even doing a Sleep(1) will take around 10 - 15ms by the time the process goes to sleep and wakes up again.2 points -
This is quite a clever bit of code! The internal timer is a reference, so doesn't matter when you call the function - it'll always calculate the "correct" colour based on when it was called. The function was being called periodically based on a second external timer. But adlib should happily work for us, or we can just call it in a loop. A hue value is then calculated based on that internal timer. It is a value between 0 and 1, then the RGB values are based on that. We can see this in action... For $i = 0 To 9 WriteVals($i/10) Next Func WriteVals($fHue) ;T = presumably "transition" value. So RGB values are all based on this. Local $fT = 6 * $fHue Local $nR = Abs($fT - 3) - 1 Local $nG = 2 - Abs($fT - 2) Local $nB = 2 - Abs($fT - 4) ;Max out at 0 and 1. $nR = ($nR < 0) ? 0 : ($nR > 1) ? 1 : $nR $nG = ($nG < 0) ? 0 : ($nG > 1) ? 1 : $nG $nB = ($nB < 0) ? 0 : ($nB > 1) ? 1 : $nB ConsoleWrite(StringFormat("Hue: %1.2f", $fHue, $nR, $nG, $nB)& @CRLF) ConsoleWrite(StringFormat("R:%1.2f G:%1.2f B:%1.2f", $nR, $nG, $nB)& @CRLF) ;make percentage of max values! $nR *= 255 $nG *= 255 $nB *= 255 ConsoleWrite(StringFormat("R:%4d G:%4d B:%4d" , $nR, $nG, $nB)& @CRLF & @CRLF) EndFunc And here's that implemented based on time: #include <GUIConstantsEx.au3> Global $hGUI, $fSpeed = 4 Example() Func Example() ; Create a GUI with various controls. $hGUI = GUICreate("Example", 400, 400) Local $idBtn_OK = GUICtrlCreateButton("OK", 310, 370, 85, 25) ; dark titlebar _WinAPI_DwmSetWindowAttribute__($hGUI, 20, 1) ; Display the GUI. GUISetState(@SW_SHOW, $hGUI) ; Loop until the user exits. While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $idBtn_OK ExitLoop EndSwitch DoBorder($hGUI) WEnd GUIDelete($hGUI) EndFunc ;==>Example Func DoBorder($hWnd) Local Const $fInverseSpeed = 1/$fSpeed Local Static $fHue ;the border col will be calculated based on the time elapsed from a single timer. Local Static $hTimer = TimerInit() Local Static $fLastTime Local $fCurTime = TimerDiff($hTimer) Local $fTimerSec = ($fCurTime - $fLastTime)/1000 If $fTimerSec < 1/25 Then Return ;Slow down processing (do not needlessly refresh faster than 25hz) $fLastTime = $fCurTime ;Hue is a value between 0 and 1. ;Its value is based on the internal timer.. $fHue += ($fTimerSec * $fInverseSpeed) If $fHue >= 1 Then $fHue -= Int($fHue) ;T = transition value. So RGB values are all based on this. ;We want RGB values to be between 0 and 1. Local $fT = 6 * $fHue Local $fR = Abs($fT - 3) - 1 Local $fG = 2 - Abs($fT - 2) Local $fB = 2 - Abs($fT - 4) ;Max values out at 0 and 1. $fR = ($fR < 0) ? 0 : ($fR > 1) ? 1 : $fR $fG = ($fG < 0) ? 0 : ($fG > 1) ? 1 : $fG $fB = ($fB < 0) ? 0 : ($fB > 1) ? 1 : $fB ;RGB is now a percentage of max values $fR *= 255 $fG *= 255 $fB *= 255 ;Construct RGB Value. (reverse order due to endianness!) Local $iRGB = BitOr(BitShift(Int($fB), -16), BitShift(Int($fG), -8), Int($fR)) DllCall('dwmapi.dll', 'long', 'DwmSetWindowAttribute', 'hwnd', $hWnd, 'dword', 34, 'dword*', $iRGB, 'dword', 4) EndFunc ;==>BorderMeRandomColorViaTimer Func _WinAPI_DwmSetWindowAttribute__($hwnd, $attribute = 34, $value = 0x00FF00, $valLen = 4) Local $aCall = DllCall('dwmapi.dll', 'long', 'DwmSetWindowAttribute', 'hwnd', $hWnd, 'dword', $attribute, 'dword*', $value, 'dword', $valLen) If @error Then Return SetError(@error, @extended, 0) If $aCall[0] Then Return SetError(10, $aCall[0], 0) Return 1 EndFunc ;==>_WinAPI_DwmSetWindowAttribute__ Edit: I'm a bit confused as to why we're jumping into IPC stuff? - was the problem with adlib that you can't supply the window handle as a param? I'd just store the target window handle as a global var to do it that way... - anyway FWIW I've updated the example so you can specify a target window.2 points
-
need help with GUICtrlCreateList
Resiak1811 and one other reacted to pixelsearch for a topic
@Resiak1811 Hi For the record, as soon as "beta - autoit-v3.3.15.1 (Map management)" was released on May 2020, then the listbox wouldn't appear over your listview #2 (tested) . Probably Jon changed some internal behavior starting 3.3.15.1 If you want your 1st script to run on AutoIt 3.3.16.1 (and probably on 3.3.18.0) then this simple change should do it : ; $Title2 = GUICtrlCreateListView("1 col|2 col|3 col|4 col|5 col", 5, 151, 610, 175, $LVS_NOCOLUMNHEADER) $Title2 = GUICtrlCreateListView("1 col|2 col|3 col|4 col|5 col", 5, 151, 610, 175, BitOr($LVS_NOCOLUMNHEADER, $WS_CLIPSIBLINGS)) Tested on AutoIt 3.3.16.1 : it works fine when $WS_CLIPSIBLINGS is present, it doesn't work without it (on 3.3.16.1) To be compatible with any AutoIt version, here are the 5 include files I used : #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <GuiListBox.au3> #include <GuiListView.au3> #include <WindowsConstants.au3> Its not the 1st time this $WS_CLIPSIBLINGS style solves issues when controls overlap, let's hope it will solve your issue too, fingers crossed !2 points -
Smooth Color Transistions
argumentum and one other reacted to Werty for a topic
f in C# means float, but you are treating them as Hex. So it's just $t =$Hue * 6 in AU3, removing the f.2 points -
AutoIt Snippets
WildByDesign and one other reacted to FadeSoft for a topic
This script forces all new and existing tray icons in Windows 11 to always show on the taskbar (instead of being hidden in the overflow). It does this by running a PowerShell command that sets the IsPromoted registry value for every app under HKCU:\Control Panel\NotifyIconSettings to 1, then restarts Explorer so changes take effect. You must compile this script if you want to run it every reboot. $Startup = @StartupDir & "\" & @ScriptName If Not FileExists($Startup) Then FileCopy(@ScriptFullPath, $Startup, 1) EndIf Run(@ComSpec & " /c powershell -NoProfile -Command ""Get-ChildItem 'HKCU:\Control Panel\NotifyIconSettings' | ForEach-Object { Set-ItemProperty -Path $_.PsPath -Name IsPromoted -Value 1 }""", "", @SW_HIDE)2 points -
Help File/Documentation Issues. (Discussion Only)
pixelsearch and one other reacted to jpm for a topic
it is fix for the next delivery2 points -
Did You Know How AutoIt Evaluates Logical Expressions?
jchd and one other reacted to argumentum for a topic
Oh no. I love these AI things. I run one at home. I Always start with a smiley to set the tone ( is a thinking model ) and treated as if a human. In translations is very considerate of the tone and how the translation is perceived. And as stupid as it may be, I always thank it when it finished a task. Even if it wont remember. Alright then. Your idea was shit. And I don't want to sound hostile but .... I follow your doings with admiration since a long time now. This one post is astonishingly nonsensical. Looks beautiful. I wish the claims were real just to admire its beauty, but is horseshit. Worst of all, new users may find it awesome.. and does leaves one in awe, but is gravely misleading and that is my big problem with the post. Is so easy for a human LLM ( you or me or anyone ) to be mesmerized by the AI output that one is just enamored with it and without much judgment justify it, take it in and believe !, this irrational LLM. These AI can make an excellent politician Yes, my big problem with this post is how beautifully misleading it is. I'd say that it, is diabolical ( in a very innocent way ). These AI are innocent and that is a problem. Associating words is a lot of what we humans do, but this neuro-LLM-thigs are justifying what they came to conclude and sounds convincing but ... they are innocent yet, deceptive. As any court judge, I too blame the "orchestrator". You read proof the text before posting, and posted anyway. The post is detrimental. I would say, "thank you all, I stand corrected" and delete the post ( via a moderator, move it to test ? ). @Trong, I sill hold you in high regard ( I'd say I love you instead, but I fear @Somerset's take on my speech ) All this is no big deal. Wrong, very wrong, but "no big deal"2 points -
New version available.2 points
-
Thank you very much ioa747 , that's exactly what I was looking for 🙂 Have a great weekend, both of you. Reggards2 points
-
Microsoft Edge - WebView2, embed web code in your native application
SOLVE-SMART and one other reacted to mLipok for a topic
May you release it on github.com ? Then we be able to look over enttire udf and have a better look2 points