About Me

Training

Nothin But .Net Developer Bootcamp

Navigation

Search

Categories

On this page

Archive

Blogroll

 Agile Developer Venkat's Blog
 Ayende @ Blog
 B#
 Barry Gervin's Software Architecture Perspectives
 Boy Meets World
 Brad Abrams
 Canadian Developers
 Christopher Steen
 Claritude Software News
 Clemens Vasters: Enterprise Development and Alien Abductions
 Coding Horror
 Coding in an Igloo
 Dare Obasanjo aka Carnage4Life
 Darrell Norton's Blog [MVP]
 David Hayden [MVP C#]
 Don Box's Spoutlet
 Eric Gunnerson's C# Compendium
 EZWeb guy: Jeffrey Palermo [C# MVP]
 Fear and Loathing
 Generalities & Details: Adventures in the High-tech Underbelly
 Greg Young [MVP]
 Greg's Cool [Insert Clever Name] of the Day
 IanG on Tap
 Ingo Rammer's Weblog
 ISerializable - Roy Osherove's Blog
 James Kovacs' Weblog
 Jason Haley
 Jean-Luc David
 Jeremy D. Miller -- The Shade Tree Developer
 JetBrains .NET Tools Blog
 Jimmy Nilsson's weblog
 John Bristowe's Weblog
 John Papa [MVP C#]
 Jon Skeet's Coding Blog
 JonGalloway.ToString()
 Jump the Fence or Walk Around
 Lambda the Ultimate - Programming Languages Weblog
 Larkware News
 Lutz Roeder
 Marquee de Sells: Chris's insight outlet
 Martin Fowler's Bliki
 Mike Nichols - SonOfNun Technology
 MSDN Magazine - .NET Matters
 MSDN Magazine - All Articles
 OdeToCode Blogs
 Onion Blog
 Planet TW
 Raymond Lewallen [MVP]
 Rockford Lhotka
 RodMan's Corner
 Roger Johansson's blog
 Sahil Malik - blah.winsmarts.com
 Sam Gentile's Blog
 Scott Bellware [MVP]
 Scott Hanselman's Computer Zen
 ScottGu's Blog
 secretGeek
 Service Station, by Aaron Skonnard
 Signum sine tinnitu--by Guy Kawasaki
 Stephen Toub
 Steve Eichert's Blog
 Steven Rockarts
 The Blog Ride
 The Coding Hillbilly
 The Daily WTF
 TheServerSide.net: News
 Tim Gifford
 Vance Morrison's Weblog
 you've been HAACKED

Disclaimer
The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

RSS 2.0 | Atom 1.0 | CDF

Send mail to the author(s) E-mail

 Wednesday, May 28, 2008
Wednesday, May 28, 2008 3:45:44 AM (Mountain Standard Time, UTC-07:00) ( Tools )

Hot on the heels of my announcement about switching to use AutoHotKey, Dave posts an example overhaul that demonstrates just how powerful autohotkey is!! My brain is definitely brimming with ideas on how I can leverage this new tool in the toolbox!!

He has created a script that allows you to toggle BDD naming on/off with the same key sequence. The script also adds a customized tray icon which shows whether the script is currently enabled or not!! This is much better than mine, as you only have to use one keyboard shortcut to do the toggling.

I modified his script slightly as I did not want the TrayTip popping up whenever I switched between modes. I also wanted my toggle to be the CTRL-SHIFT-U keys instead of CTRL-ALT-U.

The following zip file contains the modification:

You can find the original here on Dave's post.

Thanks for taking the time to improve the script and let me know Dave!!

Develop With Passion!!

Wednesday, May 28, 2008 12:36:00 AM (Mountain Standard Time, UTC-07:00)
Nice... Some changes I made:

* Now only works in Visual studio (just windows with Microsoft Visual Studio in the title, too lazy to look at the class)
* Escape, ^[ and Enter now all end test naming mode. Escape and ^[ pass the keys through, but Enter does not. May want to add tab?
* Quote (") now adds _ because SpecUnit (and MSpec soon) converts __ to ".

Here's the changed version (feel free to remove from comments if you like):

;=======================================================================================
;BDD Test Naming Mode AHK Script
;
;Description:
; Replaces spaces with underscores while typing, to help with writing BDD test names.
; Toggle on and off with Ctrl + Shift + U.
;=======================================================================================


;==========================
;Initialise
;==========================
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
#SingleInstance force
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
SetTitleMatchMode 2

enabledIcon := "testnamingmode_16.ico"
disabledIcon := "testnamingmode_disabled_16.ico"
IsInTestNamingMode := false
SetTestNamingMode(false)

;==========================
;Functions
;==========================
SetTestNamingMode(toActive) {
local iconFile := toActive ? enabledIcon : disabledIcon
local state := toActive ? "ON" : "OFF"

IsInTestNamingMode := toActive
Menu, Tray, Icon, %iconFile%,
Menu, Tray, Tip, Test naming mode is %state%

Send {Shift Up}
}

;==========================
;Test Mode toggle
;==========================
#IfWinActive Microsoft Visual Studio
^+u::
SetTestNamingMode(!IsInTestNamingMode)
return

$Escape::
if (IsInTestNamingMode) {
SetTestNamingMode(!IsInTestNamingMode)
}
Send, {Escape}
return

^[::
if (IsInTestNamingMode) {
SetTestNamingMode(!IsInTestNamingMode)
}
Send, ^[
return

$Enter::
if (IsInTestNamingMode) {
SetTestNamingMode(!IsInTestNamingMode)
} else {
Send, {Enter}
}
return

"::
if (IsInTestNamingMode) {
Send, _
} else {
Send, "
}
return


;==========================
;Handle SPACE press
;==========================
$Space::
if (IsInTestNamingMode) {
Send, _
} else {
Send, {Space}
}
#IfWinActive
Monday, November 03, 2008 9:32:53 AM (Mountain Standard Time, UTC-07:00)
Brilliant script, I love it! One thing I did change one thing though:

$Enter::
if (IsInTestNamingMode) {
SetTestNamingMode(!IsInTestNamingMode)
} else {
Send, {Enter}
}
return

to this:

$Enter::
if (IsInTestNamingMode) {
SetTestNamingMode(!IsInTestNamingMode)
}
Send, {Enter}
return

I use this most when entering a test method name into a snippet/live template. When I click enter I want it to turn off underscoring, and send the enter command to complete the snippet/template.

Andrew
Sunday, May 31, 2009 3:57:12 AM (Mountain Standard Time, UTC-07:00)
How are you. No one gossips about other people's secret virtues.
I am from Benin and now study English, give true I wrote the following sentence: "Articles related to suppression of allergic diarrhea in murine ovalbumin induced allergic diarrhea model by pg, a anti allergic effects of pg,"

Waiting for a reply :o, Antionette.
Name
E-mail
Home page

Comment (HTML not allowed)  

Enter the code shown (prevents robots):