Follow-up on monitoring the Scripting Games 2013 leaderboard

I know I should spend more time polishing my Scripting Games entries but there’s also so much fun coding a way to monitor the leaderboard 😛
Since my previous post many things have changed. The online page displays only the top 10 users in each track. It means I cannot get your current position if the event isn’t closed (voting included) unless you appear in the top 10 users of the ongoing event.

When I wrote my previous entry, I took the wrong approach to find your name. Select-String will find all matches by default. Now that there are two events, if your name appears in both top 10 users, I got 2 matches. Of course, I could have used Select-String with the -Context parameter but it will capture the specified number of lines before and after the line with the match:

$page | sls -Pattern "Advanced 2" -Context 10

At the end, I didn’t use Select-String as I’ve found a quicker way to extract the top 10 users from the online page with a while loop 😎

I’ve updated the script. The Get-PSH2013Leaderboard function’s features remain unchanged. I’ve created 2 “child” functions that will either read the top 10 users online or download and read all closed entries in your temp directory:

Join-Path -Path $env:temp -ChildPath "SG2013"

To get things run quicker and as voting ended, it’s downloaded only once.

To use the version 2.0 of the Scripting Games 2013 monitoring script, I load all the functions by dot-sourcing the main script like this:

. E:\Monitor-SG2013.ps1

For event 1: I can see the top 5 users and my own rank. The total number of votes property was available and I’ve added it.
If it’s the first time I use it, I will see the following progress bar indicating that entries are downloaded in the %temp%\SG2013 directory:

If I run the same command again, I get results more quickly as entries are being read locally.

Get-PSH2013Learder -Category Advanced -EventNumber 1 -TopUsers 5 -UserName "_Emin_" |            
Select Rank,Name,Score,Votes |            
ft -AutoSize

For event 2: as long as it isn’t closed, it makes sense to query the top 10 users online.

Get-PSH2013Learder -Category Advanced -EventNumber 2 -TopUsers 5 -UserName "_Emin_"  -Repeat

As you can see in the above image, I got only 16 votes on my first entry whereas Mike F. Robbins got 74. Sure, Mike has a fan club 😀 and I don’t 😦

In the meantime, scoring guides lines have been published by Don Jones: and a nice reminder apprears in the standard voting mode:
…as well as in Beta voting mode:

If you read this post that far and before voting ends on event 2 (2013-05-14 00:00:00 (all times GMT)), you actually owe me a vote on my entry (if you didn’t rate it yet): Don’t forget to write a comment on what you like or don’t like. The whole point of the Scripting Games is to get feeback on my work and have fun.

Sure, you voted on my entry so that I can beat Mike? 😉 Here’s the link to the version 2.0 of Monitor-SG2013.ps1

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s