Autohotkey Replace 2 specific character with one

廉价感情. 提交于 2019-12-20 07:35:08

问题


I am beginner with autohotkey.
I wanted make script which checks if I write ":)" and then it replaces with this "😊" (emoji in web.whatsapp) I dont know if it's possible to do using GetKeyState because in my keyboard I need Shift+dot for ":" and Shift+9 for ")".

I am sorry about my bad english. Hope you understand. :)

Thank you.

Code that works (thank Forivin)

:::)::
    clipSave := ClipboardAll
    Clipboard := "😊" ;
    Send, ^v
    Clipboard := clipSave
Return

:::D::
    clipSave := ClipboardAll
    Clipboard := "😂" ;
    Send, ^v
    Clipboard := clipSave
Return

回答1:


This works for me:

:::)::
    clipSave := ClipboardAll
    Clipboard := "😊" ;make sure this actually contains the smiley character, once you copied that into your notepad application
    Send, ^v
    Clipboard := clipSave
Return

:::(::
    clipSave := ClipboardAll
    Clipboard := "😢" ;make sure this actually contains the smiley character, once you copied that into your notepad application
    Send, ^v
    Clipboard := clipSave
Return

Make sure to save your file with the correct encoding (UTF-8 did the job for me). You may wanna use something like Notepad++ for that.
It might also help to install the unicode version Autohotkey. (I use the latest 32bit Unicode version of AHK_L.)




回答2:


What you are looking for is Hotstrings.

Example:

:::)::😊

Basically surrounding your statement with :: followed by what you want to replace it with.



来源:https://stackoverflow.com/questions/32331931/autohotkey-replace-2-specific-character-with-one

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!