/* This AutoHotkey script demonstrates the use of the Input command for entering state names by keying in its two-letter abbreviation. The command is activated with the Hotkey combination ALT+]. Then, you have 10 seconds to enter the two-letter code. */ #NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases. SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory. !]:: Input, UserInput, V T10 L2, {enter}.{esc}{tab}, al,ak,az,ar,ca,co,ct,de,fl,ga,hi,id,il,in,ia,ks,ky,la,me,md,ma,mi,mn,ms,mo,mt,ne,nv,nh,nj,nm,ny,nc,nd,oh,ok,or,pa,ri,sc,sd,tn,tx,ut,vt,va,wa,wv,wi,wy,dc /* if (ErrorLevel = "Max") { MsgBox, You entered "%UserInput%", which is the maximum length of text. return } */ If InStr(ErrorLevel, "EndKey:") { MsgBox, You entered "%UserInput%" and terminated the input with %ErrorLevel%. return } if (ErrorLevel = "Timeout") { MsgBox, You entered "%UserInput%" at which time the input timed out. return } if (ErrorLevel != "Match") { Send, {backspace 2} MsgBox, "%UserInput%" is not a state abbreviation. return } if (ErrorLevel = "NewInput") return ; Otherwise, a match was found. if (UserInput = "al") Send, {backspace 2}Alabama else if (UserInput = "ak") Send, {backspace 2}Alaska else if (UserInput = "az") Send, {backspace 2}Arizona else if (UserInput = "ar") Send, {backspace 2}Arkansas else if (UserInput = "ca") Send, {backspace 2}California else if (UserInput = "co") Send, {backspace 2}Colorado else if (UserInput = "ct") Send, {backspace 2}Connecticut else if (UserInput = "de") Send, {backspace 2}Delaware else if (UserInput = "fl") Send, {backspace 2}Florida else if (UserInput = "ga") Send, {backspace 2}Georgia else if (UserInput = "hi") Send, {backspace 2}Hawaii else if (UserInput = "id") Send, {backspace 2}Idaho else if (UserInput = "il") Send, {backspace 2}Illinois else if (UserInput = "in") Send, {backspace 2}Indiana else if (UserInput = "ia") Send, {backspace 2}Iowa else if (UserInput = "ks") Send, {backspace 2}Kansas else if (UserInput = "ky") Send, {backspace 2}Kentucky else if (UserInput = "la") Send, {backspace 2}Louisiana else if (UserInput = "me") Send, {backspace 2}Maine else if (UserInput = "md") Send, {backspace 2}Maryland else if (UserInput = "ma") Send, {backspace 2}Massachusetts else if (UserInput = "mi") Send, {backspace 2}Michigan else if (UserInput = "mn") Send, {backspace 2}Minnesota else if (UserInput = "ms") Send, {backspace 2}Mississippi else if (UserInput = "mo") Send, {backspace 2}Missouri else if (UserInput = "mt") Send, {backspace 2}Montana else if (UserInput = "ne") Send, {backspace 2}Nebraska{click, %A_CaretX%, %A_CaretY%}{Right 6} else if (UserInput = "nv") Send, {backspace 2}Nevada else if (UserInput = "nh") Send, {backspace 2}New Hampshire else if (UserInput = "nj") Send, {backspace 2}New Jersey else if (UserInput = "nm") Send, {backspace 2}New Mexico else if (UserInput = "ny") Send, {backspace 2}New York else if (UserInput = "nc") Send, {backspace 2}North Carolina else if (UserInput = "nd") Send, {backspace 2}North Dakota else if (UserInput = "oh") Send, {backspace 2}Ohio else if (UserInput = "ok") Send, {backspace 2}Oklahoma else if (UserInput = "or") Send, {backspace 2}Oregon else if (UserInput = "pa") Send, {backspace 2}Pennsylvania else if (UserInput = "ri") Send, {backspace 2}Rhode Island else if (UserInput = "SC") Send, {backspace 2}South Carolina else if (UserInput = "sd") Send, {backspace 2}South Dakota else if (UserInput = "tn") Send, {backspace 2}Tennessee else if (UserInput = "tx") Send, {backspace 2}Texas else if (UserInput = "ut") Send, {backspace 2}Utah else if (UserInput = "vt") Send, {backspace 2}Vermont else if (UserInput = "va") Send, {backspace 2}Virginia else if (UserInput = "wa") Send, {backspace 2}Washington else if (UserInput = "wv") Send, {backspace 2}West Virginia else if (UserInput = "wi") Send, {backspace 2}Wisconsin else if (UserInput = "wy") Send, {backspace 2}Wyoming else if (UserInput = "dc") Send, {backspace 2}Washington, D.C. Return