Skip to content

Commit 8e8a27d

Browse files
committed
Added: Example for rev.220
1 parent 2fa0b20 commit 8e8a27d

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
2+
3+
#include "WinHttp.au3"
4+
5+
Opt("MustDeclareVars", 1)
6+
7+
Global $hOpen, $hConnect
8+
Global $sRead, $hFileHTM, $sFileHTM = @ScriptDir & "\Form.htm"
9+
10+
; Example 2:
11+
; 1. Open w3schools forms page (https://www.w3schools.com/tags/tryit.asp?filename=tryhtml5_input_form)
12+
; 2. Fill form on that page with these values/conditins:
13+
; - form is to be identified by its index -0-
14+
; - set -Miyake- and -Issey- data to input boxes. Locate input boxes by their names -fname- and -lname- (lname is outside the form element, but still part of the form)
15+
16+
; Initialize and get session handle
17+
$hOpen = _WinHttpOpen()
18+
; Get connection handle
19+
$hConnect = _WinHttpConnect($hOpen, "https://www.w3schools.com")
20+
; Fill form on this page
21+
$sRead = _WinHttpSimpleFormFill($hConnect, "tags/tryit.asp?filename=tryhtml5_input_form", "index:0", "name:fname", "Miyake", "name:lname", "Issey")
22+
; Close connection handle
23+
_WinHttpCloseHandle($hConnect)
24+
; Close session handle
25+
_WinHttpCloseHandle($hOpen)
26+
27+
If $sRead Then
28+
MsgBox(64 + 262144, "Done!", "Will open returned page in your default browser now." & @CRLF & _
29+
"You should see 'Miyake Issey' somewhere on that page.")
30+
$hFileHTM = FileOpen($sFileHTM, 2)
31+
FileWrite($hFileHTM, $sRead)
32+
FileClose($hFileHTM)
33+
ShellExecuteWait($sFileHTM)
34+
EndIf

0 commit comments

Comments
 (0)