Simple Keystroke Automation in .NET (Scott Hanselman's Http Button)

Scott Hanselman ( recently tweet'd, "I need a keyboard with an "http://www." button."

To which I replied, "@shanselman you still type the "http" part? I didn't think you had to anymore..."  Oooh, hahahaha, how smart and funny am I!?  ....Apparently not very... :-)

shanselman responded (as well as to others with the same smart remarks), "@aaron_hoffman in tweetdeck or Twitter, you do."  --Aaaah, I get it now, he's not in a browser! okay, he has me in Check.

Now I just had to solve this problem.  Well automation/degree in laziness (with years of laziness experience) to the rescue!  At first I thought PowerShell - but since I am on a WinXP SP2 machine, that wouldn't do.  I'll have to fall back to the console app & desktop shortcut combination of yester-system.

Steps to Simple Keystroke Automation (w/ WinXP SP2 Handicap)

1. Create .NET Console App
2. Write/Build App.
    2.1  Note System.Windows.Forms.SendKeys class
    2.2  Note text string of "http://www."

   10    class Program
   11    {
   12       static void Main(string[] args)
   13       {
   14          System.Windows.Forms.SendKeys.SendWait(@"http://www.");
   15       }
   16    }

3. Create Shortcut to New App On Desktop
4. Set properties correctly:
    4.1  Shortcut key: "Ctrl + Alt + H"
    4.2  Run: "Minimized"

5. Go Back to Twitter and Press the "http://www." button!  (Ctrl + Alt + H)
6. This should run the New App, which should send the text string as keystrokes to the currently active window.

Checkmate!   But wait.  Have I been played?  Maybe this is what he was hoping for all along!?  He posts a need on Twitter and someone does the work for him.... well played sir.... well played indeed.  :-)

1 comment

Popular posts from this blog

How to Turn Off Microsoft Arc Touch Mouse Scroll Sound Vibration

Search iPhone Text Messages with SQLite SQL Query

Microsoft Excel 2013 Sort Pivot Table By Calculated Field