Guest User

Untitled

a guest
Jan 22nd, 2024
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #SingleInstance force
  2. *$3::
  3. *$7::
  4. *$0::
  5. *$a::
  6. *$b::
  7. *$c::
  8. *$d::
  9. *$e::
  10. *$f::
  11. *$g::
  12. *$h::
  13. *$i::
  14. *$j::
  15. *$k::
  16. *$l::
  17. *$m::
  18. *$n::
  19. *$o::
  20. *$p::
  21. *$q::
  22. *$r::
  23. *$s::
  24. *$t::
  25. *$u::
  26. *$v::
  27. *$w::
  28. *$x::
  29. *$y::
  30. *$z::
  31. *$Tab::
  32. *$`::
  33. *$`;::
  34. *$'::
  35. *$Enter::
  36. *$-::
  37. *$=::
  38. *$,::
  39. *$.::
  40. *$/::
  41. *$\::
  42. *$[::
  43. *$]::
  44. *$CapsLock::
  45. *$Backspace::
  46. 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}" }
  47. 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"]
  48. special_key_dict:= {"{Backspace}": "Z", "{Tab}": "I","{Enter}": "G", "{CapsLock}": "D","-": "%","=": "$","[": "W","]": "O","`;": "S","'": "H","\": "T",",": "^",".": "P","/": "Q","``":"6"}
  49. special_key_list:= ["{Backspace}", "{Tab}","{Enter}","{CapsLock}","-","=","[","]","`;","'","\",",",".","/","``"]
  50.  
  51. key_signature := 0
  52.  
  53. associated_key := key_dict[A_ThisHotKey]
  54.  
  55. if (GetKeyState("Shift", "P"))
  56. {
  57.     ;MsgBox, associated_key %associated_key%
  58.    
  59.     ; Does this key exist, if it does, give me the index
  60.     special_key_index := GetIndex(special_key_list, associated_key)
  61.    
  62.     ;MsgBox, special_key_index %special_key_index%
  63.     ; Is the associated key a special one?
  64.     if (special_key_index != -1)
  65.     {
  66.         ; Find which key the special key maps to
  67.         special_key := special_key_list[special_key_index]
  68.        
  69.         ;MsgBox, special_key %special_key%
  70.        
  71.         special_key_match := special_key_dict[special_key]
  72.        
  73.         ;MsgBox, special_key_match %special_key_match%
  74.        
  75.         ; Find the matched key's index in the sorted list
  76.         sorted_key_list_index := GetIndex(sorted_key_list, special_key_match)
  77.        
  78.         ;MsgBox, sorted_key_list_index %sorted_key_list_index%
  79.        
  80.         ; Move it up one since we're holding shift
  81.         special_key_next := sorted_key_list[sorted_key_list_index + key_signature + 1]
  82.        
  83.         ;MsgBox, special_key_next %special_key_next%
  84.        
  85.         if (special_key_next = "^")
  86.         {
  87.             special_key_next:="6"
  88.         }
  89.         else if (special_key_next = "$")
  90.         {
  91.             special_key_next:="4"
  92.         }
  93.         else if (special_key_next = "%")
  94.         {
  95.             special_key_next:="5"
  96.         }
  97.         else if (special_key_next != "7" and special_key_next != "6" and special_key_next != "5")
  98.         {
  99.             special_key_next := sorted_key_list[sorted_key_list_index + key_signature + 2]
  100.         }
  101.        
  102.         Send %special_key_next%
  103.     }
  104.     ; This is probably a normal key
  105.     else
  106.     {
  107.         normal_key_index := GetIndex(sorted_key_list, associated_key)
  108.        
  109.         ; If this key exists
  110.         if (normal_key_index != -1)
  111.         {
  112.             ; Find the next key with the associated index
  113.             key_next := sorted_key_list[normal_key_index + key_signature + 1]
  114.            
  115.             Send %key_next%
  116.         }
  117.     }
  118. }
  119. else
  120. {
  121.     ; Does this key exist, if it does, give me the index
  122.     special_key_index := GetIndex(special_key_list, associated_key)
  123.    
  124.     ; Is the associated key a special one?
  125.     if (special_key_index != -1)
  126.     {
  127.         ; Find which key the special key maps to
  128.         special_key := special_key_list[special_key_index]
  129.        
  130.         special_key_match := special_key_dict[special_key]
  131.        
  132.         ; Find the matched key's index in the sorted list
  133.         sorted_key_list_index := GetIndex(sorted_key_list, special_key_match)
  134.        
  135.         special_key := sorted_key_list[sorted_key_list_index + key_signature]
  136.  
  137.         if (special_key = "^")
  138.         {
  139.             special_key:="+6"
  140.         }
  141.         else if (special_key = "$")
  142.         {
  143.             special_key:="+4"
  144.         }
  145.         else if (special_key = "%")
  146.         {
  147.             special_key:="+5"
  148.         }
  149.         else
  150.         {
  151.             special_key := sorted_key_list[sorted_key_list_index + key_signature + 1]
  152.         }
  153.        
  154.         Send %special_key%
  155.     }
  156.     ; This is probably a normal key
  157.     else
  158.     {
  159.         normal_key_index := GetIndex(sorted_key_list, associated_key)
  160.        
  161.         ; If this key exists
  162.         if (normal_key_index != -1)
  163.         {
  164.             ; Find the key with the associated index
  165.             key := sorted_key_list[normal_key_index + key_signature]
  166.            
  167.             Send %key%
  168.         }
  169.     }
  170. }
  171.  
  172. GetIndex(haystack, needle)
  173. {
  174.     if !(IsObject(haystack)) || (haystack.Length() = 0)
  175.     {
  176.         return -1
  177.     }
  178.    
  179.     for index, value in haystack
  180.     {
  181.         if (value = needle)
  182.         {
  183.             return index
  184.         }
  185.     }
  186.    
  187.     return -1
  188. }
Add Comment
Please, Sign In to add comment