Jump to content

Autoit go to website and give information


Recommended Posts

Hello.

I'm new to autoit and i need some help please.

 

I want to create a script, where, when i click in a button, it will go to a website, copy the information i want, and give me the information in the GUI, without opening the browser.

 

So, i create a GUI

 
#include <MsgBoxConstants.au3>
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Kassadin", 266, 92, 460, 286)
$Label1 = GUICtrlCreateLabel("Information from website", 32, 32, 84, 17)
$Button1 = GUICtrlCreateButton("Generate", 160, 24, 65, 25, $WS_GROUP)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
         Case $Button1
            GotoWebsite()

    EndSwitch
WEnd



Func Gotowebsite()

The function i want, is that it would go to this website: https://10minutemail.net/

And then would copy the random e-mail that generated and change the $Label1 to the random e-mail generated.

But all this, wihtout opening my browser, i know it's possible to get information from a website without actually opening the browser, i already seen scripts like that, please someone help me :)

Thank you for your time and i'm sorry for my bad english.

 

Link to comment
Share on other sites

Look at the help file : _IECreate() has a visible option

You can work with $oInput = _IEGetObjById(....) to retrieve the input element, and then get its value with $oInput.value

With InetRead, you will have to extract the data from the HTML source. It's not the same thing. In this case you will have to use StringXXX functions to extract the desired value.

Link to comment
Share on other sites

You can do this thing:

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

$Form1 = GUICreate("Kassadin", 266, 92, 460, 286) 
$Label1 = GUICtrlCreateLabel("Information from website", 32, 32, 84, 17) 
$Button1 = GUICtrlCreateButton("Generate", 160, 24, 65, 25, $WS_GROUP) 
GUISetState(@SW_SHOW)

Global $web = ""

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
                        $web = GoToWebsite
            MsgBox("","",$web)
    EndSwitch
WEnd
Func GoToWebsite()
Local $url = "http://www.autoitscript.com/forum/index.php"
    Local $hand = InetRead($url)

    Return BinaryToString($hand)
EndFunc

So you use InetRead to read that url then with binaryToString to get data in a decent format. 

Now that MsgBox will contain all Html code of that file. From there use String stuffs to parse data you want.

Enjoy!

Edited by DocTorCoder

DocTorCoder

Link to comment
Share on other sites

To learn, you have to practice. You will learn more slowly if we always give you the solution.
Now, here is a additional help to retrieve the email from the html source code :

$sEmail = StringRegExp($sHTML, '(?i)value="([a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,4})"', 1)
ConsoleWrite($sEmail[0] & @CRLF)

It's a way, there are others...

Link to comment
Share on other sites

As jguinch said you should practice.

So SsCriPteR

What I said to you it just copy the whole page in a string.

Now you should copy that string to clipboard . Paste what you receive in notepad then Look what you've got. Find what you need to get : names or whatever and look for delimiters (could be words too. something that you be found only there) then use StringSplit , StrinRegExp function or other String functions from autoit.

When you have Scite opened press F1 for help file. there you will need info about a lot of autoit functions.

Enjoy

Edited by DocTorCoder

DocTorCoder

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...