@@ -10,24 +10,33 @@ Information=Demonstrates controlling WebView2 via !CommandMeasure bangs.
1010Version =1.0
1111License =Creative Commons Attribution-Non-Commercial-Share Alike 3.0
1212
13+ [Variables]
14+ WebURL =https://nstechbytes.pages.dev/
15+ WebW =600
16+ WebH =350
17+ WebX =300
18+ WebY =25
19+ Hidden =0
1320; ========================================
1421; Measure
1522; ========================================
1623[MeasureWebView]
1724Measure =Plugin
1825Plugin =WebView2
19- URL =https://nstechbytes.pages.dev/
20- W =600
21- H =350
22- X =300
23- Y =25
26+ URL =# WebURL#
27+ W =# WebW#
28+ H =# WebH#
29+ X =# WebX#
30+ Y =# WebY#
31+ Hidden =# Hidden#
32+ DynamicVariables =1
2433
2534; ========================================
2635; Background
2736; ========================================
2837[MeterBackground]
2938Meter =Shape
30- Shape =Rectangle 0,0,950,400 | FillColor 0,0,0,1 | StrokeWidth 0
39+ Shape =Rectangle 0,0,950,420,12 | FillColor 0,0,0,200 | StrokeWidth 0
3140
3241[Title]
3342Meter =String
@@ -36,7 +45,7 @@ FontSize=16
3645FontColor =255,255,255,255
3746AntiAlias =1
3847X =25
39- Y =5
48+ Y =10
4049
4150[StyleButtonText]
4251FontColor =255,255,255,255
@@ -48,22 +57,38 @@ StringAlign=CenterCenter
4857SolidColor =0,200,255,150
4958
5059; ========================================
51- ; Navigate to URL
60+ ; Navigate to URL (Dynamic Variables)
5261; ========================================
53- [TxtNavigate ]
62+ [TxtNavigateGoogle ]
5463Meter =String
5564MeterStyle =StyleButtonText
56- Text =Navigate to https://example.com
65+ Text =Navigate to Google (via Variable)
5766X =150
5867Y =58
68+ LeftMouseUpAction =[!SetVariable WebURL " https://www.google.com" ][!UpdateMeasure MeasureWebView][!Redraw]
69+
70+ [TxtNavigateGitHub]
71+ Meter =String
72+ MeterStyle =StyleButtonText
73+ Text =Navigate to GitHub (via Variable)
74+ X =150
75+ Y =88
76+ LeftMouseUpAction =[!SetVariable WebURL " https://github.com" ][!UpdateMeasure MeasureWebView][!Redraw]
77+
78+ [TxtNavigateExample]
79+ Meter =String
80+ MeterStyle =StyleButtonText
81+ Text =Navigate to Example (via Bang)
82+ X =150
83+ Y =118
5984LeftMouseUpAction =[!CommandMeasure MeasureWebView " Navigate https://example.com" ]
6085
6186[TxtReload]
6287Meter =String
6388MeterStyle =StyleButtonText
6489Text =Reload
6590X =150
66- Y =88
91+ Y =148
6792LeftMouseUpAction =[!CommandMeasure MeasureWebView " Reload" ]
6893
6994[TxtGoBack]
@@ -73,7 +98,7 @@ Text=Go Back
7398W =122
7499H =24
75100X =86
76- Y =118
101+ Y =178
77102LeftMouseUpAction =[!CommandMeasure MeasureWebView " GoBack" ]
78103
79104[TxtGoForward]
@@ -83,7 +108,7 @@ Text=Go Forward
83108W =125
84109H =24
85110X =212
86- Y =118
111+ Y =178
87112LeftMouseUpAction =[!CommandMeasure MeasureWebView " GoForward" ]
88113
89114[TxtShow]
@@ -93,8 +118,8 @@ Text=Show
93118W =122
94119H =24
95120X =86
96- Y =148
97- LeftMouseUpAction =[!CommandMeasure MeasureWebView " Show " ]
121+ Y =208
122+ LeftMouseUpAction =[!SetVariable Hidden 0][!UpdateMeasure MeasureWebView][!Redraw ]
98123
99124[TxtHide]
100125Meter =String
@@ -103,53 +128,56 @@ Text=Hide
103128W =125
104129H =24
105130X =212
106- Y =148
107- LeftMouseUpAction =[!CommandMeasure MeasureWebView " Hide " ]
131+ Y =208
132+ LeftMouseUpAction =[!SetVariable Hidden 1][!UpdateMeasure MeasureWebView][!Redraw ]
108133
109134[TxtExecuteScript]
110135Meter =String
111136MeterStyle =StyleButtonText
112137Text =Execute Script
113138X =150
114- Y =178
139+ Y =238
115140LeftMouseUpAction =[!CommandMeasure MeasureWebView " ExecuteScript alert('Hello!')" ]
116141
117142[TxtOpenDevTools]
118143Meter =String
119144MeterStyle =StyleButtonText
120145Text =Open DevTools
121146X =150
122- Y =208
147+ Y =268
123148LeftMouseUpAction =[!CommandMeasure MeasureWebView " OpenDevTools" ]
124149
125150[TxtSetWidth]
126151Meter =String
127152MeterStyle =StyleButtonText
128- Text =Set Width: 500
153+ Text =Set Width: 500 (via Variable)
129154X =150
130- Y =238
131- LeftMouseUpAction =[!CommandMeasure MeasureWebView " SetW 500" ]
155+ Y =298
156+ LeftMouseUpAction =[!SetVariable WebW 500][!UpdateMeasure MeasureWebView][!Redraw ]
132157
133158[TxtSetHeight]
134159Meter =String
135160MeterStyle =StyleButtonText
136- Text =Set Height: 400
161+ Text =Set Height: 400 (via Variable)
137162X =150
138- Y =268
139- LeftMouseUpAction =[!CommandMeasure MeasureWebView " SetH 400" ]
163+ Y =328
164+ LeftMouseUpAction =[!SetVariable WebH 400][!UpdateMeasure MeasureWebView][!Redraw ]
140165
141166[TxtSetX]
142167Meter =String
143168MeterStyle =StyleButtonText
144- Text =Set X: 100
169+ Text =Set X: 100 (via Variable)
145170X =150
146- Y =298
147- LeftMouseUpAction =[!CommandMeasure MeasureWebView " SetX 100" ]
171+ Y =358
172+ LeftMouseUpAction =[!SetVariable WebX 100][!UpdateMeasure MeasureWebView][!Redraw ]
148173
149174[TxtSetY]
150175Meter =String
151176MeterStyle =StyleButtonText
152- Text =Set Y: 50
177+ Text =Set Y: 50 (via Variable)
153178X =150
154- Y =328
155- LeftMouseUpAction =[!CommandMeasure MeasureWebView " SetY 50" ]
179+ Y =388
180+ LeftMouseUpAction =[!SetVariable WebY 50][!UpdateMeasure MeasureWebView][!Redraw]
181+
182+
183+
0 commit comments