stuartc1 Posted May 27, 2005 Posted May 27, 2005 (edited) Hi,I've been looking at using regular expressions and found a post refering to a function called 'StringRegExp' - looking through the helps docs supplied with version 3.1.1 I see no reference to this.Is this function only supported in the newer beta versions?Im looking to extract 'title', 'link' and 'description' from the following rss file (only a snippet below)<item rdf:about="http://auug.org.au/events/2005/auug2005/cfp.html"> <title>CfP PHP Track - (AUUG) Annual Conference</title> <link>http://auug.org.au/events/2005/auug2005/cfp.html</link> <description>For the first time the AUUG will incorporate a PHP Track as part of its annual conference in Sydney, Australia. For this track we seek tutorials and presentations. Tutorials are on October 16 to 18 and presentations on October 19 to 21. For information on how to submit a proposal we kindly point you to our CfP which you can find on our website. The deadline for proposals is May 27. In case you want more information, email Derick or Arjen.</description> <dc:date>2005-05-20</dc:date> </item> <item rdf:about="http://www.osevents.com"> <title>PHP West Security Conference in Vancouver, BC</title> <link>http://www.osevents.com</link> <description>Open Source Events is hosting their second conference on June 11th, 2005 in Vancouver, British Columbia. The conference will focus on PHP and Open Source Security. Featured talks will be presented by Bruce Perens, Chris Shiflett, Christian Wenz, Tom Robinson and Chris Hubbard. The conference is a single day - one track event where attendees will receive a free t-shirt, lunch, and full access to the full day of talks with the purchase of their ticket. A number of free prizes will be given away at the closing ceremonies.</description> <dc:date>2005-05-11</dc:date> </item> Edited May 27, 2005 by stuartc1
j_stam_84 Posted May 27, 2005 Posted May 27, 2005 (edited) Regular Expressions are (partially ?) supported in the newest beta version. See Developers topic for the sticky "3.1.1++". You can download it theregrtz,JJ Edited May 27, 2005 by j_stam_84
SumTingWong Posted May 27, 2005 Posted May 27, 2005 If you are going to use the latest beta then you can read this data using MSXML via COM.
stuartc1 Posted May 27, 2005 Author Posted May 27, 2005 Thanks Guys - I dont think the support of StrRegExp would have helped after all... thanks to a post by TuMbLeWeEd i managed to hack around with the code and get it working... the code I'm using is: expandcollapse popupIf Not FileExists("phpnews.rss") Then InetGet("http://www.php.net/news.rss", "phpnews.rss") EndIf $file = FileOpen("phpnews.rss", 0) ; Check if file opened for reading OK If $file = -1 Then MsgBox(0, "Error", "Unable to open file.") Exit EndIf ; Read in 1 character at a time until the EOF is reached $chars = "" While 1 $chars = $chars & FileRead($file, 1) If @error = -1 Then ExitLoop Wend FileClose($file) $chars2 = $chars; $urls = "" Do ; ====== GET LINKS $link1 = StringInStr($chars,'<link>') $chars = StringMid($chars,$link1 + 6) $link = StringInStr($chars,'</link>') ; ====== GET TITLES $link2 = StringInStr($chars2,'<title>') $chars2 = StringMid($chars2,$link2 + 7) $linkb = StringInStr($chars2,'</title>') if $link2 and StringLen(StringMid($chars2,1,$linkb-1)) > 1 then $urls = ($urls & "<a href='" & StringMid($chars,1,$link-1) & "' target='_blank'>" & StringMid($chars2,1,$linkb-1) & "</a>" & @LF) $chars = StrIngMid($chars,$link + 7) $chars2 = StrIngMid($chars2,$linkb + 8) Until $link2 = 0 MsgBox(0, "Details", $urls) so far, so good.... now all I need to do is find the best way to display it im think using the cwebpage.dll as this seems the easiest option for me... if you can suggest a better way to display web links in a GUI - please let me know.. cheers
JSThePatriot Posted May 27, 2005 Posted May 27, 2005 Thanks Guys - I dont think the support of StrRegExp would have helped after all...thanks to a post by TuMbLeWeEd i managed to hack around with the code and get it working...the code I'm using is:expandcollapse popupIf Not FileExists("phpnews.rss") Then InetGet("http://www.php.net/news.rss", "phpnews.rss") EndIf $file = FileOpen("phpnews.rss", 0) ; Check if file opened for reading OK If $file = -1 Then MsgBox(0, "Error", "Unable to open file.") Exit EndIf ; Read in 1 character at a time until the EOF is reached $chars = "" While 1 $chars = $chars & FileRead($file, 1) If @error = -1 Then ExitLoop Wend FileClose($file) $chars2 = $chars; $urls = "" Do ; ====== GET LINKS $link1 = StringInStr($chars,'<link>') $chars = StringMid($chars,$link1 + 6) $link = StringInStr($chars,'</link>') ; ====== GET TITLES $link2 = StringInStr($chars2,'<title>') $chars2 = StringMid($chars2,$link2 + 7) $linkb = StringInStr($chars2,'</title>') if $link2 and StringLen(StringMid($chars2,1,$linkb-1)) > 1 then $urls = ($urls & "<a href='" & StringMid($chars,1,$link-1) & "' target='_blank'>" & StringMid($chars2,1,$linkb-1) & "</a>" & @LF) $chars = StrIngMid($chars,$link + 7) $chars2 = StrIngMid($chars2,$linkb + 8) Until $link2 = 0 MsgBox(0, "Details", $urls)so far, so good.... now all I need to do is find the best way to display it im think using the cwebpage.dll as this seems the easiest option for me... if you can suggest a better way to display web links in a GUI - please let me know..cheers<{POST_SNAPBACK}>I have never put weblinks in a GUI though that would be something useful to possibly include as a function in AutoIt.What I did was just create an HTML document with AutoIt and then used that to get my links.JS AutoIt Links File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out. ComputerGetInfo UDF's Updated! 11-23-2006 External Links Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)
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