#!/usr/bin/perl # ongekendtalent.nl votingscript use Win32::IEAutomation; use LWP::Simple; # get username $username = getlogin(); print "Ingelogd als $username\n"; # what's the url $url = "http://www.ongekendtalent.nl/clubs/clubstek/clubstek.asp?clubID=19787"; # config for cookies $some_dir = "C:/Documents and Settings/$username/Cookies"; ###################################################################### # the program clearcookie(); openinternet(); stemoppaspoort(); for ($a=1; $a<6; $a++) { checkstemming(); } #subroutines ###################################################################### # Open the page sub openinternet{ $ie = Win32::IEAutomation->new( visible => 1, maximize => 0); $ie->gotoURL("$url"); } ###################################################################### # Cookies clearing to vote again sub clearcookie{ opendir(DIR, $some_dir) || die "can't opendir $some_dir: $!"; @dots = grep { /\.txt/ && -f "$some_dir/$_" } readdir(DIR); closedir DIR; foreach $cookie(@dots){ #print "$cookie\n"; if ($cookie =~ /ongekendtalent/gi){ unlink "$some_dir/$cookie"; print "\n$some_dir/$cookie deleted\n"; } } } ####################################################################### # check if I voted again # I'm using LWP cause if you click on an undef value Win32::IEAutomation stops # sub checkstemming { print "check stemming!\n"; $content = get $url; die "Couldn't get $url" unless defined $content; if($content =~ m/Stem op dit nummer/) { stemnu(); } else { daghoor(); } } ####################################################################### # Find hyperlinks an click the with 'linktext:' option with pattern matching sub stemnu{ $ie->getLink('linktext:', qr/Stem op dit nummer/)->Click; print "gestemd op mp3!\n"; } ####################################################################### # Close explorer and get out sub daghoor{ print "Je hebt al gestemd!\n"; $ie->closeIE(); exit; } ####################################################################### # Vote on passport sub stemoppaspoort{ $ie->getRadio('beforetext:', "Complimenten")->Select; $ie->getButton('caption:', "STEM!")->Click; print "Gestemd op paspoort!\n"; }