Last active
December 18, 2015 02:39
-
-
Save OnesimusUnbound/5713000 to your computer and use it in GitHub Desktop.
Powershell Script for Seven Minute Workout. Sends notification when the exercise or rest is done
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$sound = New-Object System.Media.SoundPlayer; | |
function Initialize-Alert { | |
$sound.SoundLocation="$env:WINDIR\Media\ringout.wav"; | |
} | |
function Alert-User { | |
$sound.Play(); | |
} | |
function Instruct-User($activity, $duration) { | |
Alert-User | |
Echo "Do $activity" | |
Start-Sleep -Seconds $duration | |
} | |
function Run-Circuit($ExerciseDuration, $RestDuration, $CircuitRestDuration, $Exercises) { | |
process { | |
$circuitNumber = $_ | |
$lastIndex = $Exercises.Length - 1 | |
$firstTask = $Exercises[0] | |
$otherTasks = $Exercises[1..$lastIndex] | |
Clear-Host | |
Instruct-User $firstTask $ExerciseDuration | |
$otherTasks | % { | |
Instruct-User "Rest" $RestDuration | |
Clear-Host | |
Instruct-User $_ $ExerciseDuration | |
} | |
Clear-Host | |
Instruct-User "Rest from Circuit $circuitNumber" $CircuitRestDuration | |
} | |
} | |
function Main($settings) { | |
Initialize-Alert | |
Clear-Host | |
Instruct-User "Prepare" $settings.PreparationDuration | |
1..$settings.NumberOfCircuit | Run-Circuit @settings | |
} | |
Main @{ | |
PreparationDuration = 30 | |
ExerciseDuration = 30 | |
RestDuration = 10 | |
CircuitRestDuration = 30 | |
NumberOfCircuit = 3 | |
Exercises = @( | |
"Jumping jacks" | |
"Wall sit" | |
"Push-up" | |
"Abdominal crunch Core" | |
"Step-up onto chair" | |
"Squat" | |
"Triceps dip on chair" | |
"Plank" | |
"High knees/running in place" | |
"Lunge" | |
"Push-up and rotation" | |
"Side plank" | |
"Side plank" | |
) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment