“Hot Corners” for Windows (PowerShell)

GitHub files

PoShHotCorners

"Hot Corners" for Windows

install

  • none really, simply download the ico and ps1 files to a folder and launch the ps1
  • please note MakeShortcut.cmd batch file provided for convenience ...
    • throw resulting .lnk file in your "run on startup" folder if you like: "%appdata%\Microsoft\Windows\Start Menu\Programs\Startup"
    • as you can see, the batch file simply runs shortcut tool xxmklink.exe with appropriate arguments

notes

  • currently coded to power down monitors triggered by mouse in lower right corner ... but it's just powershell folks, so think grand!
  • the lion's share of the code is actually just for the task tray icon...
  • look for "beef" as the key line where mouse location triggers action
  • DOES work with multiple monitors.
    • also includes tray menu options for blanking multiple displays independently
  • the timer loop inherently keeps watching the mouse so if your screens stubbornly randomly wake up like mine, this will bonk them right back to nappy time for the win, yes!

supporting multiple extended displays

  • if your scenario isn't working, drop me an issue on github or if you're inclined, check your [System.Windows.Forms.Screen]::AllScreens
  • here's mine:

    BitsPerPixel : 32
    Bounds       : {X=2560,Y=0,Width=1920,Height=1200}
    DeviceName   : \\.\DISPLAY2
    Primary      : False
    WorkingArea  : {X=2560,Y=0,Width=1920,Height=1160}
    
    BitsPerPixel : 32
    Bounds       : {X=0,Y=0,Width=2560,Height=1600}
    DeviceName   : \\.\DISPLAY3
    Primary      : True
    WorkingArea  : {X=0,Y=0,Width=2560,Height=1560}
  • i have 2 screens side-by-side, so note the Bounds of the first where X has a value...
  • so that's where the $mouse.X-$bounds.X in the "beef" check works for me...
  • hopefully that approach will carry through other monitor arragements with a little testing

tips

  • if you find that your windows get all jumbled after sleeping the monitors, this post actually seemed to help... but all i did was simply delete the whole registry folder HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\GraphicsDrivers\Configuration (i probably had at least 50 entries in there) and let Windows recreate.

Migrate from Delicious to Diigo

Delicious set the standard but they’ve been a bit of a bumpy ride lately with reliability… according to their blog blog they recently moved back to old code base and Del.icio.us domain (ah memories :)… and then just as of today just got their settings page operational such that I could successfully export my bookmarks and hop to another free link lily pad… the export yields a simple html file full of links.
 

I’ve initially setted on Diigo… it’s pretty slick… there’s a nicely robust Chrome plugin.
 

Below is a little jQuery i threw together to truncate my Delicious links at a certain cutoff date so I’m not loading a bunch of old junk.
Edit the exported html file and add jquery in the head like so and F5 refresh the page.

<head>
  <script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.3/jquery.min.js"></script>
</head>

then run this JS straight from the F12 developer tools console in Chrome, or whatever you prefer

// this approach works on "bookmark file" format. e.g. what Delicious.com exports
// basically just an html file full of <a> tags wrapped with <dt>'s inside one big <dl>
// key attributes: ADD_DATE="1461441710" TAGS="BestStuffEver"
// the date format is in seconds... to make it JS Date compatible just multiply value by 1000 (i.e. milliseconds)

// find the "add_date" of the oldest entry you want to keep
var cutoffDate = new Date(1345307846000)

// this then deletes all the links older than cutoffDate
$("a").each(function(idx, el) {
  if( new Date($(el).attr("add_date")*1000) < cutoffDate ) { var par = $(el).parent(); par.next("dd").remove(); par.remove(); }
});

// then just save-as that page

// and import to Diigo :)
// https://www.diigo.com/tools/import_all

PowerShell Dual Windows Explorers

 

Nutshell: Hosting two Windows File Explorers inside a WinForm… with the potential of sprinkling some utility hotkeys on top – e.g. “copy from left to right”.

 

Full source on GitHub


 

Highlights:

  • Always wanted to try this and just finally got around to it… and it actually works to a decent degree.
  • This is of course well covered ground with various other file managers… i just wanted to see if you could do it this poor man’s way with PowerShell driving… so one could readily make it one’s own with further customizations
  • I was a longtime fan of Directory Opus… I think it’s significant that this meager alternative is customized via standard PowerShell vs a 3rd party scripting environment that must be learned… i.e. if you happen to already know PowerShell, you can jump right in with all that file handling power available
  • The obnoxious part is hunting down the COM interfaces necessary to pull stuff out of FileExplorer… it dips into silliness like how IE is somehow part of the equation.
  • See comments for all the good posts i drew from to cobble it together… lots of handy Shell programming nuggets to be had
  • thanks to a handy github project, Font-Awesome is now in the WinForms domain – too cool
  • notes to self
    • interop.SHDocVw.dll is generated from doing a Visual Studio reference to C:\windows\system32\shdocvmw.dll
    • interop.Shell32.dll seemed like it was going to come in handy but didn’t wind up being necessary
    • these are the only real FileExplorer API calls necessary for the CopyFile piece
      • $objFolder = $objShell.NameSpace($explorerRight_SHDocVw.LocationUrl)
      • $objFolder.CopyHere($explorerLeft_SHDocVw.Document.SelectedItems())
    • there are a few wacky interfaces behind the shell objects but the neat thing is that runtime dynamic type binding makes using real types largely irrelevant… i feel that does lose some self documentation in the balance so i’ve tried to include the pertinent interfaces in the comments for future reference and expansion

The Perfect Desktop

I’ve finally achieved my own OS X like desktop nirvana on Windows 7:

  • StarDock’s ObjectDock for the main OS X cool factor dock at the bottom
  • After long searching for a way to reliably replicate all the Windows Notification Area functionality, I finally realized that running the standard Windows Taskbar minimized at the top of the screen is an excellent solution to the personal aesthetic I’ve been seeking.
    • StarDock’s ObjectBar was pretty good but not perfect… there are several great skins that makes it look just like the Mac, and it replicates the Notification Area quite well.  Unfortunately, for example, the volume icon did not work properly.  It would not pop up the volume slider window (which is apparently technically called a “Thumbnail Toolbar” in the Windows User Experience Guidelines).
    • I love that the built in volume slider popup responds to the mouse wheel… that’s perfectly convenient for a quick change.
  • An old tool called TClock allowed me to configure the clock exactly how I wanted it to include the date.  Without this little tweak, when the Taskbar is this minimized, the native clock only displays the time.  This little gem let’s you configure everything about the clock and even several other interesting Taskbar properties… like transparency, etc.  Highly recommended.
  • StacksDocklet by Arshi2009 is awesome for replicating the sexy OSX stack effect… I’m using this to house my favorite little utilities & control panels.
  • As you can see I’m running a couple other cool Docklets for the Weather and Clock (both come with ObjectDock), CPU Usage and System Sleep (which is actually scrolled off the far right of the screenshot).

 image