Advertisement
0xNOP

[AutoIt] Text To Regional Indicator

Apr 21st, 2017
591
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
AutoIt 3.21 KB | None | 0 0
  1. #cs ----------------------------------------------------------------------------
  2.  
  3.  AutoIt Version: 3.3.15.0 (Beta)
  4.  Author:         0xNOP
  5.  
  6.  Script Function:
  7.     Converts normal text into its regional indicator representation.
  8.     e.g. Turn 'sexy' into  :regional_indicator_s: :regional_indicator_e: :regional_indicator_x: :regional_indicator_y:
  9.  
  10.  Script Usage:
  11.     Simply highlight a text, then press Alt + S (make sure if you run this inside a program, it doesn't interfere with the programs hotkeys.)
  12.  
  13. #ce ----------------------------------------------------------------------------
  14.  
  15. ; Script Start - Add your code below here
  16.  
  17.  
  18. Global $g_bPaused = False
  19.  
  20. HotKeySet("{PAUSE}", "HotKeyPressed")
  21. HotKeySet("{ESC}", "HotKeyPressed")
  22. HotKeySet("!s", "HotKeyPressed")
  23.  
  24. While 1
  25.     Sleep(100)
  26. WEnd
  27.  
  28. Func HotKeyPressed()
  29.     Switch @HotKeyPressed
  30.         Case "{PAUSE}"
  31.             $g_bPaused = Not $g_bPaused
  32.             While $g_bPaused
  33.                 Sleep(100)
  34.                 ToolTip('Script is "Paused"', 0, 0)
  35.             WEnd
  36.             ToolTip("")
  37.  
  38.         Case "{ESC}"
  39.             Exit
  40.  
  41.         Case "!s"
  42.             doTxt2RegionalCode()
  43.  
  44.     EndSwitch
  45. EndFunc   ;==> HotKeyPressed
  46.  
  47. Func doTxt2RegionalCode()
  48.       Send("^x")
  49.       $string = ClipGet()
  50.       $length = StringLen($string)
  51.       $char = ''
  52.       $result = ""
  53.  
  54.    For $i = 1 To $length
  55.   $char = StringLower(StringMid($string, $i, 1))
  56. if($char == 'a') Then
  57.       $result &= ":regional_indicator_a: "
  58.     ElseIf($char == 'b') Then
  59.       $result &= ":regional_indicator_b: "
  60.     ElseIf($char == 'c') Then
  61.      $result &= ":regional_indicator_c: "
  62.     ElseIf($char == 'd') Then
  63.      $result &= ":regional_indicator_d: "
  64.     ElseIf($char == 'e') Then
  65.      $result &= ":regional_indicator_e: "
  66.     ElseIf($char == 'f') Then
  67.      $result &= ":regional_indicator_f: "
  68.     ElseIf($char == 'g') Then
  69.      $result &= ":regional_indicator_g: "
  70.     ElseIf($char == 'h') Then
  71.      $result &= ":regional_indicator_h: "
  72.     ElseIf($char == 'i') Then
  73.      $result &= ":regional_indicator_i: "
  74.     ElseIf($char == 'j') Then
  75.      $result &= ":regional_indicator_j: "
  76.     ElseIf($char == 'k') Then
  77.      $result &= ":regional_indicator_k: "
  78.     ElseIf($char == 'l') Then
  79.      $result &= ":regional_indicator_l: "
  80.     ElseIf($char == 'm') Then
  81.      $result &= ":regional_indicator_m: "
  82.     ElseIf($char == 'n') Then
  83.      $result &= ":regional_indicator_n: "
  84.     ElseIf($char == 'o') Then
  85.      $result &= ":regional_indicator_o: "
  86.     ElseIf($char == 'p') Then
  87.      $result &= ":regional_indicator_p: "
  88.     ElseIf($char == 'q') Then
  89.      $result &= ":regional_indicator_q: "
  90.     ElseIf($char == 'r') Then
  91.      $result &= ":regional_indicator_r: "
  92.     ElseIf($char == 's') Then
  93.      $result &= ":regional_indicator_s: "
  94.     ElseIf($char == 't') Then
  95.      $result &= ":regional_indicator_t: "
  96.     ElseIf($char == 'u') Then
  97.      $result &= ":regional_indicator_u: "
  98.     ElseIf($char == 'v') Then
  99.      $result &= ":regional_indicator_v: "
  100.     ElseIf($char == 'w') Then
  101.      $result &= ":regional_indicator_w: "
  102.   ElseIf($char == 'x') Then
  103.      $result &= ":regional_indicator_x: "
  104.   ElseIf($char == 'y') Then
  105.      $result &= ":regional_indicator_y: "
  106.   ElseIf($char == 'z') Then
  107.      $result &= ":regional_indicator_z: "
  108.   EndIf
  109.  
  110.   ClipPut($result)
  111. Next
  112. Send("^v")
  113. EndFunc ; ==> doTxt2RegionalCode
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement