TehWhale Posted October 4, 2008 Share Posted October 4, 2008 (edited) I'm tring to see how many posts are in a given topic, so can I do this? I was tring to use the java script:whoposted(15521); stuff, to get who posts or how many, but that didn't work. What IE functions do I need to use, to figure out how many people posted if I have this link, for example:http://www.autoitscript.com/forum/index.ph...c=81843&hl=Thanks for all your help! Edited October 6, 2008 by SwiftBurns Link to comment Share on other sites More sharing options...
TehWhale Posted October 4, 2008 Author Share Posted October 4, 2008 Just so you guys know, this is NOT to make a bot, this is to make a topic watcher, you pick a topic, and it'll notify you when there is a new reply in that topic. Link to comment Share on other sites More sharing options...
TehWhale Posted October 4, 2008 Author Share Posted October 4, 2008 (edited) Very helpful. Edited October 4, 2008 by SwiftBurns Link to comment Share on other sites More sharing options...
torels Posted October 4, 2008 Share Posted October 4, 2008 hi there you could analyze the quantity of <a href="http://theforum.com/forum/index.php?showforum=(*.?)"> where (.*?) = something (regexp) or of <div id=thepost> cheers! Some Projects:[list][*]ZIP UDF using no external files[*]iPod Music Transfer [*]iTunes UDF - fully integrate iTunes with au3[*]iTunes info (taskbar player hover)[*]Instant Run - run scripts without saving them before :)[*]Get Tube - YouTube Downloader[*]Lyric Finder 2 - Find Lyrics to any of your song[*]DeskBox - A Desktop Extension Tool[/list]indifference will ruin the world, but in the end... WHO CARES :P---------------http://torels.altervista.org Link to comment Share on other sites More sharing options...
TehWhale Posted October 4, 2008 Author Share Posted October 4, 2008 hi thereyou could analyze the quantity of <a href="http://theforum.com/forum/index.php?showforum=(*.?)"> where (.*?) = something (regexp)or of <div id=thepost>cheers!Haha, thanks for the reply, but that really means nothing to me. I know how to use StringRegExp and stuff, but no clue how to get that information and stuff. Link to comment Share on other sites More sharing options...
torels Posted October 4, 2008 Share Posted October 4, 2008 _IEBodyReadHTML() analyze the page and see how it's better the <a> method or the <div> one anyways I think using _InetGetSource() is a better way of doing it rather than using IE object Some Projects:[list][*]ZIP UDF using no external files[*]iPod Music Transfer [*]iTunes UDF - fully integrate iTunes with au3[*]iTunes info (taskbar player hover)[*]Instant Run - run scripts without saving them before :)[*]Get Tube - YouTube Downloader[*]Lyric Finder 2 - Find Lyrics to any of your song[*]DeskBox - A Desktop Extension Tool[/list]indifference will ruin the world, but in the end... WHO CARES :P---------------http://torels.altervista.org Link to comment Share on other sites More sharing options...
torels Posted October 4, 2008 Share Posted October 4, 2008 _IEBodyReadHTML() analyze the page and see how it's better the <a> method or the <div> one anyways I think using _InetGetSource() is a better way of doing it rather than using IE object Some Projects:[list][*]ZIP UDF using no external files[*]iPod Music Transfer [*]iTunes UDF - fully integrate iTunes with au3[*]iTunes info (taskbar player hover)[*]Instant Run - run scripts without saving them before :)[*]Get Tube - YouTube Downloader[*]Lyric Finder 2 - Find Lyrics to any of your song[*]DeskBox - A Desktop Extension Tool[/list]indifference will ruin the world, but in the end... WHO CARES :P---------------http://torels.altervista.org Link to comment Share on other sites More sharing options...
TehWhale Posted October 5, 2008 Author Share Posted October 5, 2008 (edited) Bumpo.. EDIT: I think I got it... Edited October 5, 2008 by SwiftBurns Link to comment Share on other sites More sharing options...
TehWhale Posted October 5, 2008 Author Share Posted October 5, 2008 I'm getting really unpredictable results with that method. Heres my code, just put in a random topic link and press the button #include <Inet.au3> #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 468, 154, 279, 254) $Edit1 = GUICtrlCreateEdit("", 8, 24, 449, 89, BitOR($ES_AUTOVSCROLL,$ES_AUTOHSCROLL,$ES_WANTRETURN,$WS_VSCROLL)) $Label1 = GUICtrlCreateLabel("Topics to watch for new replies", 160, 8, 151, 17) $Button1 = GUICtrlCreateButton("Engage Topic Watch", 8, 120, 139, 25, 0) $Button2 = GUICtrlCreateButton("Disengage Topic Watch", 320, 120, 139, 25, 0) GUICtrlSetState(-1, $GUI_DISABLE) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 If Not StringInStr(GUICtrlRead($Edit1), @CRLF) Then $Source = _INetGetSource(GUICtrlRead($Edit1)) $Number=1 Do $Number=$Number+1 Until Not StringInStr($Source, 'return false;">#'&$Number&'</a>') MsgBox(0, "Replies", $Number) EndIf EndSwitch WEnd Link to comment Share on other sites More sharing options...
TehWhale Posted October 5, 2008 Author Share Posted October 5, 2008 A lil help, anyone? Link to comment Share on other sites More sharing options...
TehWhale Posted October 6, 2008 Author Share Posted October 6, 2008 Guys, can someone please help me with this. all I need to know is a simple function or udf that can see how many posts are in a topic, using _InetGetSource and StringInStr obviously are not working. Thanks for all your help! Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted October 6, 2008 Moderators Share Posted October 6, 2008 Guys, can someone please help me with this. all I need to know is a simple function or udf that can see how many posts are in a topic, using _InetGetSource and StringInStr obviously are not working.Thanks for all your help!Quit bumping your posts so often. Wait at least 24 hours between posts... if you have something else to add to your thread, just edit your last post. 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...
rambo3889 Posted October 6, 2008 Share Posted October 6, 2008 #include <Inet.au3> #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 468, 154, 279, 254) $Edit1 = GUICtrlCreateEdit("http://www.autoitscript.com/forum/index.php?showtopic=81925", 8, 24, 449, 89, BitOR($ES_AUTOVSCROLL,$ES_AUTOHSCROLL,$ES_WANTRETURN,$WS_VSCROLL)) $Label1 = GUICtrlCreateLabel("Topics to watch for new replies", 160, 8, 151, 17) $Button1 = GUICtrlCreateButton("Engage Topic Watch", 8, 120, 139, 25, 0) $Button2 = GUICtrlCreateButton("Disengage Topic Watch", 320, 120, 139, 25, 0) GUICtrlSetState(-1, $GUI_DISABLE) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 If Not StringInStr(GUICtrlRead($Edit1), @CRLF) Then $Source = _INetGetSource(GUICtrlRead($Edit1)) $Number=1 While StringInStr($Source, 'return false;">#'&$Number&'</a>') $Number=$Number+1 WEnd MsgBox(0, "Replies", $Number-1) EndIf EndSwitch WEnd The bug about its adding one to the real count is something you must fix by yourself ( meaning that i'm lazy) My Scripts:Radioblog Club Music DownloaderOther stuff:Fun movieIm serious read the help file it helps :PFight 'Till you drop. Never stop, You Cant give up. Til you reach the top Fight! youÂ’re the best in town Fight! Link to comment Share on other sites More sharing options...
Szhlopp Posted October 6, 2008 Share Posted October 6, 2008 (edited) A lil help, anyone? Here: #include <IE.au3> $Address = "http://www.autoitscript.com/forum/index.php?showtopic=23860&st=15&start=15" $FinalPost = "&st=100000" $Address = StringRegExpReplace($Address, "&st=(.*)", "") $oIE = _IECreate($Address & $FinalPost, 0, 0) $text = _IEBodyReadHTML($oIE) $number = StringRegExp($text, "#([[:alnum:]]*?)</A", 3) $number = $number[UBound($number) - 1] MsgBox(0, "", "Number of posts: " & $number) Exit Edited October 6, 2008 by Szhlopp RegEx/RegExRep Tester!Nerd Olympics - Community App!Login UDFMemory UDF - "Game.exe+753EC" - CE pointer to AU3Password Manager W/ SourceDataFiler - Include files in your au3!--- Was I helpful? Click the little green '+' Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted October 6, 2008 Moderators Share Posted October 6, 2008 (edited) #include <inet.au3> Local $a_post_info = _InetGetPostInfo(81925) If @error Then MsgBox(16, "Error", "Error#: " & @error) Else MsgBox(64, "Info", _ "There are " & $a_post_info[0] & " post(s) per page." & @CRLF & @CRLF & _ "There are " & $a_post_info[1] & " page(s) total." & @CRLF & @CRLF & _ "The last url is: http://www.autoitscript.com/forum/index.php?showtopic=" & 81925 & "&st=" & $a_post_info[2] & @CRLF & @CRLF & _ "The total number of posts for this thread is: " & $a_post_info[3]) EndIf Func _InetGetPostInfo($i_topic_number) Local $s_url = "http://www.autoitscript.com/forum/index.php?showtopic=" & $i_topic_number & "&st=" Local $s_html = _InetGetSource($s_url) Local $a_sre_post_per_page = StringRegExp($s_html, '(?i)return false;">#(\d+)', 3) If @error Then Return SetError(1, 0, 0) Local $i_pages = 1 Local $a_sre_pages = StringRegExp($s_html, "(?i)'page-jump'>(\d+)", 3) If Not @error Then $i_pages = $a_sre_pages[UBound($a_sre_pages) - 1] Local $i_post_per_page = UBound($a_sre_post_per_page) Local $i_last_page_post_count = (($i_pages - 1) * $i_post_per_page) Local $a_last_post = StringRegExp(_InetGetSource($s_url & $i_last_page_post_count), '(?i)return false;">#(\d+)', 3) If @error Then Return SetError(2, 0, 0) Local $a_return[4] = [$i_post_per_page, $i_pages, $i_last_page_post_count, UBound($a_last_post)] Return $a_return EndFunc Edited October 6, 2008 by SmOke_N 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...
Szhlopp Posted October 6, 2008 Share Posted October 6, 2008 #include <inet.au3> Local $a_post_info = _InetGetPostInfo(81925) If @error Then MsgBox(16, "Error", "Error#: " & @error) Else MsgBox(64, "Info", _ "There are " & $a_post_info[0] & " post(s) per page." & @CRLF & @CRLF & _ "There are " & $a_post_info[1] & " page(s) total." & @CRLF & @CRLF & _ "The last url is: http://www.autoitscript.com/forum/index.php?showtopic=" & 81925 & "&st=" & $a_post_info[2] & @CRLF & @CRLF & _ "The total number of posts for this thread is: " & $a_post_info[3]) EndIf Func _InetGetPostInfo($i_topic_number) Local $s_url = "http://www.autoitscript.com/forum/index.php?showtopic=" & $i_topic_number & "&st=" Local $s_html = _InetGetSource($s_url) Local $a_sre_post_per_page = StringRegExp($s_html, '(?i)return false;">#(\d+)', 3) If @error Then Return SetError(1, 0, 0) Local $i_pages = 1 Local $a_sre_pages = StringRegExp($s_html, "(?i)'page-jump'>(\d+)", 3) If Not @error Then $i_pages = $a_sre_pages[UBound($a_sre_pages) - 1] Local $i_post_per_page = UBound($a_sre_post_per_page) Local $i_last_page_post_count = (($i_pages - 1) * $i_post_per_page) Local $a_last_post = StringRegExp(_InetGetSource($s_url & $i_last_page_post_count), '(?i)return false;">#(\d+)', 3) If @error Then Return SetError(2, 0, 0) Local $a_return[4] = [$i_post_per_page, $i_pages, $i_last_page_post_count, UBound($a_last_post)] Return $a_return EndFunc With a quick adaption of the SRE for the name/time this would work better SwiftBurns. RegEx/RegExRep Tester!Nerd Olympics - Community App!Login UDFMemory UDF - "Game.exe+753EC" - CE pointer to AU3Password Manager W/ SourceDataFiler - Include files in your au3!--- Was I helpful? Click the little green '+' Link to comment Share on other sites More sharing options...
TehWhale Posted October 6, 2008 Author Share Posted October 6, 2008 (edited) Wow thank you so much guys! I must try to test SmOke_N's and Szloops now SmOke_N your's returns 15 per page, 2 pages total, the last URL... and it says the total number of posts for this thread is 2? Theres 17, so is it 15+2? Edited October 6, 2008 by SwiftBurns Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted October 6, 2008 Moderators Share Posted October 6, 2008 Wow thank you so much guys! I must try to test SmOke_N's and Szloops now I had an error: #include <Inet.au3> Local $a_post_info = _InetGetPostInfo(23860) If @error Then MsgBox(16, "Error", "Error#: " & @error) Else MsgBox(64, "Info", _ "There are " & $a_post_info[0] & " post(s) per page." & @CRLF & @CRLF & _ "There are " & $a_post_info[1] & " page(s) total." & @CRLF & @CRLF & _ "The last url is: " & $a_post_info[2] & @CRLF & @CRLF & _ "The total number of posts for this thread is: " & $a_post_info[3]) EndIf Func _InetGetPostInfo($i_topic_number) Local $s_url = "http://www.autoitscript.com/forum/index.php?showtopic=" & $i_topic_number & "&st=" Local $s_html = _InetGetSource($s_url) Local $a_sre_post_per_page = StringRegExp($s_html, '(?i)return false;">#(\d+)', 3) If @error Then Return SetError(1, 0, 0) Local $i_pages = 1 Local $a_sre_pages = StringRegExp($s_html, "(?i)'page-jump'>(\d+)", 1) If Not @error Then $i_pages = $a_sre_pages[0] Local $i_post_per_page = UBound($a_sre_post_per_page) Local $i_last_page_post_count = (($i_pages - 1) * $i_post_per_page) Local $a_last_post = StringRegExp(_InetGetSource($s_url & $i_last_page_post_count), '(?i)return false;">#(\d+)', 3) If @error Then Return SetError(2, 0, 0) Local $a_return[4] = [$i_post_per_page, $i_pages, _ "http://www.autoitscript.com/forum/index.php?showtopic=" & $i_topic_number & "&st=" & $i_last_page_post_count, _ $i_last_page_post_count + UBound($a_last_post)] Return $a_return EndFuncRevised 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...
Moderators SmOke_N Posted October 6, 2008 Moderators Share Posted October 6, 2008 SmOke_N your's returns 15 per page, 2 pages total, the last URL... and it says the total number of posts for this thread is 2? Theres 17, so is it 15+2?15 I believe is the "default" number of posts ... The results are correct though, it showed 18 posts for this thread which stopped at mine above... That is if you haven't already ran the above. 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...
TehWhale Posted October 6, 2008 Author Share Posted October 6, 2008 15 I believe is the "default" number of posts ... The results are correct though, it showed 18 posts for this thread which stopped at mine above... That is if you haven't already ran the above.It was fixed in the above one! Thanks 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