Skip to content

Commit

Permalink
minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelSchoenburg committed Apr 13, 2022
1 parent 1698ad3 commit e54d0fb
Showing 1 changed file with 30 additions and 25 deletions.
55 changes: 30 additions & 25 deletions New-PushMon.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@
Libraries, Modules, ...
#>

[CmdletBinding()]
param (
[Parameter(
Mandatory = $true
Expand Down Expand Up @@ -83,7 +82,9 @@ param (
Declare local variables and global variables
#>

# None, yet.
# From https://gist.github.com/WillemRB/5eb18301462ed6eb23bf
$Frames = '|', '/', '-', '\'
$Counter = 0

#endregion DECLARATIONS
#region FUNCTIONS
Expand Down Expand Up @@ -220,40 +221,44 @@ function Get-MousePosition {
Script entry point
#>

Write-Host "
██████ ██ ██ ███████ ██ ██ ███ ███ ██████ ███ ██ ▄▀ ▄▀
██ ██ ██ ██ ██ ██ ██ ████ ████ ██ ██ ████ ██ ▀ ▀
██████ ██ ██ ███████ ███████ ██ ████ ██ ██ ██ ██ ██ ██ █▀▀▀▀▀█▄
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ █░░░░░█─█
██ ██████ ███████ ██ ██ ██ ██ ██████ ██ ████ ▀▄▄▄▄▄▀▀
by Michael Schönburg
__
|__ _ | _ _ _||_ _ _| _ _| _ . _ . _|_ _ _ |_. _ _
|(_)| |(_|\/(-(_||_)(_|(_|( (_|(_|||||| )|_)|_| (_||_|(_)| )
/
" -ForegroundColor Yellow
Write-Host ""
# Write-Host "██████ ██ ██ ███████ ██ ██ ███ ███ ██████ ███ ██ ▄▀ ▄▀ " -ForegroundColor Yellow
# Write-Host "██ ██ ██ ██ ██ ██ ██ ████ ████ ██ ██ ████ ██ ▀ ▀ " -ForegroundColor Yellow
# Write-Host "██████ ██ ██ ███████ ███████ ██ ████ ██ ██ ██ ██ ██ ██ █▀▀▀▀▀█▄ " -ForegroundColor Yellow
# Write-Host "██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ █░░░░░█─█ " -ForegroundColor Yellow
# Write-Host "██ ██████ ███████ ██ ██ ██ ██ ██████ ██ ████ ▀▄▄▄▄▄▀▀ " -ForegroundColor Yellow
Write-Host " Write-Host by Michael Schönburg " -ForegroundColor Yellow
Write-Host " __ " -ForegroundColor Yellow
Write-Host " |__ _ | _ _ _||_ _ _| _ _| _ . _ . _|_ _ _ |_. _ _ " -ForegroundColor Yellow
Write-Host " |(_)| |(_|\/(-(_||_)(_|(_|( (_|(_|||||| )|_)|_| (_||_|(_)| ) " -ForegroundColor Yellow
Write-Host " / " -ForegroundColor Yellow
Write-Host "" -ForegroundColor Yellow
# Font from https://patorjk.com/software/taag
# Coffee from https://fsymbols.com/text-art/twitter/#all_cats
"-------------------------------------------------------------------------
Your specified monitoring method = $( $Method )
Your specified API token = $( $ApiToken )
Your specified user key = $( $UserKey )
"
"-------------------------------------------------------------------------"
Write-Host "Your specified monitoring method = $( $Method )"
Write-Host "Your specified API token = $( $ApiToken )"
Write-Host "Your specified user key = $( $UserKey )"

switch ($Method) {
'CursorAtPos' {
Write-Host "Hover over the position with your mouse and press any key to monitor it..."
$Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")
$x, $y = Get-MousePosition
$InitialColor = Get-ScreenColor -X $x -Y $y


Write-Host "Mouse position = x: $( $x ) y: $( $y )"
Write-Host "Initial color = $( $InitialColor )"
Write-Host 'Monitoring Color...'

# Monitoring
do {
Write-Host "Mouse position = x: $( $x ) y: $( $y )"
Write-Host "Initial color = $( $InitialColor )"
Write-Host 'Monitoring Color...'
Start-Sleep -Seconds 1
$CurrentColor = Get-ScreenColor -X $X -Y $Y
$frame = $frames[$counter % $frames.Length]
Write-Host "$frame" -NoNewLine
[Console]::SetCursorPosition(0, $cursorTop)
$counter += 1

$CurrentColor = Get-ScreenColor -X $X -Y $Y
} until ($CurrentColor.PSObject.ToString() -ne $InitialColor.PSObject.ToString())

Write-Host 'Color at given screen position has changed. Sending notification...' -ForegroundColor Yellow
Expand Down

0 comments on commit e54d0fb

Please sign in to comment.