SsCriPteR Posted March 13, 2015 Posted March 13, 2015 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.
jguinch Posted March 13, 2015 Posted March 13, 2015 You can try InetRead : look at the help page. Also, you can use _IE function without displaying the browser. Reveal hidden contents Network configuration UDF, _DirGetSizeByExtension, _UninstallList Firefox ConfigurationArray multi-dimensions, Printer Management UDF
SsCriPteR Posted March 13, 2015 Author Posted March 13, 2015 Hello, thank you for your answer. How can i use Inet function to copy the e-mail provided?
SsCriPteR Posted March 13, 2015 Author Posted March 13, 2015 Btw, im how do i use _IE function without displaying the browser??
jguinch Posted March 13, 2015 Posted March 13, 2015 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. Reveal hidden contents Network configuration UDF, _DirGetSizeByExtension, _UninstallList Firefox ConfigurationArray multi-dimensions, Printer Management UDF
DocTorCoder Posted March 13, 2015 Posted March 13, 2015 (edited) 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 March 13, 2015 by DocTorCoder DocTorCoder
SsCriPteR Posted March 13, 2015 Author Posted March 13, 2015 I'm kinda confused, i'm not really good at autoit. So if i wanted autoit to come to this page and Return the value of my account posts, how would i do that?
jguinch Posted March 13, 2015 Posted March 13, 2015 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... Reveal hidden contents Network configuration UDF, _DirGetSizeByExtension, _UninstallList Firefox ConfigurationArray multi-dimensions, Printer Management UDF
DocTorCoder Posted March 13, 2015 Posted March 13, 2015 (edited) 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 March 13, 2015 by DocTorCoder DocTorCoder
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now