cronable voting script

General forum for game-related discussion.

Moderator: Moderators

Post Reply
apog
Supporting Member 2009
Posts: 95
Joined: Sat Jan 22, 2005 02:04 am

cronable voting script

Post by apog »

Edit: Updated to work as of Jan 6th 2008

Also, this version has a few more greps as I have to keep grep'ing until I get to the specific values I want. If you know a better way to get specific subsets of matches in a bash script, then please post it.


someone somewhere over the rainbow asked for a cronable voting script. I just wanted to see if I could do it and here is my crappy version.

Please note that each of the commands should be on one line, they shouldn't be split in to two lines like they are here. If there is a full line break then that signifies two seperate lines. If there is two lines with no space between, then those should be on one line. You must have version 1.9.1 or higher of wget or else the --post-data option isn't available. This could also be turned into a neater looking perl script.

Code: Select all

#/bin/sh

wget -O ~/rank.html http://www.topmudsites.com/cgi-bin/topmuds/rankem.cgi?id=idles

ssid1=`grep -io '"ssid1" value=".*"' ~/rank.html | grep -io 'value=".*"' | grep -io '".*"' | grep -io '[a-zA-Z0-9]\+'`

mudid=`grep -io '"mudid" value=".*"' ~/rank.html | grep -io '[0-9]\+'`

do=`grep -io '"do" value=".*"' ~/rank.html | grep -io 'value=".*"' | grep -io '".*"' | grep -io '[a-zA-Z]\+'`

submit=`grep -io '"submit" value=".*"' ~/rank.html | grep -io 'value=".*"' | grep -io '".*"' | grep -io '[a-zA-Z]\+'`

rm rank.html

wget -O ~/answer.html --post-data=\"mudid=$mudid\&ssid1=$ssid1\&do=$do\&submit=$submit\" http://www.topmudsites.com/vote.php

Last edited by apog on Mon Jan 07, 2008 02:51 am, edited 3 times in total.
haeggar
Supporting Member 2008
Posts: 19
Joined: Tue Jan 11, 2005 21:10 pm

Post by haeggar »

installed the script on the development and the staging server - thumps up :twisted:
apog
Supporting Member 2009
Posts: 95
Joined: Sat Jan 22, 2005 02:04 am

Post by apog »

It's that time again, seems like Xerene is trying extra hard to get us all to vote. The script above works for all you linux gurus, but I know some people out there are Windows users and so I've got a simple VBScript that you can install that will allow you to vote merely by double clicking.

Steps to install.

1.) Create a new text file on your desktop. (right-click on the desktop, then choose, new -> text document).
2.) Rename the file to icesus.vbs
3.) Edit the file using notepad.
4.) Copy and paste the text below into notepad.
5.) Save the file
6.) Double click the file.

It should take several seconds where you will see the TMS page. Then once it is complete, you will see a message box that says "Vote Sent". Click on OK and the IE window will be closed.

Basically what this script does is open an Internet Explorer script, navigate to the vote page, and simulate clicking on the link to vote.

Code: Select all

option explicit

'declare our constants
CONST URL = "http://www.topmudsites.com/cgi-bin/topmuds/rankem.cgi?id=idles"
CONST SLEEPTIME = 10
CONST READYSTATECOMPLETED = 4


'Create an IE object and use it to cut down on
'the work required to parse out our variables.
With CreateObject("InternetExplorer.Application")
  .visible = true
  .Navigate URL
  
  'sleep for SLEEPTIME milliseconds and check 
  'to see if the page is fully loaded.
  Do Until .ReadyState = READYSTATECOMPLETED
    Wscript.sleep SLEEPTIME
  Loop
	
  'Progmatically submit the form.
  .document.click.submit()

  'Sleep for half a second.  Since the form
  'submit is asynchronous, the script needs 
  'to give the IE object some time to start
  'the request before the ready state is
  'checked.  If the script doesn't wait
  'it will be checking the ready state before
  'the IE object has a chance to even start
  'the form submit.
  Wscript.sleep 500

  'sleep for SLEEPTIME milliseconds and check 
  'to see if the page is fully loaded.
  Do Until .ReadyState = READYSTATECOMPLETED
    Wscript.sleep SLEEPTIME
  Loop

  'close up the IE object
  .Quit

End With

wscript.echo "Vote Sent"
If you ask really nice, Haeggar or some other nice soul, might peer review this and then post it on a public website so you can just download it and don't have to go through all those install steps. However, if you download it, open it with notepad first to insure it has not been modified to do something dangerous.

I only have access to an en-us keyboard and OS and so I can't guarantee that this will work on foreign computers. If it doesn't, I apologize, but there isn't much I can do about that.

Edit: Added .visibility = true (which was an original request of TMS, but apparently only got added to my local copy.)
Last edited by apog on Mon Jan 07, 2008 02:56 am, edited 2 times in total.
apog
Supporting Member 2009
Posts: 95
Joined: Sat Jan 22, 2005 02:04 am

Post by apog »

Please do not set to this automatically run in any way as TMS could take Icesus off the list completely for that. This is only to help you vote when you remember or want to.

Edit: Took out old recomendation (again, was requested by TMS but I apparently forgot to update my post)
Last edited by apog on Mon Jan 07, 2008 02:24 am, edited 1 time in total.
haeggar
Supporting Member 2008
Posts: 19
Joined: Tue Jan 11, 2005 21:10 pm

Post by haeggar »

download at

http://haeggar.techzone.at/icesus/vote.vbs

and its tested with DE-keyboard too.
User avatar
croli
Posts: 17
Joined: Mon Mar 29, 2004 00:20 am
Location: Tromsø, Norway

Re: cronable voting script

Post by croli »

apog wrote:Edit: Updated to work as of Jan 6th 2008

Also, this version has a few more greps as I have to keep grep'ing until I get to the specific values I want. If you know a better way to get specific subsets of matches in a bash script, then please post it.
I reduced the grep-orgy you wrote there to quite a lot less, but at a price. Now it will break horribly whenever something unexpected comes from TMS :wink:

The lines now read something like this:

Code: Select all

ssid1=`grep -i ssid1 ~/rank.html | cut -f6 -d'"'`
mudid=`grep -i mudid ~/rank.html | cut -f6 -d'"'`
do=`grep -i "name.*do" ~/rank.html | cut -f6 -d'"'`
submit=`grep -i "name.*submit" ~/rank.html | cut -f6 -d'"'`
Oh, and this has the added benefit not to depend on GNU grep 2.5.x any more, since we don't need the -o flag anymore.
ity
Posts: 50
Joined: Sat Jan 21, 2006 20:24 pm
Location: U.S.A

Post by ity »

Anyway to make something like this for Android os so I can click a link on my phone to vote?
terces
Posts: 15
Joined: Thu Oct 02, 2014 17:47 pm

Post by terces »

Not recommended to do automated scripts. They can get Icesus banned and that is the opposite what we try to achieve by voting.

++ Terces
Post Reply