Jump to content
Sign in to follow this  

New Post Checker

Recommended Posts


Instead of opening internet explorer to check for new posts on the forums, why not use this small script? It's perfect for testing v3 Scripts and Scraps but I haven't tested it on any of the other ones. Here's what it does:

1. Download and read into a variable the html code of the forum you specify

2. Check if you are logged in, if not then exit with error

3. Check how many times it says "alt='No New Posts", if it's equal to 19 then exit

4. If the occurance of "alt='No New Posts" is less that 19, prompt to take the user to the forum

Here's the code!

$forum = 9  ;The forum code in the URL of the forum (listed below)
;        ^--------edit here

$fName = _Au3Forum($forum)
$html = _Download("http://www.autoitscript.com/forum/index.php?showforum=" & $forum)
If not StringInStr($html, "Log Out") Then Exit 0*MsgBox(0, "Error", "You are not logged in to the forums!" & @CRLF & "Please log in.")
If _StringFindOccurances($html, "alt='No New Posts") = 19 and $fName <> "error" Then Exit 0*MsgBox(0, "New Post Checker", "No new posts in " & $fName & ".")
If MsgBox(4, "New Post Checker", "New posts were detected in " & $fName & "." & @CRLF & "Would you like to go there?") = 6 Then Run("C:\Program Files\Internet Explorer\iexplore.exe " & "http://www.autoitscript.com/forum/index.php?showforum=" & $forum, "", @SW_MAXIMIZE)

Func _Au3Forum($nF)
        Case $nF = 2
            Return "v3 Support"
        Case $nF = 10
            Return "v3 GUI (Graphical User Interface)"
        Case $nF = 9
            Return "v3 Scripts and Scraps"
        Case $nF = 4
            Return "v3 Idea Lab"
        Case $nF = 3
            Return "v3 Bug Reports"
        Case $nF = 14
            Return "v3 AutoItX"
        Case $nF = 7
            Return "v3 Developers"
    Return "error"

Func _StringFindOccurances($sStr1, $sStr2)
    For $i = 1 to StringLen($sStr1)
        If not StringInStr($sStr1, $sStr2, 1, $i) Then ExitLoop
    Return $i

Func _INetActive()
    If @IPAddress1 <> "" Then Return 1
    Return 0
EndFunc  ;==>_INetActive()

Func _Download($sz_url)
    Local $sz_tmpfile = _CreateTemp()
    If _INetActive() and INetGet($sz_url, $sz_tmpfile) Then
        Local $sz_readtext = _ReadFile($sz_tmpfile)
        Return $sz_readtext
    Return ""

Func _ReadFile($sz_filepath)
    If FileExists($sz_filepath) Then Return FileRead($sz_filepath, FileGetSize($sz_filepath))
    Return 0

Func _CreateTemp()
    Local $sz_tmpex
        $sz_tmpex = @TempDir & "\t" & Int(Random(0, 99999)) & ".tmp"
    Until not FileExists($sz_tmpex)
    Return $sz_tmpex


Questions/comments are greatly appreciated! :)

EDIT: Quickly checked which forums this does NOT support: AutoitX and Bug Reports

Edited by erifash

Share this post

Link to post
Share on other sites

lol, I think that's pretty neat :)


Share this post

Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.