Noobster24 Posted June 5, 2006 Share Posted June 5, 2006 (edited) Hi guys, imagine: i get this source code (Html) from a website, this is written into a txtfile. <TABLE cellSpacing=0 cellPadding=0 border=0> <TBODY> <TR height=30> <TD width=450><B>Text</B></TD> <TD width=100><B>date</B></TD> <TD width=50><B>rating</B></TD></TR> <TR> <TD><A href="http://localhost/~ OSS ~ /program1.zip">Program 1</A></TD> <TD>2004-12-02</TD> <TD>22%</TD></TR> <TR> <TD><A href="http://localhost/~ OSS ~ /program2.zip">Program 2</A></TD> <TD>2005-01-03</TD> <TD>17%</TD></TR> <TR> <TD><A href="http://localhost/~ OSS ~ /test.zip">Program B</A></TD> <TD>2005-01-03</TD> <TD>17%</TD></TR> </TBODY></TABLE> How can i the link in variable $link[0] and the Program name in variable $name[0] etc.? So it would go like this: $link[0] = 'http://localhost/~ OSS ~ /program1.zip' $link[1] = 'http://localhost/~ OSS ~ /program2.zip' $link[2] = 'http://localhost/~ OSS ~ /test.zip' $name[0] = 'Program 1' $name[1] = 'Program 2' $name[1] = 'Program B' I know i have to do it with StringRegExp etc., but i don't know how to make it work Just too noob for that I've checked the helpfile I'm using the latest beta of autoit.. Can anyone help me to understand how to do it? Edited June 5, 2006 by Noobster24 Programs so far:Teh Serializer - Search for licenses for Nero - Windows - Office - Alcohol etc. Link to comment Share on other sites More sharing options...
Uten Posted June 5, 2006 Share Posted June 5, 2006 (edited) @neogia has a nice tutorial.You might want to do a search for StringRegExp with negoia in the "filter by member name" field and tick of the "match exact name" Edited June 5, 2006 by Uten Please keep your sig. small! Use the help file. Search the forum. Then ask unresolved questions :) Script plugin demo, Simple Trace udf, TrayMenuEx udf, IOChatter demo, freebasic multithreaded dll sample, PostMessage, Aspell, Code profiling Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted June 5, 2006 Moderators Share Posted June 5, 2006 Here, I tested this on your example text$FilePath = @ScriptDir & '\ParseTest.txt' $Links = _SRE_Between($FilePath, '<TD><A href="', '">') $Names = _SRE_Between($FilePath, '">', '</A></TD>') If IsArray($Links) And IsArray($Names) Then For $i = 0 To UBound($Links) - 1 MsgBox(0, $Names[$i], $Links[$i]) Next EndIf Func _SRE_Between($s_FilePath, $s_Start, $s_End) $h_FRead = FileRead($s_FilePath, FileGetSize($s_FilePath)) $a_Array = StringRegExp($h_FRead, '(?:' & $s_Start & ')(.*?)(?:' & $s_End & ')', 3) If Not @error Then Return $a_Array EndFunc 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...
Noobster24 Posted June 5, 2006 Author Share Posted June 5, 2006 Here, I tested this on your example text$FilePath = @ScriptDir & '\ParseTest.txt' $Links = _SRE_Between($FilePath, '<TD><A href="', '">') $Names = _SRE_Between($FilePath, '">', '</A></TD>') If IsArray($Links) And IsArray($Names) Then For $i = 0 To UBound($Links) - 1 MsgBox(0, $Names[$i], $Links[$i]) Next EndIf Func _SRE_Between($s_FilePath, $s_Start, $s_End) $h_FRead = FileRead($s_FilePath, FileGetSize($s_FilePath)) $a_Array = StringRegExp($h_FRead, '(?:' & $s_Start & ')(.*?)(?:' & $s_End & ')', 3) If Not @error Then Return $a_Array EndFunc Pff, that seems groovy, but i think i'm getting to understand it Programs so far:Teh Serializer - Search for licenses for Nero - Windows - Office - Alcohol etc. Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted June 5, 2006 Moderators Share Posted June 5, 2006 Pff, that seems groovy, but i think i'm getting to understand it What does that statement mean? 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...
Simucal Posted June 6, 2006 Share Posted June 6, 2006 What does that statement mean?hahaha, ahhh... another post that has left me laughing out loud. AutoIt Scripts:Aimbot: Proof of Concept - PixelSearching Aimbot with several search/autoshoot/lock-on techniques.Sliding Toolbar - Add a nice Sliding Toolbar to your next script. Click the link to see an animation of it in action!FontInfo UDF - Get list of system fonts, or search to see if a particular font is installed.Get Extended Property UDF - Retrieve a files extended properties (e.g., video/image dimensions, file version, bitrate of song/video, etc) 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