Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation since 09/23/2025 in all areas

  1. 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/refs/tags/1.0.0.zip Enjoy!
    7 points
  2. V1.0.0 released! 🎊 Event on toast interaction now works! 🎉
    6 points
  3. 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 GitHub
    6 points
  4. 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 GitHub
    5 points
  5. Hi @Gianni, Thanks you, glad to see the interest in the code Yes, the $data variable contains a pointer to a array of NOTIFICATION_USER_INPUT_DATA elements. The length of the array is given via the $count variable. Something like this should do it (not tested yet) $pData = $data For $i = 1 To $count $tData = DllStructCreate('PTR Key;PTR Value;', $pData) $key = _WinAPI_GetString($tData.Key) $value = _WinAPI_GetString($tData.Value) ConsoleWrite(StringFormat('"%s"="%s"\n', $key, $value)) $pData += DllStructGetSize($tData) Next I think I'll update the example with inputs to demonstrate later, and I'll also add a helper function to convert the data array into a Map I'll update the post later, when i have time to test the code, if something does not work
    4 points
  6. 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&amp;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 Forums
    4 points
  7. Progress! ... Click the form button beside of the cursor button (more than once if you want to). Now the windows are clipped to the left too! #include-once Opt("WinTitleMatchMode", 4) ; advanced Opt("MouseCoordMode" , 2) #include <WindowsStylesConstants.au3> #include <ButtonConstants.au3> #include <GuiConstantsEx.au3> Global $formList[], $formCount = 0 Global Const $main_width = 815 Global Const $main_height = 860 Global Const $main_left = (@DesktopWidth / 2) - ($main_width / 2) Global Const $main_top = (@DesktopHeight / 2) - ($main_height / 2) Global Const $guiCanvas = GuiCreate("GUI Canvas", $main_width, $main_height, $main_left, $main_top) Global Const $canvas = GuiCreate('', ($main_width - 105), ($main_height - 35), 95, 5, $WS_CHILD, $WS_EX_OVERLAPPEDWINDOW, $guiCanvas) GUISetFont(10, -1, -1, "Segoe UI", $guiCanvas) #region ; menu items Global Const $menu_file = GUICtrlCreateMenu ("File") Global Const $menu_save_definition = GUICtrlCreateMenuitem("Save", $menu_file) ; Roy add-on Global Const $menu_load_definition = GUICtrlCreateMenuitem("Load", $menu_file) ; Roy add-on GUICtrlCreateMenuitem('' , $menu_file) ; Roy add-on Global Const $menu_exit = GUICtrlCreateMenuitem("Exit", $menu_file) Global Const $menu_edit = GUICtrlCreateMenu ("Edit") Global Const $menu_vals = GUICtrlCreateMenuitem("Vals" , $menu_edit) ; added by: TheSaint Global Const $menu_wipe = GUICtrlCreateMenuitem("Clear all controls", $menu_edit) Global Const $menu_about = GUICtrlCreateMenuitem("About" , $menu_edit) ; added by: TheSaint GUICtrlSetState($menu_wipe, $GUI_DISABLE) Global Const $menu_settings = GUICtrlCreateMenu ("Settings") Global Const $menu_show_grid = GUICtrlCreateMenuItem("Show grid" , $menu_settings) Global Const $menu_grid_snap = GUICtrlCreateMenuItem("Snap to grid" , $menu_settings) Global Const $menu_paste_pos = GUICtrlCreateMenuItem("Paste at mouse position" , $menu_settings) Global Const $menu_show_ctrl = GUICtrlCreateMenuItem("Show control when moving", $menu_settings) Global Const $menu_show_hidden = GUICtrlCreateMenuItem("Show hidden controls" , $menu_settings) GUICtrlSetState($menu_show_grid , $GUI_CHECKED ) GUICtrlSetState($menu_grid_snap , $GUI_CHECKED ) GUICtrlSetState($menu_paste_pos , $GUI_CHECKED ) GUICtrlSetState($menu_show_ctrl , $GUI_CHECKED ) GUICtrlSetState($menu_show_hidden, $GUI_UNCHECKED) #endregion ; menu items #region ; toolbar Global Const $default_cursor = CreateToolButton("Cursor" , 5, 5) Global Const $toolForm = CreateToolButton("Form" , 45, 5) Global Const $toolGroup = CreateToolButton("Group" , 5, 45) Global Const $toolButton = CreateToolButton("Button" , 45, 45) Global Const $toolCheckbox = CreateToolButton("Checkbox" , 5, 85) Global Const $toolRadio = CreateToolButton("Radio" , 45, 85) Global Const $toolEdit = CreateToolButton("Edit" , 5, 125) Global Const $toolInput = CreateToolButton("Input" , 45, 125) Global Const $toolLabel = CreateToolButton("Label" , 5, 165) Global Const $toolUpDown = CreateToolButton("UpDown" , 45, 165) Global Const $toolList = CreateToolButton("List" , 5, 205) Global Const $toolCombo = CreateToolButton("Combo" , 45, 205) Global Const $toolDate = CreateToolButton("Date" , 5, 245) Global Const $toolTreeview = CreateToolButton("Treeview" , 45, 245) Global Const $toolProgress = CreateToolButton("Progress" , 5, 285) Global Const $toolAvi = CreateToolButton("Avi" , 45, 285) Global Const $toolIcon = CreateToolButton("Icon" , 5, 325) Global Const $toolPic = CreateToolButton("Pic" , 45, 325) Global Const $toolSlider = CreateToolButton("Slider" , 5, 365) Global Const $toolMenu = CreateToolButton("Menu" , 45, 365) Global Const $toolContextMenu = CreateToolButton("Context Menu", 5, 405) Global Const $toolTab = CreateToolButton("Tab" , 45, 405) #endregion ; toolbar main() Func main() GUISetState(@SW_SHOWNORMAL, $guiCanvas) GUISetState(@SW_SHOWNORMAL, $canvas) Local $msg Do $msg = GUIGetMsg($GUI_EVENT_ARRAY) Switch $msg[1] Case $guiCanvas Switch $msg[0] Case $toolForm CreateForm() Case $GUI_EVENT_CLOSE Exit EndSwitch EndSwitch Until False EndFunc Func CreateForm() GUISwitch($canvas) $formCount += 1 Local Const $form = GuiCreate("Form " & $formCount, 400, 600, 5, 5, BitOR($WS_CHILD, $WS_OVERLAPPEDWINDOW), -1, $canvas) $formList["Form" & $formCount] = $form GUISetState(@SW_SHOWNORMAL, $form) GUISwitch($guiCanvas) Return $form EndFunc Func CreateToolButton(Const $name, Const $left, Const $top) Local Const $tool = GUICtrlCreateRadio($name, $left, $top, 40, 40, BitOR($BS_PUSHLIKE, $BS_ICON)) GUICtrlSetImage($tool, @ScriptDir & "\resources\Icons\" & $name & ".ico") GUICtrlSetTip($tool, $name) Return $tool EndFunc
    3 points
  8. I just wanted to take a moment to thank everyone again who helped with this issue. I've completed the part of the project that relates to the menubar. I actually ended up coloring that line in such a way that it gives the GUI some depth and also made the statusbar sizing and style to match it. When I started learning AutoIt a little over a year ago, I never thought that such beautiful GUIs could be made. I was able to make that line semi-transparent along with the rest of the GUI so that it does the blur behind well and also the Windows 11 materials (Mica, Acrylic, etc.) Cheers everyone! 🍷
    3 points
  9. I am sure he's happy after 5 years!!! 😉
    3 points
  10. That's a very good point. I shouldn't have used a hardcoded path like that. I like the creative way that you used the @AutoItExe macro to get the AutoIt install directory. Thanks for sharing. This was a really fun example. Thanks for sharing. I didn't expect that a child GUI would work in this type of situation, so that was a neat surprise.
    3 points
  11. to test different patterns simultaneously ; https://www.autoitscript.com/forum/topic/212981-move-window-behind-desktop-icons/page/2/#findComment-1544444 #include <WinAPI.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Opt("MustDeclareVars", True) Example() Func Example() Local $hWorkerW = _GetDesktopWorkerW() If @error Then Exit MsgBox(16, @ScriptName, "! Error - Couldn't find WorkerW under Progman", 30) ConsoleWrite("WorkerW = " & $hWorkerW & @CRLF) ; Overlay GUICreate Local $hGUI = GUICreate("Overlay", @DesktopWidth, @DesktopHeight, -1, -1, $WS_POPUP, $WS_EX_TOOLWINDOW) Local $BkColor = 0x000000 GUISetBkColor($BkColor, $hGUI) GUISetFont(12) _WinAPI_SetParent($hGUI, $hWorkerW) _WinAPI_SetWindowLong($hGUI, $GWL_EXSTYLE, BitOR(_WinAPI_GetWindowLong($hGUI, $GWL_EXSTYLE), $WS_EX_LAYERED)) _WinAPI_SetLayeredWindowAttributes($hGUI, 0, 150, $LWA_ALPHA) GUISetState(@SW_SHOWNOACTIVATE) Local $aChildGui[10] = [9], $aLbl[10] = [9] Local $iW = @DesktopWidth * 0.33, $iH = @DesktopHeight * 0.33, $iX = 0, $iY = 20, $iCnt = 0 For $i = 1 To 3 For $j = 1 To 3 $iCnt += 1 $aChildGui[$iCnt] = GUICreate("Child_" & $iCnt, $iW, $iH, $iX, $iY, $WS_CHILD, $WS_EX_TOOLWINDOW, $hGUI) $BkColor = "0x" & Hex(Random(0, 255, 1), 2) & Hex(Random(0, 255, 1), 2) & Hex(Random(0, 255, 1), 2) ConsoleWrite("$BkColor=" & $BkColor & @CRLF) GUISetBkColor($BkColor, $aChildGui[$iCnt]) $aLbl[$iCnt] = GUICtrlCreateLabel("Child_" & $iCnt & ", BkColor:" & $BkColor, 0, 0, $iW, 25) GUICtrlSetFont(-1, 18) GUISetState(@SW_SHOWNOACTIVATE) $iX += $iW Next $iX = 0 $iY += $iH Next $iCnt = 0 While GUIGetMsg() <> $GUI_EVENT_CLOSE Sleep(50) $iCnt += 1 If $iCnt > 40 Then $iCnt = 0 For $i = 1 To $aChildGui[0] $BkColor = "0x" & Hex(Random(0, 255, 1), 2) & Hex(Random(0, 255, 1), 2) & Hex(Random(0, 255, 1), 2) GUISetBkColor($BkColor, $aChildGui[$i]) GUICtrlSetData($aLbl[$i], "Child_" & $i & ", BkColor:" & $BkColor) Next EndIf WEnd EndFunc ;==>Example Func _GetDesktopWorkerW() Local $hWorkerW = 0, $hProgman = _WinAPI_GetShellWindow() _WinAPI_SendMessageTimeout($hProgman, 0x052C, 0, 0, 3000, $SMTO_NORMAL) ; same as _SendMessage() Local $aEnumWindows = WinList("[CLASS:WorkerW]") For $n = 1 To $aEnumWindows[0][0] Local $hWnd = $aEnumWindows[$n][1] If _WinAPI_GetParent($hWnd) = $hProgman Then Return SetError(0, $hProgman, $hWnd) Next Return SetError(1, $hProgman, 0) EndFunc ;==>_GetDesktopWorkerW
    3 points
  12. I was so grouchy at the thought of blasting away my Windows partition to reinstall Windows but thankfully I figured it out before I got that far. In Advanced System Properties (SystemPropertiesAdvanced.exe) in the Performance settings dialog - Visual Effects tab, there is a checkbox labelled "Animate controls and element inside windows". Apparently that simple little checkbox controls whether or not a WorkerW window is even allowed to be created under Progman. I have always disabled any and all animation effects in Windows for years. And this was one of them. After checking this box, WorkerW is able to be created under Progman and all is good now. All examples work on my machine now. I would have reinstalled Windows and it still would have failed because disabling animation effects is one of the first things that I do after a clean install. 😄
    3 points
  13. wakillon

    SlidingToolbar

    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.7z
    3 points
  14. UEZ

    AutoIt Snippets

    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! PS: I've reinvented the wheel ->
    3 points
  15. 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
  16. 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
  17. 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 EndFunc
    3 points
  18. _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 much
    3 points
  19. 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
  20. ioa747

    _LinksInspector

    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], "&amp;", "&") $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 much
    3 points
  21. 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 beginning
    3 points
  22. You're perfectly right. Relevant neurons fixed!
    3 points
  23. 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
  24. @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
  25. Tremendous! Thank you, this gives me something to tinker with!
    2 points
  26. User Interface Builder Overview Use this tool to visually design Windows applications with a focus on Metro windows, standard windows, and Tool windows. This is for users who want a faster and simpler development tool. Drag-and-drop GUI creation, code generation, and easy control alignment tools. No more clicking through property sheets to set variable names, sizes, and the control’s text. Please replace "MetroUDF-Required\SSCtrlHover.au3" within the metro UDF files to see more meaningful messages in the console. The following line was inserted into the function. This prevents crashing on syntax and logical errors while Metro buttons are in use. Func _cHvr_Register($idCtrl, $fnHovOff = '', $fnHoverOn = '', $fnClick = '', $fnDblClk = '', $HoverData = 0,$ClickData = 0,$fnRightClick = '') If $BLOCK_HOVER_REGISTRATION Then Return Unfortunately, the following will have to added to your scripts if you already use Metro UDF and you replace "SSCtrlHover.au3". Global $BLOCK_HOVER_REGISTRATION = False #include "MetroGUI_UDF.au3" #include "MetroGUI_UDF_xpk.au3" #include "_GUIDisable.au3" ; For dim effects when msgbox is displayed Features Metro Controls for all window types WYSIWYG real-time preview Generates AutoIt GUI and message loop code Multiple control selection and manipulation Make additional selections with the CTRL key Accelerated control movements with the SHIFT key Change controls position with mouse or arrow keys Double click a control to precisely set its size and text Save/load GUI layouts and Control layouts to files Custom styles/themes and Controls using Metro Snap-to-guide, and toolbar alignment aids Drag down guides from the top and left sides of the Designer window Copy-n-paste between different window types Technical Details .Gui/.Ctrls file is a simple delimited text file Copy-n-paste is a similar file without the window specifications The application is meant to be portable, so it is one file The only Custom UDFs in use is Metro 5.1, and my Metro Expansion pack The script uses Label controls for everything. No GDI was used. Every control handle is saved in an array Maps are used in Metro and in future UDFs containing new controls You need Metro 5.1 UDF Limitations and known issues Resizing the Metro window with the mouse is flaky Changing control and window styles is not implemented Window size cannot be changed precisely Undo functionality might cause problems with code generation No Redo implemented Thank you BB19 and everyone that contributed to Metro UDF. MetroGUI_UDF_xpk.au3 SSCtrlHover.au3 UserInterfaceBuilder.au3
    2 points
  27. Finally! Latest version in the OP. Huge shoutout to Jos because I leaned very heavily on his AutoItGotoDefinition (you did write that I assume?).
    2 points
  28. You're supposed to be able to set #AutoIt3Wrapper_AU3Check_Parameters with the flags you want (which would be -w- 4 for turning off the local in global scope warning) but turns out there's a bug with reading them in for the diagnostics that I'm fixing right now. `
    2 points
  29. Hi everyone, that's exactly right ! I found the solution at work this morning! But I couldn't respond. Like you, I considered adding a variable : $iRet_Value, but I tried to overcomplicate things at the beginning and i lost time ! Case $g_idButton4 ConsoleWrite("GUI2: CANCEL=" & $g_idButton4 & @CRLF) $iRet_Value ="KO" ExitLoop and i put : if $iRet_Value ="KO" then return instead : if gui2()... I didn't know this way : Func Traitement_intermediaire()     ; display the listview     If gui2() Then Return     MsgBox(0, "Suite", "cela continue")  ;suite du script     ;.... EndFunc   ;==>Traitement_intermediair Thank you for your help 🙂
    2 points
  30. wakillon

    enumicons.au3

    Last week I came across enumicons.au3 in the folder C:\Program Files (x86)\AutoIt3\Examples\GUI\Advanced and while testing it, I thought that a small update wouldn't hurt enumicons.au3
    2 points
  31. @pixelsearch thanks for the clarification, because I didn't think about/understand this case question, isn't that enough? Local $aMsg = 0, $iReturn = 0 While 1 $aMsg = GUIGetMsg($GUI_EVENT_ARRAY) Switch $aMsg[1] ; Switch from GUIs Case $g_hGUI2 Switch $aMsg[0] ; Switch from event ID Case $GUI_EVENT_CLOSE, $g_idButton4 ConsoleWrite("GUI2: $GUI_EVENT_CLOSE=" & $GUI_EVENT_CLOSE & @CRLF) If $aMsg[0] = $g_idButton4 Then ConsoleWrite(" with Cancel" & @CRLF) $iReturn = 1 EndIf ExitLoop Case $g_idButton3 ConsoleWrite("GUI2: $g_idButton3=" & $g_idButton3 & @CRLF) MessageBox(2) EndSwitch EndSwitch WEnd GUIDelete($g_hGUI2) GUICtrlSetState($g_idButton2, $GUI_ENABLE) Opt("GUIOnEventMode", 1) ; when out of $g_hGUI2 - enable <<<<<<<<<<<<<<< Return $iReturn EndFunc ;==>gui2 ... Func Traitement_intermediaire() ; display the listview If gui2() Then Return MsgBox(0, "Suite", "cela continue") ;suite du script ;.... EndFunc ;==>Traitement_intermediaire
    2 points
  32. ... Local $sFile = StringLeft(@AutoItExe, StringInStr(@AutoItExe, "\", 0, -1) -1 ) & "\Examples\GUI\logo4.gif" Local $hImage = _GDIPlus_ImageLoadFromFile($sFile) ;create an image object based on a file Global $hWorkerW = _WinAPI_FindWindowEx($hProgman, 0, "WorkerW", "") If Not $hWorkerW Then ; dah Local $aEnumWindows = _WinAPI_EnumWindows(False) For $n = 1 To UBound($aEnumWindows) - 1 If $aEnumWindows[$n][1] <> "WorkerW" Then ContinueLoop If _WinAPI_GetParent($aEnumWindows[$n][0]) = $hProgman Then $hWorkerW = $aEnumWindows[$n][0] ExitLoop ; but is likely one at the end of the Z-order EndIf Next EndIf If $hWorkerW = 0 Then Exit MsgBox(16, "ERROR", "Couldn't find WorkerW under Progman", 30) ... OnAutoItExitRegister(CleanupResources) While GUIGetMsg() <> $GUI_EVENT_CLOSE WEnd CleanupResources() Func CleanupResources() Local Static $iRunOnce = 0 If $iRunOnce Then Return ConsoleWrite('+ Func CleanupResources() - WinExists: ' & WinExists($hGUI) & ' - ' & (IsInt(Execute("@exitCode")) ? 'TrayExit' : 'GuiClosed') & @CRLF) ;cleanup resources _GDIPlus_BrushDispose($hTexture) _GDIPlus_ImageDispose($hImage) _GDIPlus_GraphicsDispose($hGraphics) _GDIPlus_Shutdown() GUIDelete($hGUI) $iRunOnce = 1 EndFunc ... ...be mindful of everyone and everything ?
    2 points
  33. See example in helpfile for _GDIPlus_TextureCreate()
    2 points
  34. Instead of directly processing everything in AutoIt, I followed the examples from LarsJ in this Thread: Got everything working as I wanted.
    2 points
  35. 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 ;==>FontGetInfoFromFile
    2 points
  36. Hello Here is my network UDF. Do not yell at me if it already exists ... I hope it will be useful to someone. Please, let me know if you have any problem. All functions that perform modifications required administrator rights Functions list : Internal functions only : Examples : #Include "network.au3" ; List of availables connections/cards #Include <array.au3> ; only for _ArrayDisplay() $infos = _GetNetworkAdapterList() _ArrayDisplay($infos) ; Network card informations for the network connection called "Local Area Network" $infos = _GetNetworkAdapterInfos("Local Area Network") _ArrayDisplay($infos) ; Disable a network connection _DisableNetAdapter("Broadcom NetLink (TM) Gigabit Ethernet") ; OR _DisableNetAdapter("Local Area Network") ; Enable a network connection _EnableNetAdapter("Local Area Network") ; OR _EnableNetAdapter("Broadcom NetLink (TM) Gigabit Ethernet") ; Enable DHCP (for IP Address) _EnableDHCP("Broadcom NetLink (TM) Gigabit Ethernet") ; OR _EnableDHCP("Local Area Network") ; Configure a static IP adress _EnableStatic("Broadcom NetLink (TM) Gigabit Ethernet", "192.168.10.11", "255.255.255.0") ; OR _EnableStatic("Local Area Network", "192.168.10.11", "255.255.255.0") ; Configure the default gateway _SetGateways("Broadcom NetLink (TM) Gigabit Ethernet", "192.168.10.1") ; OR _SetGateways("Local Area Network", "192.168.10.1") ; Configure DNS servers Local $DNS_SERVERS[4] = [ "192.168.100.1", "192.168.100.2", "192.168.100.3", "192.168.100.4" ] _SetDNSServerSearchOrder("Local Area Network", $DNS_SERVERS) ; OR _SetDNSServerSearchOrder("Broadcom NetLink (TM) Gigabit Ethernet", $DNS_SERVERS) ; Configure the DNS domain name _SetDNSDomain ("Local Area Network", "mondomain.loc") ; OR _SetDNSDomain ("Broadcom NetLink (TM) Gigabit Ethernet", "mondomain.loc") ; Configure the DNS suffixes for all connections : Local $DNS_SUFFIXES[2] = [ "mondomain.loc", "mydomain.priv" ] _SetDNSSuffixSearchOrder($DNS_SUFFIXES) ; Clear the DNS cache (like ipconfig /flushdns) _FlushDNS() ; Remove an entry from the DNS cache _FlushDNSEntry("www.autoitscript.com") ; Configure the WINS servers (very old, now ...) _SetWINSServer("Local Area Network", "192.168.100.251", "192.168.100.252") ; OR _SetWINSServer("Broadcom NetLink (TM) Gigabit Ethernet", "192.168.100.251", "192.168.100.252") ; Enable the two options : ; - Register this connection's address in DNS ( first parameter) ; - Use this connection's DNS suffix in DNS registration (second parameter) _SetDynamicDNSRegistration("Local Area Network", True, True) ; Release the DHCP lease _ReleaseDHCPLease() ; Renew the DHCP lease _RenewDHCPLease() ; Sets the Private category to the network connection called "LAN" _SetCategory("LAN", 1) Download link : Network.au3
    2 points
  37. wakillon

    _LinksInspector

    Hi ioa747 I have tried your code with an autoitscript.com xml file sitemap and it works pretty well 😉 https://www.autoitscript.com/site/page-sitemap.xml And we can see some 404 error messages there 😅
    2 points
  38. 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
  39. 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
  40. Fair enough, understood, thanks. Thanks 👌 . 😂 Maybe you should rename yourself to Philosoph'tum 😆 . Best regards Sven
    2 points
  41. 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
  42. Biatu

    Calling 7z.dll

    https://github.com/BiatuAutMiahn/DriverMgr2/blob/main/CPP/7zip/UI/Client7z/Client7z.cpp I franeknstein'd Igor's Client7z implementation so that I could read DriverPack archives, and make a driver database. Cleaned that mess up a bit into this: https://github.com/BiatuAutMiahn/7zip/blob/DriverMgr/CPP/7zip/Common/DriverPackMgr.cpp Then I exported the ddb functionality into a standalone utility for the DriverPackDB creation and hardware matching. https://github.com/BiatuAutMiahn/dpdbutil This is part of a driver framework in my WinPE project for work. Figured this was perfect for adding drivers to WinPE instead of mounting the image and injecting drivers, just look for the DDBs and load them.
    2 points
  43. Tested with AutoIt 3.3.18.0 on a german W11 24H2 system. Works perfektly!
    2 points
  44. #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
  45. 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
  46. 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 translation
    2 points
  47. 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
  48. 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
  49. 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
  50. Come checkout my Metro GUI designer. User Interface Builder
    2 points
×
×
  • Create New...