- September 17th, 2011
Stack Overflow uses Badges as a gamification technique to increase user activity. If you’re looking to get a couple of badges easily without much effort on your own part, look no further than the Enthusiast and Fanatic badges.
All you have to do to gain each of these badges is view the site (while logged in with your account) for 30 consecutive days for the Enthusiast bagde, and 100 consecutive days for the Fanatic. If however you have multiple linked accounts, this can be a bit tedious, as you have to view the site for each account (i.e. Serverfault, Programmers, WordPress etc).
To automate this process on a windows PC, we can create a simple batch script that can open up your preferred browser with multiple tabs. This means we just have to double click the batch file to open up the various sites in a browser, and as long as we haven’t actually logged out of Stack Overflow, the site will update our “consecutive days visited” count.
In this example I’ll use Firefox, as you can use the commandline to open up a new FireFox window, with tabs to specified URLs. This is helpful because I’ll put the custom command line arguments in the batch file to automate opening up the websites in the browser. I’ll create a new batch file called stack.bat on my C:\. The batch file will have the following contents.
@echo off "C:\Program Files (x86)\Mozilla Firefox\firefox.exe" "http://stackoverflow.com/users/XXXX" "http://gamedev.stackexchange.com/users/XXXX"
To further automate the process, we will use the Windows Task scheduler to create a daily task that will run our batch file every day. This removes the need for any manual steps in the process, so that we won’t have to worry about actually doing anything in order to get the badges (i.e. this will remove the risk of accidentally missing a day).
To create a daily task, go to the Control Panel > Schedule tasks.
Then select from the menu, Action > Create a Basic Task.
This will bring up the basic task wizard, where you can give the task a name and a description, then click next. The trigger is what will cause the task to run, so select “Daily” and the time of day you want the task to run. For action, select “Start a program”, and then browse to the batch program. You can then click next and finish.
You can of course do this on a Mac using different techniques, and that will be the subject of a future post.