Advertisement
jcunews

arabic101layout.ahk

Feb 5th, 2024
1,055
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ;Arabic (101) keyboard layout for U.S. (QWERTY) keyboards.
  2. ;
  3. ;Version 1.0.1. For AutoHotkey v1 Unicode version only.
  4. ;https://pastebin.com/u/jcunews
  5. ;https://www.reddit.com/user/jcunews1
  6. ;
  7. ;Layout image: https://upload.wikimedia.org/wikipedia/commons/a/af/KB_Arabic.svg
  8. ;
  9. ;This script is for users whose system not yet have Arabic keyboard layout,
  10. ;and the users do not have access to add built in keyboard layouts.
  11. ;Use the ScrollLock key activate/deactivate (follows the ScrollLock LED).
  12.  
  13. #persistent
  14.  
  15. if (!a_isunicode) {
  16.   msgbox This script requires Unicode version of AutoHotkey v1.
  17.   exitapp
  18. }
  19. map:= {"'": ["0637", "0651"]
  20.   , ",": ["0648", ","]
  21.   , ".": ["0632", "."]
  22.   , "/": ["0638", "061F"]
  23.   , ";": ["0643", ":"]
  24.   , "[": ["062C", "<"]
  25.   , "\": ["0630", "|"]
  26.   , "]": ["062F", ">"]
  27.   , "``": ["0630", "0651"]
  28.   , "A": ["0634", "0650"]
  29.   , "B": ["06440627", "06440622"]
  30.   , "C": ["0624", "0650"]
  31.   , "D": ["064A", "]"]
  32.   , "E": ["062B", "064F"]
  33.   , "F": ["0628", "["]
  34.   , "G": ["0644", "06440623"]
  35.   , "H": ["0627", "0623"]
  36.   , "I": ["0647", "00F7"]
  37.   , "J": ["062A", "0640"]
  38.   , "K": ["0646", "060C"]
  39.   , "L": ["0645", "/"]
  40.   , "M": ["0629", "2019"]
  41.   , "N": ["0649", "0622"]
  42.   , "O": ["062E", "00D7"]
  43.   , "P": ["062D", "061B"]
  44.   , "Q": ["0636", "064E"]
  45.   , "R": ["0642", "064C"]
  46.   , "S": ["0633", "064D"]
  47.   , "T": ["0641", "06440625"]
  48.   , "U": ["0639", "2018"]
  49.   , "V": ["0631", "064D"]
  50.   , "W": ["0635", "064B"]
  51.   , "X": ["0621", "0652"]
  52.   , "Y": ["063A", "0625"]
  53.   , "Z": ["0626", "~"]}
  54. for k, v in map {
  55.   loop 2 {
  56.     if (strlen(v[a_index]) == 4) {
  57.       v[a_index]:= chr("0x" v[a_index])
  58.     } else if (strlen(v[a_index]) == 8) {
  59.       v[a_index]:= chr("0x" substr(v[a_index], 1, 4)) chr("0x" substr(v[a_index], 5))
  60.     }
  61.   }
  62. }
  63. if (getkeystate("scrolllock", "t"))
  64.   check()
  65. return
  66.  
  67. check() {
  68.   global map
  69.   if (getkeystate("scrolllock", "t")) {
  70.     for k, v in map {
  71.       hotkey, %k%, handler
  72.       hotkey, +%k%, handler
  73.     }
  74.   } else {
  75.     for k, v in map {
  76.       hotkey, %k%, off
  77.       hotkey, +%k%, off
  78.     }
  79.   }
  80. }
  81.  
  82. ~scrolllock::
  83. keywait scrolllock
  84. check()
  85. return
  86.  
  87. handler:
  88. i:= getkeystate("capslock", "t") ^ (substr(a_thishotkey, 1, 1) == "+")
  89. send % map[substr(a_thishotkey, 0)][i + 1]
  90. return
  91.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement