anyday Posted March 27, 2006 Share Posted March 27, 2006 hey guys im back again . im trying to figure out if it is possible to get text from the source of a website and insert it into a listbox as records? example: Source code of website: <td align=middle><font class=fdata><small>TN</small></font></td> <td align=middle><font class=fdata><small>QUOTE NAME HERE</small></font></td> <td align=middle><font class=fdata><small>-</small></font></td> <td align=middle><font class=fdata><small>11/16/2004</small></font></td> <td align=middle><font class=fdata><small>350</small></font></td> is there anyway that i could grab this info and have it display as one record in a gui . i dont know what would be the best to display in wether it be a listbox, combobox, listview. Just trying to figure out if this is possible. an example of the output in gui would be like State Client Effective Date Premium TN Quote Name Here 11/16/2004 350 Link to comment Share on other sites More sharing options...
greenmachine Posted March 27, 2006 Share Posted March 27, 2006 #include <array.au3> Global $StringStuff[6] $string = "<td align=middle><font class=fdata><small>TN</small></font></td>" & @CRLF & _ "<td align=middle><font class=fdata><small>QUOTE NAME HERE</small></font></td>" & @CRLF & _ "<td align=middle><font class=fdata><small>-</small></font></td>" & @CRLF & _ "<td align=middle><font class=fdata><small>11/16/2004</small></font></td>" & @CRLF & _ "<td align=middle><font class=fdata><small>350</small></font></td>" $FirstSplit = StringSplit($string, @CRLF, 1) For $i = 1 To $FirstSplit[0] $StringStuff[$i] = StringTrimLeft (StringTrimRight ($FirstSplit[$i], StringLen ("</small></font></td>")), StringLen ("<td align=middle><font class=fdata><small>")) Next _ArrayDisplay ($StringStuff, "whee") Link to comment Share on other sites More sharing options...
anyday Posted March 27, 2006 Author Share Posted March 27, 2006 thanks man that works good, now the next problem is i gotta figure out a way to set $string = to get it from the html source. i could do $string = _IEBodyReadHTML() but that would get the whole document. i need to only load the certain strings and there could be more than 1 Link to comment Share on other sites More sharing options...
greenmachine Posted March 27, 2006 Share Posted March 27, 2006 (edited) Global $YourString[6] $Array = StringSplit (_IEBodyReadHtml($IEobj), "<td align=middle><font class=fdata><small>", 1) For $i = 2 to 6 $YourString[$i-1] = StringTrimRight ($Array[$i], StringLen ("</small></font></td>" + 2)) Next Assuming the first occurrence of "<td align=middle><font class=fdata><small>" is what you want (there aren't others in the source that would mess up the stringsplit), this should work. Edited March 27, 2006 by greenmachine Link to comment Share on other sites More sharing options...
anyday Posted March 27, 2006 Author Share Posted March 27, 2006 would you think a listbox would be the best way to display it in a gui? Link to comment Share on other sites More sharing options...
greenmachine Posted March 27, 2006 Share Posted March 27, 2006 would you think a listbox would be the best way to display it in a gui?A listview, yes. You can make multiple colums to show the data, and then a listviewitem for each entry. Link to comment Share on other sites More sharing options...
anyday Posted March 27, 2006 Author Share Posted March 27, 2006 (edited) thanks for the help. you wouldnt happen to know if it is possible to resize a IE window to a specific resolution with autoit? has to do with this script. i looked through the functions and macros i see stuff to maximize but no resize. Edited March 27, 2006 by anyday Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted March 27, 2006 Moderators Share Posted March 27, 2006 thanks for the help. you wouldnt happen to know if it is possible to resize a IE window to a specific resolution with autoit?has to do with this script.i looked through the functions and macros i see stuff to maximize but no resize.WinMove()? Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
anyday Posted March 27, 2006 Author Share Posted March 27, 2006 (edited) Global $YourString[6] $Array = StringSplit (_IEBodyReadHtml($IEobj), "<td align=middle><font class=fdata><small>", 1) For $i = 2 to 6 $YourString[$i-1] = StringTrimRight ($Array[$i], StringLen ("</small></font></td>" + 2)) Next Assuming the first occurrence of "<td align=middle><font class=fdata><small>" is what you want (there aren't others in the source that would mess up the stringsplit), this should work. i get the following error with this code. If IsObj($o_object.document) Then If ^ ERROR Error: The requested action with this object has failed. what i think is going on is the website i have to goto to get this information loads a popup window with the data i am trying to get out. does that mean that $oIE would not be my variable anymore for the browser window? Thanks smoke n for the tip worked perfect. Edited March 27, 2006 by anyday 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