Saturday, December 19, 2009

ADH .NET Helper Library

(please link to this page using http://tinyurl.com/adhlib)

I plan to slowly put this helper library together over time. There are a lot of helper classes and libraries out there - the goal of this project is to make the source classes/files easy to extract a single file at a time for use within your projects. The entire libraries/assemblies can still be referenced as well, but sometimes it is easier to just copy a single file. Enjoy!


source code download: http://aaronhoffman.googlecode.com/files/AdhLibv3.5.0.zip



Live Test Sites (also included in source code):

Silverlight Navigation: http://tinyurl.com/adhlibsl



Articles Highlighting Project Features:


(I will link to future articles here)


-Aaron

Wednesday, December 16, 2009

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

--
Scott Hanselman (http://www.hanselman.com/http://twitter.com/shanselman) 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.  :-)

--