You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Expanded the README.md to include detailed explanations of the WebDemo features, including context-aware menus and advanced utilities. Added sections on how it works and tips for developers.
Copy file name to clipboardExpand all lines: README.md
+78-2Lines changed: 78 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -20,8 +20,84 @@ Due to changes in the COM Dispatch IDs (DispIds) for better organization, it is
20
20
21
21
22
22
23
-
---
24
-
---
23
+
---
24
+
---
25
+
26
+
### 📖 Understanding the WebDemo (v1.4)
27
+
28
+
The **`WebDemo_v1.4.au3`** is not just a browser,
29
+
it is a showcase of **Bi-directional Intelligence**.
30
+
It demonstrates how AutoIt can "read" the DOM state via COM events to provide a context-specific user interface.
31
+
32
+
#### 1. Context-Aware Menu (The "Right-Click" Magic)
33
+
34
+
The demo intercepts the native context menu and replaces it with a dynamic AutoIt menu. The options change based on the **HTML element** under your cursor:
35
+
36
+
-**📥 Table Intelligence**:
37
+
38
+
-**Action**: Right-click anywhere inside a `<table>`.
39
+
40
+
-**What happens**: The library detects the `tagName`, calculates the table's index via coordinates, and offers an **Export to CSV** option. It uses the `bridge.js` to scrape the data directly from the browser's memory.
41
+
42
+
-**📋 Form Automation**:
43
+
44
+
-**Action**: Right-click on an `<input>`, `<textarea>`, or `<form>`.
45
+
46
+
-**What happens**:
47
+
48
+
-**Map Form to JSON**: Automatically crawls the form and generates a JSON file with all current values.
49
+
50
+
-**Fill Form from JSON**: Lets you select a previously saved JSON file to instantly re-populate the form.
51
+
52
+
-**🔍 Smart Selection**:
53
+
54
+
-**Action**: Highlight any text on the page and right-click.
55
+
56
+
-**What happens**: The menu offers a Google Search for that specific string, using the new native `EncodeURI` method to handle special characters.
57
+
58
+
59
+
#### 2. Advanced Utilities
60
+
61
+
-**📸 Full Page Screenshot**: Unlike standard screen captures, this utility renders the **entire document** (including the parts you need to scroll to see) and saves it as a high-quality PNG.
62
+
63
+
-**⚡ Persistent Bridge**: Notice that even if you navigate to a new website or refresh, the "Table Export" and "Form Mapping" still work. This is thanks to the new `AddInitializationScript` which ensures our `bridge.js` is part of every page's DNA.
64
+
65
+
66
+
---
67
+
68
+
### ⚙️ How it Works: The "Context-JSON" Bridge
69
+
70
+
The secret behind this intelligent menu is the seamless communication between the Browser's DOM and AutoIt's COM interface.
71
+
72
+
#### The Workflow:
73
+
74
+
1.**The Trigger**: When you right-click, the `bridge.js` (injected via `AddInitializationScript`) intercepts the event.
75
+
76
+
2.**Data Gathering**: It instantly gathers metadata about the element under the mouse (Coordinates, Tag Type, Selected Text, Image Sources, etc.).
77
+
78
+
3.**The Dispatch**: This metadata is packed into a **JSON string** and sent to AutoIt via the `OnContextMenu` event.
79
+
80
+
4.**The Decision**: AutoIt receives the JSON, parses it using `NetJson.Parser`, and decides which menu items to show.
81
+
82
+
83
+
#### Why JSON?
84
+
85
+
-**Structure**: It allows passing multiple data points (X, Y, Tag, URL) in a single, organized string.
86
+
87
+
-**Performance**: By prefixing with `JSON:`, we bypass complex string encoding, making the communication near-instant.
88
+
89
+
-**Flexibility**: You can easily add more data points to the `bridge.js` without ever changing the core DLL.
90
+
91
+
92
+
---
93
+
94
+
### 💡 Pro Tip for Developers:
95
+
96
+
> "You can extend this! If you want to detect specifically if a user clicked on a **Video** or a **PDF link**, just update the `bridge.js` to include those tags.
0 commit comments