@@ -2082,66 +2082,129 @@ Func __WinHttpNormalizeActionURL($sActionPage, ByRef $sAction, ByRef $iScheme, B
2082
2082
If $sMethod = " GET" Then $sEnctype = " "
2083
2083
EndFunc
2084
2084
2085
- Func __WinHttpHTML5FormAttribs($aDtas , $aFlds , $iNumParams , ByRef $aInput , ByRef $sAction , ByRef $sEnctype , ByRef $sMethod )
2086
- ; Clicking "submit" is done using:
2085
+ Func __WinHttpHTML5FormAttribs(ByRef $aDtas , ByRef $aFlds , ByRef $iNumParams , ByRef $aInput , ByRef $sAction , ByRef $sEnctype , ByRef $sMethod )
2086
+ ; Clicking "submit" or "image" is done using:
2087
2087
; "type:submit", zero_based_index_of_the_submit_button
2088
+ ; "type:image", zero_based_index_of_the_image_control Xcoord,Ycoord
2088
2089
; "name:whatever", True
2089
2090
; "id:whatever", True
2090
2091
; "whatever", True ;<- same as "id:whatever"
2091
- Local $aSpl , $iSubmitHTML5 = 0 , $iInpSubm
2092
+ Local $aSpl , $iSubmitHTML5 = 0 , $iInpSubm , $sImgAppx = " . "
2092
2093
For $k = 1 To $iNumParams
2093
2094
$aSpl = StringSplit ($aFlds [$k ], " :" , 2 )
2094
- If $aSpl [0 ] = " type" And $aSpl [1 ] = " submit" Then
2095
- Local $iSubmIndex = $aDtas [$k ], $iSubmCur = 0
2095
+ If $aSpl [0 ] = " type" And ($aSpl [1 ] = " submit" Or $aSpl [1 ] = " image" ) Then
2096
+ Local $iSubmIndex = $aDtas [$k ], $iSubmCur = 0 , $iImgCur = 0 , $sType , $sInpNme
2097
+ If $aSpl [1 ] = " image" Then
2098
+ $iSubmIndex = Int ($aDtas [$k ])
2099
+ EndIf
2096
2100
For $i = 0 To UBound ($aInput ) - 1 ; for all input elements
2097
- If __WinHttpAttribVal($aInput [$i ], " type" ) = " submit" Then
2098
- If $iSubmCur = $iSubmIndex Then
2099
- $iSubmitHTML5 = 1
2100
- $iInpSubm = $i
2101
- Else
2102
- $aInput [$i ] = " " ; remove any other submit control
2103
- EndIf
2104
- $iSubmCur += 1
2105
- EndIf
2101
+ Switch __WinHttpAttribVal($aInput [$i ], " type" )
2102
+ Case " submit"
2103
+ If $iSubmCur = $iSubmIndex Then
2104
+ $iSubmitHTML5 = 1
2105
+ $iInpSubm = $i
2106
+ ExitLoop 2
2107
+ EndIf
2108
+ $iSubmCur += 1
2109
+ Case " image"
2110
+ If $iImgCur = $iSubmIndex Then
2111
+ $iSubmitHTML5 = 1
2112
+ $iInpSubm = $i
2113
+ $sInpNme = __WinHttpAttribVal($aInput [$iInpSubm ], " name" )
2114
+ If $sInpNme Then $sInpNme &= $sImgAppx
2115
+ $aInput [$iInpSubm ] = ' type="image" formaction="' & __WinHttpAttribVal($aInput [$iInpSubm ], " formaction" ) & ' " formenctype="' & __WinHttpAttribVal($aInput [$iInpSubm ], " formenctype" ) & ' " formmethod="' & __WinHttpAttribVal($aInput [$iInpSubm ], " formmethod" ) & ' "'
2116
+ Local $sX = 0 , $sY = 0
2117
+ $iX = Int (StringRegExpReplace ($aDtas [$k ], " (\d+)\h*(\d+),(\d+)" , " $2" , 1 ))
2118
+ $iY = Int (StringRegExpReplace ($aDtas [$k ], " (\d+)\h*(\d+),(\d+)" , " $3" , 1 ))
2119
+ ReDim $aInput [UBound ($aInput ) + 2 ]
2120
+ $aInput [UBound ($aInput ) - 2 ] = ' type="image" name="' & $sInpNme & ' x" value="' & $iX & ' "'
2121
+ $aInput [UBound ($aInput ) - 1 ] = ' type="image" name="' & $sInpNme & ' y" value="' & $iY & ' "'
2122
+ ExitLoop 2
2123
+ EndIf
2124
+ $iImgCur += 1
2125
+ EndSwitch
2106
2126
Next
2107
- ElseIf $aSpl [0 ] = " name" Then
2108
- Local $sInpNme = $aSpl [1 ]
2127
+ ElseIf $aSpl [0 ] = " name" Then
2128
+ Local $sInpNme = $aSpl [1 ], $sType
2109
2129
For $i = 0 To UBound ($aInput ) - 1 ; for all input elements
2110
- If __WinHttpAttribVal($aInput [$i ], " type" ) = " submit" Then
2130
+ $sType = __WinHttpAttribVal($aInput [$i ], " type" )
2131
+ If $sType = " submit" Then
2111
2132
If __WinHttpAttribVal($aInput [$i ], " name" ) = $sInpNme And $aDtas [$k ] = True Then
2112
2133
$iSubmitHTML5 = 1
2113
2134
$iInpSubm = $i
2114
- ExitLoop
2135
+ ExitLoop 2
2136
+ EndIf
2137
+ ElseIf $sType = " image" Then
2138
+ If __WinHttpAttribVal($aInput [$i ], " name" ) = $sInpNme And $aDtas [$k ] Then
2139
+ $iSubmitHTML5 = 1
2140
+ $iInpSubm = $i
2141
+ Local $aStrSplit = StringSplit ($aDtas [$k ], " ," , 3 ), $iX = 0 , $iY = 0
2142
+ If Not @error Then
2143
+ $iX = Int ($aStrSplit [0 ])
2144
+ $iY = Int ($aStrSplit [1 ])
2145
+ EndIf
2146
+ $aInput [$iInpSubm ] = ' type="image" formaction="' & __WinHttpAttribVal($aInput [$iInpSubm ], " formaction" ) & ' " formenctype="' & __WinHttpAttribVal($aInput [$iInpSubm ], " formenctype" ) & ' " formmethod="' & __WinHttpAttribVal($aInput [$iInpSubm ], " formmethod" ) & ' "'
2147
+ $sInpNme &= $sImgAppx
2148
+ ReDim $aInput [UBound ($aInput ) + 2 ]
2149
+ $aInput [UBound ($aInput ) - 2 ] = ' type="image" name="' & $sInpNme & ' x" value="' & $iX & ' "'
2150
+ $aInput [UBound ($aInput ) - 1 ] = ' type="image" name="' & $sInpNme & ' y" value="' & $iY & ' "'
2151
+ ExitLoop 2
2115
2152
EndIf
2116
2153
EndIf
2117
2154
Next
2118
- If $iSubmitHTML5 Then ExitLoop
2119
2155
Else ; id
2120
- Local $sInpId
2156
+ Local $sInpId , $sType
2121
2157
If @error Then
2122
2158
$sInpId = $aSpl [0 ]
2123
2159
ElseIf $aSpl [0 ] = " id" Then
2124
2160
$sInpId = $aSpl [1 ]
2125
2161
EndIf
2126
2162
For $i = 0 To UBound ($aInput ) - 1 ; for all input elements
2127
- If __WinHttpAttribVal($aInput [$i ], " type" ) = " submit" Then
2163
+ $sType = __WinHttpAttribVal($aInput [$i ], " type" )
2164
+ If $sType = " submit" Then
2128
2165
If __WinHttpAttribVal($aInput [$i ], " id" ) = $sInpId And $aDtas [$k ] = True Then
2129
2166
$iSubmitHTML5 = 1
2130
2167
$iInpSubm = $i
2131
- ExitLoop
2168
+ ExitLoop 2
2169
+ EndIf
2170
+ ElseIf $sType = " image" Then
2171
+ If __WinHttpAttribVal($aInput [$i ], " id" ) = $sInpId And $aDtas [$k ] Then
2172
+ $iSubmitHTML5 = 1
2173
+ $iInpSubm = $i
2174
+ Local $sInpNme = __WinHttpAttribVal($aInput [$iInpSubm ], " name" )
2175
+ If $sInpNme Then $sInpNme &= $sImgAppx
2176
+ Local $aStrSplit = StringSplit ($aDtas [$k ], " ," , 3 ), $iX = 0 , $iY = 0
2177
+ If Not @error Then
2178
+ $iX = Int ($aStrSplit [0 ])
2179
+ $iY = Int ($aStrSplit [1 ])
2180
+ EndIf
2181
+ $aInput [$iInpSubm ] = ' type="image" formaction="' & __WinHttpAttribVal($aInput [$iInpSubm ], " formaction" ) & ' " formenctype="' & __WinHttpAttribVal($aInput [$iInpSubm ], " formenctype" ) & ' " formmethod="' & __WinHttpAttribVal($aInput [$iInpSubm ], " formmethod" ) & ' "'
2182
+ ReDim $aInput [UBound ($aInput ) + 2 ]
2183
+ $aInput [UBound ($aInput ) - 2 ] = ' type="image" name="' & $sInpNme & ' x" value="' & $iX & ' "'
2184
+ $aInput [UBound ($aInput ) - 1 ] = ' type="image" name="' & $sInpNme & ' y" value="' & $iY & ' "'
2185
+ ExitLoop 2
2132
2186
EndIf
2133
2187
EndIf
2134
2188
Next
2135
- If $iSubmitHTML5 Then ExitLoop
2136
2189
EndIf
2137
2190
Next
2138
2191
If $iSubmitHTML5 Then
2192
+ Local $iUbound = UBound ($aInput ) - 1
2193
+ If __WinHttpAttribVal($aInput [$iInpSubm ], " type" ) = " image" Then $iUbound -= 2 ; two form fields are added for "image"
2194
+ For $j = 0 To $iUbound ; for all other input elements
2195
+ If $j = $iInpSubm Then ContinueLoop
2196
+ Switch __WinHttpAttribVal($aInput [$j ], " type" )
2197
+ Case " submit" , " image"
2198
+ $aInput [$j ] = " " ; remove any other submit/image controls
2199
+ EndSwitch
2200
+ Next
2139
2201
Local $sAttr = __WinHttpAttribVal($aInput [$iInpSubm ], " formaction" )
2140
2202
If $sAttr Then $sAction = $sAttr
2141
2203
$sAttr = __WinHttpAttribVal($aInput [$iInpSubm ], " formenctype" )
2142
2204
If $sAttr Then $sEnctype = $sAttr
2143
2205
$sAttr = __WinHttpAttribVal($aInput [$iInpSubm ], " formmethod" )
2144
2206
If $sAttr Then $sMethod = $sAttr
2207
+ If __WinHttpAttribVal($aInput [$iInpSubm ], " type" ) = " image" Then $aInput [$iInpSubm ] = " "
2145
2208
EndIf
2146
2209
EndFunc
2147
2210
0 commit comments