Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #SingleInstance force
- *$3::
- *$7::
- *$0::
- *$a::
- *$b::
- *$c::
- *$d::
- *$e::
- *$f::
- *$g::
- *$h::
- *$i::
- *$j::
- *$k::
- *$l::
- *$m::
- *$n::
- *$o::
- *$p::
- *$q::
- *$r::
- *$s::
- *$t::
- *$u::
- *$v::
- *$w::
- *$x::
- *$y::
- *$z::
- *$Tab::
- *$`::
- *$`;::
- *$'::
- *$Enter::
- *$-::
- *$=::
- *$,::
- *$.::
- *$/::
- *$\::
- *$[::
- *$]::
- *$CapsLock::
- *$Backspace::
- key_dict := {"*$3":"3","*$7":"7","*$0":"0","*$a":"a","*$b":"b","*$c":"c","*$d":"d","*$e":"e","*$f":"f","*$g":"g","*$h":"h","*$i":"i","*$j":"j","*$k":"k","*$l":"l","*$m":"m","*$n":"n","*$o":"o","*$p":"p","*$q":"q","*$r":"r","*$s":"s","*$t":"t","*$u":"u","*$v":"v","*$w":"w","*$x":"x","*$y":"y","*$z":"z","*$Tab":"{Tab}","*$``":"``","*$;":"`;","*$'":"'","*$Enter": "{Enter}" ,"*$-":"-","*$=":"=","*$,":",","*$.":".","*$/":"/","*$\":"\","*$[":"[","*$]":"]","*$CapsLock": "{CapsLock}" }
- sorted_key_list := ["1","!","2","@","3","4","$","5","%","6","^","7","8","*","9","(","0","q","Q","w","W","e","E","r","t","T","y","Y","u","i","I","o","O","p","P","a","s","S","d","D","f","g","G","h","H","j","J","k","l","L","z","Z","x","X","c","C","v","V","b","B","n","N","m","M"]
- special_key_dict:= {"{Backspace}": "Z", "{Tab}": "I","{Enter}": "G", "{CapsLock}": "D","-": "%","=": "$","[": "W","]": "O","`;": "S","'": "H","\": "T",",": "^",".": "P","/": "Q","``":"6"}
- special_key_list:= ["{Backspace}", "{Tab}","{Enter}","{CapsLock}","-","=","[","]","`;","'","\",",",".","/","``"]
- key_signature := 0
- associated_key := key_dict[A_ThisHotKey]
- if (GetKeyState("Shift", "P"))
- {
- ;MsgBox, associated_key %associated_key%
- ; Does this key exist, if it does, give me the index
- special_key_index := GetIndex(special_key_list, associated_key)
- ;MsgBox, special_key_index %special_key_index%
- ; Is the associated key a special one?
- if (special_key_index != -1)
- {
- ; Find which key the special key maps to
- special_key := special_key_list[special_key_index]
- ;MsgBox, special_key %special_key%
- special_key_match := special_key_dict[special_key]
- ;MsgBox, special_key_match %special_key_match%
- ; Find the matched key's index in the sorted list
- sorted_key_list_index := GetIndex(sorted_key_list, special_key_match)
- ;MsgBox, sorted_key_list_index %sorted_key_list_index%
- ; Move it up one since we're holding shift
- special_key_next := sorted_key_list[sorted_key_list_index + key_signature + 1]
- ;MsgBox, special_key_next %special_key_next%
- if (special_key_next = "^")
- {
- special_key_next:="6"
- }
- else if (special_key_next = "$")
- {
- special_key_next:="4"
- }
- else if (special_key_next = "%")
- {
- special_key_next:="5"
- }
- else if (special_key_next != "7" and special_key_next != "6" and special_key_next != "5")
- {
- special_key_next := sorted_key_list[sorted_key_list_index + key_signature + 2]
- }
- Send %special_key_next%
- }
- ; This is probably a normal key
- else
- {
- normal_key_index := GetIndex(sorted_key_list, associated_key)
- ; If this key exists
- if (normal_key_index != -1)
- {
- ; Find the next key with the associated index
- key_next := sorted_key_list[normal_key_index + key_signature + 1]
- Send %key_next%
- }
- }
- }
- else
- {
- ; Does this key exist, if it does, give me the index
- special_key_index := GetIndex(special_key_list, associated_key)
- ; Is the associated key a special one?
- if (special_key_index != -1)
- {
- ; Find which key the special key maps to
- special_key := special_key_list[special_key_index]
- special_key_match := special_key_dict[special_key]
- ; Find the matched key's index in the sorted list
- sorted_key_list_index := GetIndex(sorted_key_list, special_key_match)
- special_key := sorted_key_list[sorted_key_list_index + key_signature]
- if (special_key = "^")
- {
- special_key:="+6"
- }
- else if (special_key = "$")
- {
- special_key:="+4"
- }
- else if (special_key = "%")
- {
- special_key:="+5"
- }
- else
- {
- special_key := sorted_key_list[sorted_key_list_index + key_signature + 1]
- }
- Send %special_key%
- }
- ; This is probably a normal key
- else
- {
- normal_key_index := GetIndex(sorted_key_list, associated_key)
- ; If this key exists
- if (normal_key_index != -1)
- {
- ; Find the key with the associated index
- key := sorted_key_list[normal_key_index + key_signature]
- Send %key%
- }
- }
- }
- GetIndex(haystack, needle)
- {
- if !(IsObject(haystack)) || (haystack.Length() = 0)
- {
- return -1
- }
- for index, value in haystack
- {
- if (value = needle)
- {
- return index
- }
- }
- return -1
- }
Add Comment
Please, Sign In to add comment