Search form

Search

Case Flipping By Hot-Key

Submitted by dziemecki on Sat, 04/23/2016 - 14:50

There's this one app I work in that has the annoying feature of activating my Caps Lock key on certain screens. Depending upon how much keyboard work I'm doing, I might not notice until I write one of my associates a text message and find that I'm screaming at them about the time I hit the "Send" key. They are used to the app so they just laugh when they see it. But, in my mind, there is virtually no annoyance too trivial to fix with an overly complex script. Or four of them,

If you do any kind of coding, especially in established apps originally written by people with no interest in consistency, you may encounter stuff like this:

$var1="TheTest";$Var2="another test";$VAR3="Doe's this think work?";$_ACONSTANT="4";$AnoTherCOnstant="Lots";echo"<p>I write stuff like this because I hate Dan ".$AnoTherCOnstant." .</P>";

I tend to be very consistent with my coding because it makes it easier to read six months later when I have no idea what I was thinking. Whenever I'm working on one these apps, I spend significant time refactoring the code into something I'd be willing to pass off to another developer with anger management issues and a gun (because you never know). I've compiled a number of AutoHotKey scripts to make the casing parts of the task a bit easier. To use these, you just need the base AHK app locally installed along with a resident start-up script.

The first two are very basic: They convert whatever you've selected into either all caps, or all lower case:

The last one I use is a bit more of an edge case. If you need to capitalize the fist charachter, and then lower case the rest, either with one one, or a series of them, you might want something sometimes called "Proper Case". This is what titles look like, or some coding converntions.

About

I'm Dan Ziemecki, the author of this site and a technology professional working in the Atlanta area. "Excellent Cruft" is a journal wherein I log the lessons of my various projects (before I forget them) in an effort to give back to the community. Feel free to use anything you find here.