palotex Posted February 7, 2008 Share Posted February 7, 2008 hi , i'm a new user of autoit, and i begin my first script. i trying to get some data (string) from a web, but i don't know how i can do it. in the web form appears a string like: how much is 3 + 5 ? i want to select ONLY the numbers, and make the operation ( + , - , * , / ) and push the result in a box sugerencies.. PD sorry about my english, i'm spanish Link to comment Share on other sites More sharing options...
PsaltyDS Posted February 7, 2008 Share Posted February 7, 2008 hi , i'm a new user of autoit, and i begin my first script. i trying to get some data (string) from a web, but i don't know how i can do it.in the web form appears a string like: how much is 3 + 5 ?i want to select ONLY the numbers, and make the operation ( + , - , * , / ) and push the result in a boxsugerencies..PD sorry about my english, i'm spanishWelcome to AutoIt. Look in the help file for the _IE* functions. You can work with the DOM objects, which is more reliable but more complicated, or you can just get the page HTML with _IEBodyReadText() or _IEBodyReadHtml() and try to extract what you want with String functions. The complexity of the web page will determine how hard it is.Hope that helps. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
palotex Posted February 7, 2008 Author Share Posted February 7, 2008 Welcome to AutoIt. Look in the help file for the _IE* functions. You can work with the DOM objects, which is more reliable but more complicated, or you can just get the page HTML with _IEBodyReadText() or _IEBodyReadHtml() and try to extract what you want with String functions. The complexity of the web page will determine how hard it is.Hope that helps. #include <IE.au3>$oIE = _IECreate ("http://www.wordlinx.com/login.php?set=y")$str = _IEBodyReadText($oie)$signo = "+"; looking for this$pos = StringInStr($str, $signo); find the sign +; using the msgbox only for view msgbox(0,"",StringTrimLeft($str, $pos + 3)); end the operation with ? MsgBox(0,"",StringTrimleft($str, $pos - 4)); begining of numbers of the operation$final = StringTrimLeft($str, $pos + 3)$inicio = StringTrimLeft($str, $pos - 4)But how i can select the text between "end" and "beging"? and convert to string Link to comment Share on other sites More sharing options...
PsaltyDS Posted February 7, 2008 Share Posted February 7, 2008 #include <IE.au3>$oIE = _IECreate ("http://www.wordlinx.com/login.php?set=y")$str = _IEBodyReadText($oie)$signo = "+"; looking for this$pos = StringInStr($str, $signo); find the sign +; using the msgbox only for view msgbox(0,"",StringTrimLeft($str, $pos + 3)); end the operation with ? MsgBox(0,"",StringTrimleft($str, $pos - 4)); begining of numbers of the operation$final = StringTrimLeft($str, $pos + 3)$inicio = StringTrimLeft($str, $pos - 4)But how i can select the text between "end" and "beging"? and convert to stringYou pulled the Text, which could work, but if there isn't enough information from that to pick out what you want use _IEBodyReadHTML() instead, then you can search for specific strings in the HTML tags that will find what you want.Looking more long term, you will want to learn to use the Document Object Model (DOM) to do this kind of thing in future projects, but reading the HTML should work for now. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
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