Advertisement
Guest User

Untitled

a guest
Jun 8th, 2020
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #SingleInstance force
  2. #InstallKeybdHook
  3. #InstallMouseHook
  4.  
  5. SetWorkingDir %A_ScriptDir%
  6.  
  7.  
  8.  
  9.  
  10. ; MyScript 0.1
  11. /*
  12. клавиши:
  13. ДВОЙНОЕ нажатие win — запуск диспетчера задач
  14. alt + - — вставка длинного тире
  15.  
  16.  
  17.  
  18.  
  19. */
  20. ;===================================================================
  21.  
  22.  
  23.  
  24.  
  25.  
  26.  
  27.  
  28.  
  29.  
  30.  
  31. ;CONST
  32. global iniFileName := "MyKeysScript.ini"
  33. global mode := "standart"
  34.  
  35.  
  36. ;замена двух слешей рядом с шифт и ввод на их дубли.
  37. ;sc56h::LShift
  38.     return
  39. ;sc2Bh::Enterf
  40.     return
  41. ; а если нужно их вставить, используем альт \
  42. ;~LWin & sc2Bh:: SendInput {ASC 092}
  43.     Return
  44.     ;а если нужно их вставить, используем альт |
  45. ;~RWin & sc2Bh:: SendInput {ASC 124}
  46.     Return
  47.  
  48.  
  49. ;~Alt & sc56h:: SendInput {ASC 124}
  50.     Return
  51.  
  52.  
  53.  
  54. ; вставка кавычек ==========================================================================
  55.  
  56. ;1 , - вставка елочек «»
  57. ~Alt & vkBC:: SendInput, {ASC 0171}{ASC 0187}{Left}
  58.     Return
  59.  
  60. ; . - вставка елочек «»
  61. ~Alt & vkBE:: SendInput {ASC 0171}{ASC 0187}{Left}
  62.     Return
  63.  
  64. ; ' - вставка двойных кавычек ""
  65. ~Alt & vkDE:: SendInput {ASC 34}{ASC 34}{Left}
  66.     Return
  67.  
  68. ;==========================================================================
  69. ; вставка длинного тире (альт + минус)
  70. ~Alt & vkBD:: SendInput, {ASC 0151}
  71. Return
  72.  
  73. ;==========================================================================
  74. ; ДВОЙНОЕ нажатие windows — запуск диспетчера задач
  75. ~LWin::
  76. {
  77.   if (A_PriorHotkey <> "~LWin" or A_TimeSincePriorHotkey > 230)
  78.   {
  79.     ;ожидать, пока клавиша не будет отпущена (чтобы исключить срабатывание от простого удержания нажатой клавиши)
  80.     KeyWait, LWin
  81.     Return
  82.   }
  83.   KeyWait, LWin
  84.   Run taskmgr.exe
  85.   Return
  86. }
  87. ~RWin::
  88. {
  89.   if (A_PriorHotkey <> "~RWin" or A_TimeSincePriorHotkey > 230)
  90.   {
  91.     ;ожидать, пока клавиша не будет отпущена (чтобы исключить срабатывание от простого удержания нажатой клавиши)
  92.     KeyWait, RWin
  93.     Return
  94.   }
  95.   KeyWait, RWin
  96.   Run taskmgr.exe
  97.   Return
  98. }
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108. ;==========================================================================
  109. ; переключение режима капслук по win + capslock
  110.  
  111.  
  112.  
  113.    
  114.     ;сочетания капслук + ...
  115.  
  116. #NoEnv
  117.  
  118. #If GetKeyState("CapsLock", "P")
  119.    
  120.     ; мультимедиа клавиши капс+f5-f8
  121.     ; регулировка громкости капс и стрелки вверх, вниз.
  122.  
  123.     UP:: ; /? keycode insert /
  124.         send, {Volume_Up}
  125.         return
  126.     Down:: ; /? keycode insert /
  127.         send, {Volume_Down}
  128.         return
  129.        
  130.     Numpad0:: ; /? keycode insert /
  131.         send, {Volume_Mute}
  132.         return
  133.        
  134.        
  135.     vk30:: ; /? keycode insert /
  136.         send, ->
  137.         return
  138.    
  139.    
  140.     vkBF:: ; /? keycode insert /
  141.         send, {ASC 47}
  142.         return
  143.        
  144.        
  145.     ; insert |
  146.     ;sc2Bh::
  147.         SendInput {ASC 124}
  148.         return
  149.        
  150.        
  151.    
  152.     vk4E:: ; n keycode
  153.         SendInput,  {ctrl down}
  154.        
  155.        
  156.         SendInput, {left}
  157.        
  158.         SendInput, {Ctrl up}
  159.         return 
  160.        
  161.         vkBE:: ; >. keycode
  162.             SendInput,  {ctrl down}
  163.        
  164.            
  165.             SendInput, {Right}
  166.            
  167.             SendInput, {Ctrl up}
  168.             return
  169.    
  170.    
  171.    
  172.     ;vim-подобная навигация h - left, j - down, k - up, l - right
  173.     vk48:: ; h keycode
  174.         send {left}
  175.         return
  176.    
  177.     vk4C:: ; l keycode
  178.         send {right}
  179.             return
  180.    
  181.     vk4B:: ; k keycode
  182.         send {up}
  183.         return
  184.    
  185.     vk4a:: ;j keycode
  186.         Send {Down}
  187.         Return
  188.    
  189.    
  190.     ; sending escape
  191.     vk50:: ; P keycode
  192.             SendInput {Ctrl down}
  193.         SendInput, {Shift down}
  194.        
  195.         SendInput {Right}
  196.        
  197.        
  198.         SendInput, {shift up}
  199.         SendInput, {ctrl up}
  200.         return
  201.  
  202.    
  203.     ;раскрывание списка (аналог альт+стрелка вниз)
  204.      vk20:: ; space keycode
  205.         send {Lalt down}
  206.          sleep, 64
  207.         send, {down}
  208.         sleep, 64
  209.         send {Lalt up}
  210.         return
  211.  
  212.  
  213.     ;раскрывание списка (аналог альт+стрелка вниз)
  214.      vk55:: ; u keycode
  215.         SendInput {Ctrl down}
  216.         SendInput, {Shift down}
  217.        
  218.         SendInput {Left}
  219.        
  220.        
  221.         SendInput, {shift up}
  222.         SendInput, {ctrl up}
  223.         return
  224.        
  225.        
  226.        
  227.         vk49:: ; I keycode
  228.        
  229.         SendInput, {shift down}
  230.         SendInput, {up}
  231.         SendInput {shift up}
  232.        
  233.        
  234.         return
  235.         vk4F:: ; O keycode
  236.        
  237.         SendInput, {shift down}
  238.         SendInput, {down}
  239.         SendInput {shift up}
  240.        
  241.        
  242.         return
  243.  
  244.  
  245.  
  246.  
  247.     ;вставка даты и времени 19.06.2015_22:30
  248.     vk54:: ; t keycode
  249.    
  250.         if (mode = "standart")
  251.         {
  252.             FormatTime, DateString,,  ShortDate
  253.             FormatTime, TimeString,,  Time
  254.             send %DateString%_%TimeString%{Space}
  255.         }
  256.  
  257.  
  258.         if (mode = "apprun")
  259.         {
  260.             Run, "c:\!my_files\apps\sys\sys_filemanagers\TC_8.51a_x86\totalcmd.exe"
  261.    
  262.         }
  263.        
  264.     return
  265.        
  266.     ; wasd - навигация home end pageup pagedown
  267.     ;w
  268.     vk57:: SendInput {PgUp}
  269.     Return
  270.  
  271.     ;s
  272.     vk53:: SendInput {PgDn}
  273.         Return
  274.  
  275.     ;a
  276.     vk41:: SendInput {Home}
  277.         Return
  278.    
  279.     ;d
  280.     vk44:: SendInput {End}
  281.         Return
  282.    
  283.     ; c
  284.     vk43:: run, calc.exe
  285.     return
  286.  
  287.  
  288.     ; переключение режимов клавиш
  289.     ;numpad0
  290.     vk60::
  291.         TrayTip, Current keys mode is %mode%,                 ,     5,  33
  292.         return
  293.     Numpad1::
  294.         mode := "standart"
  295.         TrayTip, Keys mode is %mode%,   Mode keys is changed. ,     5,  33
  296.         return
  297.  
  298.     Numpad2::
  299.         mode := "apprun"
  300.         TrayTip, Keys mode is %mode%,   Mode keys is changed. ,     5,  33
  301.         return
  302.  
  303.  
  304.  
  305.  
  306. /*
  307.  
  308.  
  309. */
  310.    
  311.   ;-------------------------------------------------------------
  312.   ; капс +  таб - неразрывный абзац.
  313.   tab:: SendInput {ASC 255}{ASC 255}{ASC 255}{ASC 255}
  314.  
  315.  
  316.  
  317. #if
  318.  
  319.  
  320. ~Lwin & CapsLock:: SetCapsLockState, % GetKeyState("Capslock", "T") ? "Off" : "On"
  321.  
  322. ;------------------------------------------------------
  323. ;Переключение языка по капслук
  324. $CapsLock::
  325. {
  326.  
  327.     LangSwitch(1)
  328.     return
  329. }
  330. $CapsLock up::
  331. {
  332.    
  333.   LangSwitch(2)
  334.   Return
  335. }
  336.  
  337. ; реверс ВЫДЕKЕННОГО текста
  338. ~LAlt & CapsLock::
  339. {
  340.   LangSwitch(2)
  341.   sleep, 50
  342.   RecodeTextENRU()
  343.   Return
  344. }
  345.  
  346. ; реверс последнего слова
  347.  
  348. ; удаление последнего слова. Иногда контрл+бэкспейс вместо удаления слова вставляет нечитаемый символ.
  349. ~Ctrl & backspace::
  350. {
  351.  
  352.   SendInput, {Ctrl down}+{Shift down}+{left}
  353.   SendInput, {Ctrl up}
  354.   SendInput, {Shift up}
  355.  
  356.   sendInput, {delete}
  357.   return
  358. }
  359.  
  360. ; реверс раскладки последнего слова
  361. ~RAlt & CapsLock::
  362. {
  363.  
  364.   SendInput, {Ctrl down}+{Shift down}+{left}
  365.   SendInput, {Ctrl up}
  366.   SendInput, {Shift up}
  367.  
  368.   LangSwitch(2)
  369.   sleep, 50
  370.   RecodeTextENRU()
  371.  
  372.   Return
  373. }
  374.  
  375. ;----------------------------------------------------
  376. ;Реверс всего текста неверной раскладки по левый контрол+ капслук
  377. LControl & CapsLock::
  378. {
  379.     SendInput, ^{sc01E}
  380.     LangSwitch(1)
  381.     sleep, 50
  382.     RecodeTextENRU()
  383.     Return
  384. }
  385.  
  386.  
  387.  
  388.  
  389. ;переключение языка
  390. LangSwitch( iKeyDownUp=0 )
  391. {
  392.     ; если капслук зажат больше 180 милисекунд то не переключаем язык
  393.     static tickLast
  394.     IfEqual, iKeyDownUp, 1
  395.     {  
  396.         tickLast=%A_TickCount%
  397.         return
  398.     }
  399.     IfEqual,iKeyDownUp,2
  400.         If(A_TickCount-tickLast>180)
  401.             return
  402.    
  403.     ; читаем настройки секции изменения языка, параметр «method»
  404.     ;       MsgBox, langchangemeghod "%langChangeMethod%"
  405. ;       MsgBox, workDir "%A_WorkingDir%"
  406.     ;   MsgBox, inifilename "%iniFileName%"
  407.     IfExist %A_WorkingDir%\%iniFileName%
  408.     {
  409.         IniRead, langChangeMethod, %A_WorkingDir%\%iniFileName%, CHANGE LANG, method
  410.  
  411.  
  412.         ; MsgBox, %A_WorkingDir%\%iniFileName%
  413.     }
  414.    
  415.  
  416.     If (langChangeMethod == "alt+shift")
  417.     {
  418.         ;MsgBox, "altshift"
  419.         SendInput, {LAlt down}
  420.         SendInput, {LShift}
  421.         sendInput, {LAlt up}
  422.     }
  423.     else
  424.     {
  425.         If (langChangeMethod == "control+shift")
  426.         {
  427.             ;MsgBox, "controlshift"
  428.             SendInput, {LControl down}         
  429.             SendInput, {LShift}
  430.             sendInput, {LControl up}
  431.         }
  432.         else
  433.         {
  434.             If (langChangeMethod == "win+space")
  435.             {          
  436.                 ;MsgBox, "winspace"
  437.                 SendInput, {LWin down}
  438.                 SendInput, {Space}
  439.                 sendInput, {LWin up}
  440.             }
  441.             else
  442.             {
  443.                 TrayTip, Error reading parameter file %iniFileName%,    Switching layout alt+shift,     5,  35
  444.                 SendInput, {LAlt down}
  445.                 SendInput, {LShift}
  446.                 sendInput, {LAlt up}
  447.  
  448.            
  449.             }
  450.         }
  451.     }
  452. }
  453.  
  454.  
  455.  
  456.  
  457. ;реверс текста
  458.  
  459.  
  460. RecodeTextENRU()
  461. {
  462.     StringCaseSense On
  463.     AutoTrim,Off
  464.  
  465.     clipSave:=clipAnsi()
  466.     send ^{Insert}
  467.     sleep,50
  468.  
  469.     dest=
  470.     text:=clipAnsi()
  471.     StringCaseSense,On
  472.     prevCharToEN=0
  473.     ;       АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ
  474.     RUtoEN=F<DULT:PBQRKVYJGHCNEA{WXIO}SM">Zf,dult;pbqrkvyjghcnea[wxio]sm'.z
  475.     RUtoSP1=хъжэбюХЪЖЭБЮ.,/";:?
  476.     RUtoSP2=[];',.{}:"<>/?|@#$^&
  477.     ;"       ABCDEFGHIJKLMNOPQRSTUVWXYZ
  478.     ENtoRU=ФИСВУАПРШОЛДЬТЩЗЙКЫЕГМЦЧНЯфисвуапршолдьтщзйкыегмцчня
  479.  
  480.     loop,parse,text
  481.     {
  482.         destChar=%A_LoopField%
  483.  
  484.         ; check explicit (non punctuations) ranges
  485.         ifGreaterOrEqual,A_LoopField,А
  486.             prevCharToEN=1
  487.         else if A_LoopField between A and Z
  488.             prevCharToEN=0
  489.         else if A_LoopField between a and z
  490.             prevCharToEN=0
  491.  
  492.         ; to Russian
  493.         ifEqual,prevCharToEN,0
  494.         {   StringGetPos,i,RUtoEN,%A_LoopField%
  495.             ifEqual,ErrorLevel,0
  496.                 Transform,destChar,chr,% i + 0xC0
  497.             else
  498.             {   StringGetPos,i,RUtoSP2,%A_LoopField%
  499.                 ifEqual,ErrorLevel,0
  500.                     StringMid,destChar,RUtoSP1,% i+1, 1
  501.             }
  502.         }
  503.  
  504.         ; to English because nothing changed
  505.         ifEqual,destChar,%A_LoopField%
  506.         {
  507.             StringGetPos,i,ENtoRU,%A_LoopField%
  508.             ifEqual,ErrorLevel,0
  509.                 Transform,destChar,chr,% i + (i>=26 ? 71 : 65)
  510.             else ; check .,;':"[]{}
  511.             {   StringGetPos,i,RUtoSP1,%A_LoopField%
  512.                 ifEqual,ErrorLevel,0,StringMid,destChar,RUtoSP2,% i+1, 1
  513.             }
  514.             ifNotEqual,destChar,%A_LoopField%
  515.                 prevCharToEN=1
  516.         }
  517.         dest=%dest%%destChar%
  518.     }
  519.  
  520.     ; decide compatibility of unicode clipboard
  521.     WinGetClass,cls,A
  522.     if cls in TMsgEditor,wndclass_desked_gsk
  523.     {
  524.         ControlGetFocus,cls,A
  525.         ifInString,cls,TXTRichEdit
  526.             clipSetUnicode(dest)
  527.         else
  528.             Clipboard=%dest%
  529.     }
  530.     else
  531.         clipSetUnicode(dest)
  532.     sleep,50
  533.     send +{Insert}
  534.     sleep 50
  535.  
  536.     clipSetUnicode(clipSave)
  537.     LangSwitch()
  538. }
  539.  
  540. ; read unicode clipboard into ansi string
  541. clipAnsi()
  542. {
  543.     StringLen,L,Clipboard
  544.     L:=(L+1)*4
  545.     transform,ca_Clip,unicode
  546.     varSetCapacity(ca_WideText,L,0)
  547.     varSetCapacity(ca_AnsiText,L,0)
  548.     ; Convert UTF-8 to UTF-16.  CP_UTF8=65001
  549.     if dllCall("MultiByteToWideChar",uint,65001, uint,0, str,ca_Clip
  550.                   , uint,-1, str,ca_WideText, uint,L/2)
  551.         dllCall("WideCharToMultiByte",uint,0, uint,0, str,ca_WideText
  552.                   , uint,-1, str,ca_AnsiText, uint,L/2, uint,0, uint,0)
  553.         ; Convert UTF-16 to ANSI.  CP_ACP=0
  554.     return ca_AnsiText
  555. }
  556.  
  557. ;--------------------------------------------------------------
  558. ; copy ansi string to clipboard in unicode mode
  559. clipSetUnicode(cu_AnsiText)
  560. {
  561.     StringLen,L,cu_AnsiText
  562.     L:=(L+1)*4
  563.     varSetCapacity(cu_WideText,L,0)
  564.     varSetCapacity(cu_UTFtext,L,0)
  565.     ; ANSI to UTF-16.   CP_ACP=0
  566.     if dllCall("MultiByteToWideChar",uint,0, uint,0, str,cu_AnsiText
  567.                   , uint,-1, str,cu_WideText, uint,L/2)
  568.         dllCall("WideCharToMultiByte",uint,65001, uint,0, str,cu_WideText
  569.                   , uint,-1, str,cu_UTFtext, uint,L/2, uint,0, uint,0)
  570.         ; Convert UTF-16 to UTF-8.  CP_UTF8=65001
  571.     transform,clipboard,unicode,%cu_UTFtext%
  572. }
  573.  
  574.  
  575.  
  576.  
  577.  
  578.  
  579.  
  580.  
  581.  
  582.  
  583.  
  584.  
  585. /*
  586.  
  587. rec()
  588. {  
  589.     StringCaseSense On
  590.     AutoTrim,Off
  591.  
  592.     clipSave:=clipAnsi()
  593.     send ^{Insert}
  594.     sleep,50
  595.  
  596.    
  597.    
  598.     /*text:=clipAnsi()
  599.     StringCaseSense,On
  600.     ;Result := DllCall("HelperForAHK.dll\DecodeTextENRU_RUEN", "Str", text)
  601.     ;msgbox, %Result%
  602.    
  603.     arrEN = qwerty
  604.     arrRU = huisob
  605.    
  606.     EN = 0
  607.     RU = 0
  608.    
  609.     ;
  610.      
  611.     loop,parse,text
  612.     {
  613.         currSymb=%A_LoopField%
  614.         ; check EN
  615.      
  616.         loop, parse, arrEN
  617.         {
  618.             chSymb = %A_LoopField%
  619.             if(chSymb= currSymb)               
  620.                 EN := 1
  621.         }
  622.        
  623.         if (EN = 0)
  624.             RU:=1
  625.         ;msgbox, %text%
  626.        
  627.         ; to rus
  628.         if (EN = 1)
  629.         {
  630.            
  631.             loop, parse, text
  632.             {
  633.                 cs = %A_LoopField%
  634.                 if (cs = currSymb)
  635.                 {
  636.                     StringGetPos, i, arrEN, %cs%
  637.                     StringMid, newstr, arrRU, i,  i+1
  638.                     dest=%dest%%newstr%
  639.                     break
  640.                 }
  641.             }
  642.             break_outer:   
  643.         }
  644.    
  645.     }
  646.  
  647.    
  648.    
  649.     ; decide compatibility of unicode clipboard
  650.     WinGetClass,cls,A
  651.     if cls in TMsgEditor,wndclass_desked_gsk
  652.     {
  653.         ControlGetFocus,cls,A
  654.         ifInString,cls,TXTRichEdit
  655.             clipSetUnicode(dest)
  656.         else
  657.             Clipboard=%dest%
  658.     }
  659.     else
  660.         clipSetUnicode(dest)
  661.     sleep,50
  662.     send +{Insert}
  663.     sleep 50
  664.  
  665.     clipSetUnicode(clipSave)
  666.     LangSwitch()   
  667.    
  668.  
  669. }
  670.  
  671. RecodeTextENRU()
  672. {
  673.     StringCaseSense On
  674.     AutoTrim,Off
  675.  
  676.     clipSave:=clipAnsi()
  677.     send ^{Insert}
  678.     sleep,50
  679.     text:=clipAnsi()
  680.     runwait, HelperForAHK_c.exe "%text%" ,PIDD
  681.     sleep, 1
  682.     FileRead, dest, buf
  683. /*  text:=clipAnsi()
  684.     StringCaseSense,On
  685.     prevCharToEN=0
  686.     ;       АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ
  687.     RUtoEN=F<DULT:PBQRKVYJGHCNEA{WXIO}SM"">Zf,dult;pbqrkvyjghcnea[wxio]sm'.z
  688.     RUtoSP1=хъжэбюХЪЖЭБЮ.,/""№`;:?
  689.     RUtoSP2=[]`;',.{}:""<>/?|@#$^&
  690.     ;"       ABCDEFGHIJKLMNOPQRSTUVWXYZ
  691.     ENtoRU=ФИСВУАПРШОЛДЬТЩЗЙКЫЕГМЦЧНЯфисвуапршолдьтщзйкыегмцчня
  692.  
  693.     loop,parse,text
  694.     {
  695.         destChar=%A_LoopField%
  696.         ;msgbox, %destChar%
  697.         ; check explicit (non punctuations) ranges
  698.         ifGreaterOrEqual,A_LoopField,А
  699.             prevCharToEN=1
  700.         else if A_LoopField between A and Z
  701.             prevCharToEN=0
  702.         else if A_LoopField between a and z
  703.             prevCharToEN=0
  704.  
  705.         ; to Russian
  706.         ifEqual,prevCharToEN,0
  707.         {   StringGetPos,i,RUtoEN,%A_LoopField%
  708.             ifEqual,ErrorLevel,0
  709.                 Transform,destChar,chr,% i + 0xC0
  710.             else
  711.             {   StringGetPos,i,RUtoSP2,%A_LoopField%
  712.                 ifEqual,ErrorLevel,0
  713.                     StringMid,destChar,RUtoSP1,% i+1, 1
  714.             }
  715.         }
  716.  
  717.         ; to English because nothing changed
  718.         ifEqual,destChar,%A_LoopField%
  719.         {
  720.             StringGetPos,i,ENtoRU,%A_LoopField%
  721.             ifEqual,ErrorLevel,0
  722.                 Transform,destChar,chr,% i + (i>=26 ? 71 : 65)
  723.             else ; check .,;':"[]{}
  724.             {   StringGetPos,i,RUtoSP1,%A_LoopField%
  725.                 ifEqual,ErrorLevel,0,StringMid,destChar,RUtoSP2,% i+1, 1
  726.             }
  727.             ifNotEqual,destChar,%A_LoopField%
  728.                 prevCharToEN=1
  729.         }
  730.         dest=%dest%%destChar%
  731.     }
  732.  
  733.     ; decide compatibility of unicode clipboard
  734.     ;msgbox, %dest%
  735.     WinGetClass,cls,A
  736.     if cls in TMsgEditor,wndclass_desked_gsk
  737.     {
  738.         ControlGetFocus,cls,A
  739.         ifInString,cls,TXTRichEdit
  740.             clipSetUnicode(dest)
  741.         else
  742.             Clipboard=%dest%
  743.     }
  744.     else
  745.         clipSetUnicode(dest)
  746.     sleep,50
  747.     send +{Insert}
  748.     sleep 50
  749.  
  750.     clipSetUnicode(clipSave)
  751.     LangSwitch()
  752. }
  753.  
  754. ; read unicode clipboard into ansi string
  755. clipAnsi()
  756. {
  757.     StringLen,L,Clipboard
  758.     L:=(L+1)*4
  759.     transform,ca_Clip,unicode
  760.     varSetCapacity(ca_WideText,L,0)
  761.     varSetCapacity(ca_AnsiText,L,0)
  762.     ; Convert UTF-8 to UTF-16.  CP_UTF8=65001
  763.     if dllCall("MultiByteToWideChar",uint,65001, uint,0, str,ca_Clip
  764.                   , uint,-1, str,ca_WideText, uint,L/2)
  765.         dllCall("WideCharToMultiByte",uint,0, uint,0, str,ca_WideText
  766.                   , uint,-1, str,ca_AnsiText, uint,L/2, uint,0, uint,0)
  767.         ; Convert UTF-16 to ANSI.  CP_ACP=0
  768.     return ca_AnsiText
  769. }
  770.  
  771. clipSetUnicode(cu_AnsiText)
  772. {
  773.     StringLen,L,cu_AnsiText
  774.         L:=(L+1)*4
  775.     varSetCapacity(cu_WideText,L,0)
  776.     varSetCapacity(cu_UTFtext,L,0)
  777.     ; ANSI to UTF-16.   CP_ACP=0
  778.     if dllCall("MultiByteToWideChar",uint,0, uint,0, str,cu_AnsiText
  779.                   , uint,-1, str,cu_WideText, uint,L/2)
  780.         dllCall("WideCharToMultiByte",uint,65001, uint,0, str,cu_WideText
  781.                   , uint,-1, str,cu_UTFtext, uint,L/2, uint,0, uint,0)
  782.         ; Convert UTF-16 to UTF-8.  CP_UTF8=65001
  783.     transform,clipboard,unicode,%cu_UTFtext%
  784. }
  785. */
  786.  
  787.  
  788.  
  789.  
  790. ; пользовательские замены.
  791. ::тд ::так далее
  792. ::тд.::так далее.
  793. ::тд,::так далее,
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement