I would like a script with an inputbox where:
If I enter "c"... it will return "abc"
If I enter "j"... it will return "abcdefghij"
If I enter "z"... it will return "abcdefghijklmnopqrstuvwxyz"
Was trying to use something like this.
<!-- m -->http://www.autohotke... ... t=alphabet<!-- m -->
Alphabet loop
Started by
Xx7
, Feb 29 2012 08:35 PM
8 replies to this topic
#1
-
Posted 29 February 2012 - 08:35 PM
I got it working... but its probably the least efficient code possible :? . Anybody know how to shorten this or atleast not have TWO arrays in the code?
^7:: InputBox, SearchTerm, Alphabet, Please enter a letter, , 300, 130 if (SearchTerm <> "") { ;########## Keys are alphabet ############### Array1 := {a: "1", b: "2", c: "3", d: "4", e: "5", f: "6", g: "7", h: "8", i: "9", j: "10", k: "11", l: "12", m: "13", n: "14", o: "15", p: "16", q: "17", r: "18", s: "19", t: "20", u: "21", v: "22", y: "23", x: "24", y: "25", z: "26"} ;########## Keys as numbers ############### Array2 := {1: "a", 2: "b", 3: "c", 4: "d", 5: "e", 6: "f", 7: "g", 8: "h", 9: "i", 10: "j", 11: "k", 12: "l", 13: "m", 14: "n", 15: "o", 16: "p", 17: "q", 18: "r", 19: "s", 20: "t", 21: "u", 22: "v", 23: "y", 24: "x", 25: "y", 26: "z"} number_pos := Array1[SearchTerm] while, A_Index <= number_pos { SendInput, % Array2[A_Index] SendInput, ){enter} } } else Exit return
#2
-
Posted 29 February 2012 - 10:11 PM
:shock:
Yikes. Try this:
Yikes. Try this:
alphabet=abcdefghijklmnopqrstuvwxyz ; place this part in the auto-execute section of the script Loop, parse, alphabet ; Hotkey, $%A_LoopField%, Letters ; return ; Letters: Send % SubStr(alphabet,1,InStr(alphabet,SubStr(A_ThisHotkey,0))) return
#3
-
Posted 29 February 2012 - 10:22 PM
Or even:
Loop 26 Hotkey, % "$" Chr(A_Index+97), Letters return Letters: Send % SubStr(alphabet,1,InStr(alphabet,SubStr(A_ThisHotkey,0))) return
#4
-
Posted 29 February 2012 - 10:34 PM
Using RegEx:
From:
<!-- m -->http://l.autohotkey....Ex-QuickRef.htm<!-- m -->
\w
Matches any single "word" character, namely alphanumeric or underscore.
This is equivalent to [a-zA-Z0-9_].
+
A plus sign matches one or more of the preceding character, class, or subpattern.
alphabet := "abcdefghijklmnopqrstuvwxyz" f1:: Inputbox, _V_, Testing,,,128,128 pattern := "\w+" _V_ RegExMatch(alphabet, pattern, match) TrayTip,, %match% Return
From:
<!-- m -->http://l.autohotkey....Ex-QuickRef.htm<!-- m -->
\w
Matches any single "word" character, namely alphanumeric or underscore.
This is equivalent to [a-zA-Z0-9_].
+
A plus sign matches one or more of the preceding character, class, or subpattern.
#5
-
Posted 01 March 2012 - 12:15 AM
Win7 (x64)
Look up commands faster by using the AutoHotkey Help File's index.
Start→AllPrograms→AutoHotkey→AutoHotkey Help File
couple of things:Or even:
Loop 26 Hotkey, % "$" Chr(A_Index+97), Letters return Letters: Send % SubStr(alphabet,1,InStr(alphabet,SubStr(A_ThisHotkey,0))) return
1- it should be Chr(A_Index+96)
2- there is no variable named 'alphabet'
does not produce an output if input = 'a'Using RegEx:
alphabet := "abcdefghijklmnopqrstuvwxyz" f1:: Inputbox, _V_, Testing,,,128,128 pattern := "\w+" _V_ RegExMatch(alphabet, pattern, match) TrayTip,, %match% Return
alphabet := "abcdefghijklmnopqrstuvwxyz" f1:: Inputbox, _V_, Testing,,,128,128 traytip,, % RegExReplace(alphabet, "(.*" _V_ ").*", "$1") Return
#6
-
Posted 01 March 2012 - 03:08 AM
If an output of 'a' is desired,
you only need to replace the + with *
*
An asterisk matches zero or more of the preceding character, class, or subpattern.
you only need to replace the + with *
alphabet := "abcdefghijklmnopqrstuvwxyz" f1:: Inputbox, _V_, Testing,,,128,128 pattern := "\w*" _V_ RegExMatch(alphabet, pattern, match) TrayTip,, %match% Return
*
An asterisk matches zero or more of the preceding character, class, or subpattern.
#7
-
Posted 01 March 2012 - 03:24 AM
Win7 (x64)
Look up commands faster by using the AutoHotkey Help File's index.
Start→AllPrograms→AutoHotkey→AutoHotkey Help File
This isn't entirely on topic but I wanted to find something like this a while ago to navigate menus by using military alphabet for speech recognition with Glove Pie. it means that you don't have to remember the names of thousands of functions.
Might be handy to someone trying to do something similar.
The code below will list the files in a folder and attach a letter to the start. It doesn't do anything other than show you a msgbox.
var_space := " "
Loop, *.*, 1 ; return only folders at this level
{
var_letter_num++
GOSUB letter_swag
File_List .= letter_item var_space A_LoopFileFullPath . "`n"
StringReplace, namevar, A_LoopFileFullPath,%A_Space%,_, All
; FileAppend,%namevar%, File_List.ah_gen
}
msgbox , % File_List
letter_swag:
if var_letter_num = 1
{
letter_item := "a"
}
if var_letter_num = 2
{
letter_item := "b"
}
if var_letter_num = 3
{
letter_item := "c"
}
if var_letter_num = 4
{
letter_item := "d"
}
if var_letter_num = 5
{
letter_item := "e"
}
if var_letter_num = 6
{
letter_item := "f"
}
if var_letter_num = 7
{
letter_item := "g"
}
if var_letter_num = 8
{
letter_item := "h"
}
if var_letter_num = 9
{
letter_item := "i"
}
if var_letter_num = 10
{
letter_item := "j"
}
if var_letter_num = 11
{
letter_item := "k"
}
if var_letter_num = 12
{
letter_item := "l"
}
if var_letter_num = 13
{
letter_item := "m"
}
if var_letter_num = 14
{
letter_item := "n"
}
if var_letter_num = 15
{
letter_item := "o"
}
if var_letter_num = 16
{
letter_item := "p"
}
if var_letter_num = 17
{
letter_item := "q"
}
if var_letter_num = 18
{
letter_item := "r"
}
if var_letter_num = 19
{
letter_item := "s"
}
if var_letter_num = 20
{
letter_item := "t"
}
if var_letter_num = 21
{
letter_item := "u"
}
if var_letter_num = 22
{
letter_item := "v"
}
if var_letter_num = 23
{
letter_item := "w"
}
if var_letter_num = 24
{
letter_item := "x"
}
if var_letter_num = 25
{
letter_item := "y"
}
if var_letter_num = 26
{
letter_item := "z"
}
RETURN
#8
-
Posted 07 December 2015 - 06:20 PM
Hi, You can use this very simple :
Alfa_List = abcdefghijklmnopqrstuvwxyz InputBox, Stop_Alfa, Enter A Letter if !ErrorLevel { Sleep, 200 Loop, Parse, Alfa_List, %Stop_Alfa% { Send_List := A_LoopField Stop_Alfa break } WinActivate Sleep, 100 Send, %Send_List% }
#9
-
Posted 08 December 2015 - 11:18 PM