Skip to content

v1.4.2

Choose a tag to compare

@ioa747 ioa747 released this 06 Jan 08:37
· 528 commits to main since this release
95f5a38

Version 1.4.2 - (2026-01-06)

⚡ Synchronous Execution & Enhanced Automation

This major update bridges the gap between the asynchronous nature of WebView2 and the procedural logic of AutoIt, introducing synchronous script results and specialized automation controls.

Added

  • Synchronous Scripting (DispId 188):

    • ExecuteScriptWithResult(string script)(188) Executes JavaScript and returns the result directly to AutoIt in a single line. Includes a 5-second safety timeout and automatic JSON unescaping for clean string results.
  • Automation & Layout Controls (DispIds 189, 191, 193):

    • AddInitializationScript(string script)(187) Injects a script that persists across navigations and refreshes, executing automatically on every new document.

    • SetAutoResize(bool enabled)(189) Enables "Smart Anchor" resizing using Win32 subclassing. Works with non-.NET parent containers (like AutoIt) and maintains top-left offsets. Sends "WINDOW_RESIZED" to AutoIt on completion.

    • ExecuteScriptOnPage(string script)(191) A dedicated method for immediate, high-priority script execution on the current page.

    • ClearCache()(193) Targeted removal of Disk Cache and Local Storage to ensure the browser always loads the freshest content.

  • Unified Context Menu Handling (DispIds 190, 194):

    • OnContextMenuRequested(link, x, y, selection)(190) [Event] Provides a rich, simplified context event with direct access to the URL, coordinates, and selected text under the cursor.

    • CustomMenuEnabled(194) [Property] A Master switch to enable or disable custom menu interception.

  • Advanced Data Binding (DispIds 185 - 186):

    • BindJsonToBrowser(variableName): (185) Securely binds internal JSON data to a JavaScript variable. Updated to ensure 100% COM compatibility with legacy registrations.
    • SyncInternalData(json, bindTo): (186) High-performance helper that parses raw JSON and binds it to a browser variable in a single atomic operation.
  • Integrated Base64 Support (JsonParser) (DispIds 222 - 224):

    • EncodeB64 / DecodeB64: (222, 223) Native Base64 processing directly within the JSON parser, eliminating the need for external Base64 libraries.
    • DecodeB64ToFile(b64, path): (224) Decodes a Base64 stream and saves it directly to disk (perfect for screenshots and binary downloads).

Changed

  • Automation & Layout Controls (DispIds 115, 116, 184):

    • InjectCss(string cssCode)(115) Inject CSS (Persistence to run on every refresh)

    • AddInitializationScript(string script)(116) Clear Injected CSS.

    • ClearInjectedCss()(184) Injects a script that persists across navigations and refreshes, executing automatically on every new document.

Improvements

  • Legacy Compatibility: The context menu logic has been completely redesigned to support both the new parameter-based event (v1.4.2) and the legacy JSON event (v1.4.1) simultaneously.

  • Robustness: JSON parsing now automatically trims whitespace, and all browser interactions include enhanced internal try-catch blocks. Added a Global COM Error Handler in the showcase demo for professional diagnostics.

  • Unified Messaging: WINDOW_RESIZED now includes explicit dimensions (Width|Height) in the data payload for better reactive UI control.

  • Robust Auto-Resizing: Replaced Dock.Fill with a Native Subclassing (NativeWindow) mechanism to intercept WM_SIZE messages directly from the OS, ensuring perfect synchronization even with non-WinForms parent handles.