Jump to content

WinHttp button click


AutID
 Share

Recommended Posts

Hello there,

I have a button and I want to click it before sumbiting a form because it changes the editor and allows me to use @CRLF with _WinHttpSimpleFormFill. Or I hope it does.

So anyone has any idea how to click a button???

I haven't tried anything special because I am not very familiar with winhttp.

I asked trancexx but it is kinda rude to ask her everytime so i ask here as well ;)

Cheers.

Link to comment
Share on other sites

Look the help file examples.

#include "WinHttp.au3"

Opt("MustDeclareVars", 1)

Global $hOpen, $hConnect
Global $sRead, $hFileHTM, $sFileHTM = @ScriptDir & "\Form.htm"

; Example1:
; 1. Open APNIC whois page (http://wq.apnic.net/apnic-bin/whois.pl)
; 2. Fill form on that page with these values/conditins:
; - fill default form
; - set ip address 4.2.2.2 to input box. Use name propery to locate input
; - send form (click button)
; - gather returned data

; Initialize and get session handle
$hOpen = _WinHttpOpen()
; Get connection handle
$hConnect = _WinHttpConnect($hOpen, "wq.apnic.net")
; Fill form on this page
$sRead = _WinHttpSimpleFormFill($hConnect, "apnic-bin/whois.pl", Default, "name:searchtext", @IPAddress1)
; Close connection handle
_WinHttpCloseHandle($hConnect)
; Close session handle
_WinHttpCloseHandle($hOpen)

; See what's returned (in default browser or whatever)
If $sRead Then
    MsgBox(64 + 262144, "Done!", "Will open returned page in your default browser now." & @CRLF & _
            "When you close that window another example will run.")
    $hFileHTM = FileOpen($sFileHTM, 2)
    FileWrite($hFileHTM, $sRead)
    FileClose($hFileHTM)
    ShellExecuteWait($sFileHTM)
EndIf

saludos

Link to comment
Share on other sites

Look the help file examples.

#include "WinHttp.au3"

Opt("MustDeclareVars", 1)

Global $hOpen, $hConnect
Global $sRead, $hFileHTM, $sFileHTM = @ScriptDir & "\Form.htm"

; Example1:
; 1. Open APNIC whois page (http://wq.apnic.net/apnic-bin/whois.pl)
; 2. Fill form on that page with these values/conditins:
; - fill default form
; - set ip address 4.2.2.2 to input box. Use name propery to locate input
; - send form (click button)
; - gather returned data

; Initialize and get session handle
$hOpen = _WinHttpOpen()
; Get connection handle
$hConnect = _WinHttpConnect($hOpen, "wq.apnic.net")
; Fill form on this page
$sRead = _WinHttpSimpleFormFill($hConnect, "apnic-bin/whois.pl", Default, "name:searchtext", @IPAddress1)
; Close connection handle
_WinHttpCloseHandle($hConnect)
; Close session handle
_WinHttpCloseHandle($hOpen)

; See what's returned (in default browser or whatever)
If $sRead Then
    MsgBox(64 + 262144, "Done!", "Will open returned page in your default browser now." & @CRLF & _
            "When you close that window another example will run.")
    $hFileHTM = FileOpen($sFileHTM, 2)
    FileWrite($hFileHTM, $sRead)
    FileClose($hFileHTM)
    ShellExecuteWait($sFileHTM)
EndIf
saludos

As far as i know that function fills a form and sumbits it.

If i wrote right on the first post i want to click a button which changes a setting and then use _WinHttpSimpleFormFill to fill a form and submit it...

_WinHttpSimpleFormFill fills fields with data and then submits it... Now maybe i am not understanding it right...

Link to comment
Share on other sites

You can't click a button with WinHTTP functions from what I'm seeing in the help file for it.

You'd need to open the page with IE and use the IE UDF to click the button for you before you can submit the form data, which kind of defeats the whole usage of WinHTTP seeing as how you can probably do it all with the _IE* functions.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

You can't click a button with WinHTTP functions from what I'm seeing in the help file for it.

You'd need to open the page with IE and use the IE UDF to click the button for you before you can submit the form data, which kind of defeats the whole usage of WinHTTP seeing as how you can probably do it all with the _IE* functions.

I can't find a solution with winhttp but i think it is possible... Of course i won't mix ie with winhttp...

Any other opinions???

Link to comment
Share on other sites

What makes you think that it's possible? What have you read that points to that conclusion? What have you tried?

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

  • 2 weeks later...

Nothing. I just don't find it difficult. It must be a simple request which will send a request for the button but i cant get it working. Or i hope it is.
Still _WinHttpSimpleFormFill fails with @CRLF while filling fields with data.

Btw  now that i am thinking, that button changes the rich editor to a source editor where you can use line breakers. I will check the source code to see if that source editor has a different name or id to use _WinHttpSimpleFormFill with it's ids.
 

Edited by AutID
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...