HOWTO: Build Tasklist for Studying for Microsoft Exams

This HOWTO is fairly specific to me but since I needed to document it anyway I figured I would share it in case in benefited others.
I have scheduled yet another Microsoft Exam for October.  One of the techniques I use during studying is to take the base “Skills Measured” list from Microsoft and build a checklist around it so I can keep track of what to review next.  To do this I traditionally copy and paste the list from the Microsoft exam site and painstakingly edit it to make it compatible with a commercial task tracking software I purchased called Swift To-Do List.  It’s mind-numbing repetitive work and I always tell myself I’m going to try and automate it but never do.  Well that ends today.

What am I talking about exactly?  Well let’s use an example.  I’m scheduled to write the 70-462 – Administering SQL 2012.  So I visit the site (https://www.microsoft.com/learning/en-ca/exam-70-462.aspx) and get something that looks like this:

image

There are a series of one level collapsible trees that contain all types of items on the exam.  The catch is rather than provide them in a list, the entries are separated by semi-colons.  What would be so much more useful is if I could transform that list into something like this:

image

Here I can make notes inline with each line item, colorize them based on difficulty, categorize them anyway I’d like and all sorts of other features offered by Swift To Do List.

So the question now is, how do you convert the list on the Microsoft site to a format that Swift To Do list can understand?  I tried all sorts of methods ranging from downloading the raw HTML and trying to parse it to trying to parse the raw XML of a saved .DOCX file to all sorts of other things.  I eventually stumbled upon the following.

Requirements

1) Firefox – (Required as other browsers mark the sub bullets with the same character as the parents making them impossible to differentiate)
2) Word 2013 – (Required as earlier versions of Word don’t properly process the bullets provided from FireFox)
3) PowerShell 2.0 or newer
4) The script at the end of this HOWTO

Instructions

1) Visit the the Microsoft page for the exam you’d like to extract the notes for (eg: https://www.microsoft.com/learning/en-ca/exam-70-462.aspx)

2) Using Firefox, select show all to expand all child nodes, highlight all the exam note text and press Control-C to copy it

image

3) Open Word 2013 and paste the data into a new page.  Note that the bullets and sub bullets should be different characters.  If not, the rest of this process will fail

image

4) Press Control-A to recopy the data into your buffer.  Word will fiddle with the formatting behind the scenes by doing this to make the next step possible

5) Open Notepad and paste in the data.  Note the differences between the bullets in the sub nodes

image

6) Save this file.  Let’s call it c:\temp\70462.txt for example.

7) Download the PowerShell script below and save it.  Open a PowerShell prompt, run the script and pass in the path to the text file you created above

image

8) Open Swift To Do List.  Create a new To Do List and press Control-H to enter multiple tasks at once

9) Paste in the data in your buffer.  Be sure to check Preserve tasks order. Press Add Tasks

image

8) Press Shift-[Minus] to collapse all of the tree nodes

9) Shift click on all of the Preparation resources, right click and choose Delete as these don’t apply here

image

10) Congratulations.  you have have a complete task list for your exam available that you can use to track your studying progress.

image

 

The Script

# Take a text file generated from FireFox and Word 2013 from Microsoft Exam Details and convert it into a format compatible with Swift To Do List
# Home; Microsoft; Exam; List

param
(
    [string]$Path
)

# Copy and paste the skills tree from the Microsoft Exam site into Microsoft Word and then from Microsoft Word into a text file.  Specify that text file here
$InputText = Get-Content $path

# Create a new Array  that will store our skills in a format supported by Swift To do List
$OutputText = @()

# Work through each line of data and process it based on the rules defined below
Write-Host "Reformatting text in $Path for use with Swift To Do List..." -ForegroundColor Green
ForEach($Line in $InputText)
{ 
    switch ($Line)
    {
        # This bullet character is found in the first level of the tree.  Replace it with a dash to indicate one level down to Swift To Do List
        {$_ -match '•'} { $Line = $Line -replace "•", "-" ; $OutputText += $Line }
        
        # The 'o' character is the second level of the tree.  It is the same as the alphabet 'o' so we need to replace  'o[tab]' to ensure we don't change sentences
        {$_ -match 'o	'} { 
            # Remove any lines that have this character as they are going to get replaced with "---" shortly
            $Line = $Line -replace "o	", ""
            # Microsoft includes multiple ideas on one line separated by semicolons.  We want to make each of these their own list item so we'll split at the semicolon
            $Line = $Line -split ";"
            # By default it will all be in one line.  This seperates out by carriage return so each line is on its own line
            $Line = $Line -split "`r`n"

            # Get the list of all items in this bullet once we split it out based on the semicolon.  We'll use this to iterate through the list to append the "---" to the front
            $Count = ($Line | Measure-Object).count

            # To tell Swift To do list this data is a second level item, add 3 dashes.  (It's 3 and not 2 because the level above is "-[tab]" which swift understands to be two items already
            For($i=0; $i -lt $Count; $i++)
                { $Line[$i] = "---" + $Line[$i] }

            # Save the data as a string rather than a series of objects so we can export it
            $Line = $Line | out-string
            # Add the new data to our output object
            $OutputText += $Line
        
        }
        # If the first two condtions are not met it should mean this is a parent level item so don't make any changes
        Default { $OutputText += $Line}
    }

}

Write-Host "Processing complete.  The data has been copied to your clipboard.  Open Swift To Do List and Paste in the the data." -ForegroundColor Green
$OutputText | clip

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.