How do I bind emojis to a key?

Get help with using AutoHotkey (v2 or newer) and its commands and hotkeys
SawZaw
Posts: 9
Joined: 05 Nov 2020, 12:00

How do I bind emojis to a key?

Post by SawZaw » 05 Nov 2020, 12:11

basically i want to bind a key so it types an emoji instead of the actual thing
I used this code:
Ins::๐Ÿ˜„
I set it to unicode,
then I got this error:
image.png
image.png (5.71 KiB) Viewed 3928 times
can anyone help me with this?


[Mod edit: Moved to v2 Help.]

gregster
Posts: 9114
Joined: 30 Sep 2013, 06:48

Re: How do I bind emojis to a key?

Post by gregster » 05 Nov 2020, 12:19

Save the script in UTF-8 with BOM encoding.
https://www.autohotkey.com/docs/FAQ.htm#nonascii

i want to bind a key so it types an emoji instead of the actual thing
What are the parentheses for? Like this, AHk thinks it's a function. Edit: Use Send

Code: Select all

Ins::Send ๐Ÿ‘ป

SawZaw
Posts: 9
Joined: 05 Nov 2020, 12:00

Re: How do I bind emojis to a key?

Post by SawZaw » 05 Nov 2020, 12:22

I never did,
Just, copied the emoji, saved as unicode, and it just showed that.

anyways im trying to bind the INS key to an emoji

gregster
Posts: 9114
Joined: 30 Sep 2013, 06:48

Re: How do I bind emojis to a key?

Post by gregster » 05 Nov 2020, 12:24

See above, use Send and UTF8 with BOM. Works here:

Code: Select all

Ins::Send ๐Ÿ‘ป

SawZaw
Posts: 9
Joined: 05 Nov 2020, 12:00

Re: How do I bind emojis to a key?

Post by SawZaw » 05 Nov 2020, 12:25

also, I dont have Unicode with BOM
I'm on windows 7

only things I can save it as are

ANSI
Unicode
Unicode big endian
UTF-8


Unless you're talking about something else,
If so, how do I safe it as UTF-8 with BOM

gregster
Posts: 9114
Joined: 30 Sep 2013, 06:48

Re: How do I bind emojis to a key?

Post by gregster » 05 Nov 2020, 12:26

Normal Notepad should have it. Try UTF-8 - perhaps it's the correct one.
Win7 is not a problem.

SawZaw
Posts: 9
Joined: 05 Nov 2020, 12:00

Re: How do I bind emojis to a key?

Post by SawZaw » 05 Nov 2020, 12:27

did normal notepad, and i did utf-8 and did the exact thing you said
but it just shows this error:
Attachments
image.png
image.png (7.87 KiB) Viewed 3910 times

gregster
Posts: 9114
Joined: 30 Sep 2013, 06:48

Re: How do I bind emojis to a key?

Post by gregster » 05 Nov 2020, 12:29

Still the wrong encoding. Try a more advanced editor.

btw, did you make sure to exit old script versions and to only run the new?

SawZaw
Posts: 9
Joined: 05 Nov 2020, 12:00

Re: How do I bind emojis to a key?

Post by SawZaw » 05 Nov 2020, 12:29

what do you mean
im confused

gregster
Posts: 9114
Joined: 30 Sep 2013, 06:48

Re: How do I bind emojis to a key?

Post by gregster » 05 Nov 2020, 12:34

That's a warning anyway, not an error - but it looks odd.
Please show your complete code and tell us which AHK version you are using: msgbox % A_AHKversion

I meant, don't run more than one script version of this at the same time. Close old instances first (please look in the system tray, then right-click > Exit).

SawZaw
Posts: 9
Joined: 05 Nov 2020, 12:00

Re: How do I bind emojis to a key?

Post by SawZaw » 05 Nov 2020, 12:41

code i used was Ins::Send ๐Ÿ‘ป and i saved it as a utf-8 and i downloaded AHK as a zip file, the zip name was: AutoHotkey_2.0-a122-f595abc2
( the code u sent that supposed to tell me the version had an error)

gregster
Posts: 9114
Joined: 30 Sep 2013, 06:48

Re: How do I bind emojis to a key?

Post by gregster » 05 Nov 2020, 12:46

well, then you are trying to use AHK's alpha version (v2), not the latest stable release 1.1.33.02 - but you were trying v1 code.

That explains it - it's not really backwards compatible. Either use version 1.1.33.02 (or older), or use AHK v2 instead.
I am just guessing the v2 syntax, not tested:

Code: Select all

Ins::Send "๐Ÿ‘ป"

SawZaw
Posts: 9
Joined: 05 Nov 2020, 12:00

Re: How do I bind emojis to a key?

Post by SawZaw » 05 Nov 2020, 12:48

gregster wrote: โ†‘
05 Nov 2020, 12:46
well, then you are trying to use AHK's alpha version (v2), not the latest stable release 1.1.33.02 - but you were trying v1 code.

That explains it - it's not really backwards compatible. Either use version 1.1.33.02 (or older), or use AHK v2 instead.
I am just guessing here the v2 syntax, not tested:

Code: Select all

Ins::Send "๐Ÿ‘ป"

tysm!
the code:

Ins::Send "๐Ÿ‘ป"

worked!

gregster
Posts: 9114
Joined: 30 Sep 2013, 06:48

Re: How do I bind emojis to a key?

Post by gregster » 05 Nov 2020, 12:51

Cool :thumbup: , here are the v2 docs for further reference: https://lexikos.github.io/v2/docs/AutoHotkey.htm

SawZaw
Posts: 9
Joined: 05 Nov 2020, 12:00

Re: How do I bind emojis to a key?

Post by SawZaw » 05 Nov 2020, 12:57

this is exactly what i wanted:

Ins::Send "๐Ÿ˜„"
Home::Send "๐Ÿ˜‚"
PgUp::Send "๐Ÿ˜‰"
del::send "๐Ÿ˜Š"
end::send "๐Ÿ˜"
pgdn::send "๐Ÿ˜˜"
numpad7::send "๐Ÿ˜‹"
numpad8::send "๐Ÿค”"
numpad9::send "๐Ÿ˜"
numpad4::send "๐Ÿ˜”"
numpad5::send "๐Ÿ˜ณ"
numpad6::send "๐Ÿ˜ญ"
numpad1::send "๐Ÿ˜ค"
numpad2::send "๐Ÿ˜–"
numpad3::send "๐Ÿ˜ก"
numpad0::send "๐Ÿ˜Ž"

and it works! tysm

SawZaw
Posts: 9
Joined: 05 Nov 2020, 12:00

Re: How do I bind emojis to a key?

Post by SawZaw » 05 Nov 2020, 13:04

emoji test:

๐Ÿ˜„๐Ÿ˜‚๐Ÿ˜‰๐Ÿ˜Š๐Ÿ˜๐Ÿ˜˜๐Ÿ˜‹๐Ÿค”๐Ÿ˜๐Ÿ˜”๐Ÿ˜ณ๐Ÿ˜ญ๐Ÿ˜ค๐Ÿ˜–๐Ÿ˜ก๐Ÿ˜Ž

๐Ÿ˜‰๐Ÿค”๐Ÿ˜Ž๐Ÿ˜˜๐Ÿ˜„๐Ÿ˜‚๐Ÿ˜‰๐Ÿ˜˜๐Ÿ˜–๐Ÿ˜„๐Ÿค”๐Ÿ˜‚๐Ÿ˜˜๐Ÿ˜ค๐Ÿ˜„๐Ÿ˜‚๐Ÿ˜ค๐Ÿ˜ณ๐Ÿ˜˜๐Ÿค”๐Ÿ˜ณ๐Ÿ˜‰๐Ÿ˜„๐Ÿ˜‚๐Ÿ˜”๐Ÿ˜˜๐Ÿ˜‰๐Ÿ˜„๐Ÿ˜‚๐Ÿ˜„๐Ÿ˜˜๐Ÿ˜‚๐Ÿ˜‰๐Ÿ˜˜๐Ÿ˜„๐Ÿ˜‰๐Ÿ˜‚๐Ÿ˜‰๐Ÿ˜„๐Ÿ˜˜๐Ÿ˜˜๐Ÿ˜‚๐Ÿ˜‰๐Ÿ˜„๐Ÿ˜‰๐Ÿ˜˜๐Ÿ˜‚๐Ÿ˜”

Post Reply

Return to โ€œAsk for Help (v2)โ€