Last active
August 29, 2015 14:05
-
-
Save jamessantiago/b6bfcc9d6f4d09f77a23 to your computer and use it in GitHub Desktop.
Timbo Shell
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
Add-Type @" | |
using System; | |
using System.Runtime.InteropServices; | |
public class Tricks { | |
[DllImport("user32.dll")] | |
public static extern IntPtr GetForegroundWindow(); | |
} | |
"@ | |
1..60 |% { | |
$p = [tricks]::GetForegroundWindow() | |
$c = get-process | ? { $_.mainwindowhandle -eq $p } | |
write-host "$(date): $($c.ProcessName) has focus" | |
sleep 1 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment