问题
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