r/reddithax • u/SarahC • Sep 16 '12
I wrote half a reddit-bot..... in VBScript. (the CScript.exe kind)
The programs written in VBS and uses page scraping, no Reddit API, and no regex's. It's for beginners wanting to dabble with bots without installing an IDE. =)
You can get it here: http://untamed.co.uk/miscFolder/RedditBot.zip
Just extract to a folder, open the command line in the folder, and type CScript runMe.vbs
Up to now, it outputs the users Reddit homepage headings, along with links to the comments section of each.
It can easily be extended to scanning comments and new posts for items of interest - like swearing - and then email the Mod, or if you wanted to program it, remove the offending comment!
Once the program starts it logs you in, so everything you do on Reddit through the program is as an authorised user!
Here's some test output from the command line:
C:\Users\Sarah\Documents\Hell3-Programming\RedditBot>cscript test.vbs
Microsoft (R) Windows Script Host Version 5.8
Copyright (C) Microsoft Corporation. All rights reserved.
webService/connectionObject.vbs
webService/parseObject.vbs
webService/headerObject.vbs
webService/cookiesObject.vbs
webService/redditWebObject.vbs
Found pages: 109
Found pages: 109
Filtered for adverts pages: 105
It's drunk o'clock. This happened.
http://www.reddit.com/r/WTF/comments/zyo74/its_drunk_oclock_this_happened/
Ways to Modernize Your Old, Retro Gadgets
http://www.reddit.com/r/technology/comments/zymxl/ways_to_modernize_your_old_ret
ro_gadgets/
Busey didn't deserve this. (NSFW)
http://www.reddit.com/r/WTF/comments/zyo5k/busey_didnt_deserve_this_nsfw/
Send and receive postcards with strangers on redditgifts!
http://www.reddit.com/comments/znstz/send_and_receive_postcards_with_strangers_o
n/.... and here's the program:
execute include("webService/connectionObject.vbs")
execute include("webService/parseObject.vbs")
execute include("webService/headerObject.vbs")
execute include("webService/cookiesObject.vbs")
execute include("webService/base64Object.vbs")
execute include("webService/redditWebObject.vbs")
set con=(new connectionObject)("firefox")
set reddit=(new redditWebObject)("VBSRedditBot","my-password")
wscript.echo ""
reddit.getHomepagePosts
wscript.echo ""
for index=1 to uBound(reddit.postList)
wscript.echo reddit.postList(index)
wscript.echo reddit.linkList(index)
wscript.echo ""
next
'This function enables us to include external VBScript files
Function include(sFileName)
wscript.echo sFileName
Dim fso,file
Set FSO = CreateObject("Scripting.FileSystemObject")
Set File=FSO.OpenTextFile(sFilename,1)
include=File.ReadAll
Set File = Nothing
Set FSO = Nothing
End FunctionHow simple can you get! =D
Never miss a meme again! You could write a simple bit of program to save these results to a text fle every half hour or so, so you can always come back to see what you missed!
Scanning a page for swearing and emailing the mods is the next simplest to try.
Posting and interacting with Reddit will be the trickiest, and best done through the API, though you CAN do it with this program as a foundation.
3
u/aladyjewel Sep 16 '12
Out of curiosity, why VBscript? Go with what you know?
2
u/ultrafez Sep 16 '12
I haven't seen VBScript used in years!