Emoji Extension snippet

I wanted an extension that would save me a few clicks and insert an Apple emoji / symbol icon. Simple enough? Sure, but I scoured the forums and couldn’t find one. I wanted to have ‘in a click’ offline use of Apple emojis. So, I did the next best thing, I asked PopClip’s ChatGPT extension to build me one. This is what the ensuing conversation looked like:


Make me a PopClip extension to insert an emoji


As an AI language model, I cannot create PopClip extensions. However, here’s an example of how to create a PopClip extension to insert an emoji on macOS:

1. Open Script Editor on your Mac (You can find it in the Applications > Utilities folder)
2. Select “New Document” and choose “Script” as the document type
3. Paste the following code into the Script Editor:

#!/usr/bin/osascript

on run argv
    set theEmoji to item 1 of argv
    tell application "System Events"
        keystroke theEmoji
    end tell
end run

4. Save the script as “Insert Emoji” in the following path: ~/Library/Application Support/Popclip/Extensions
5. Open PopClip and choose “Customize” from the drop-down menu.
6. Drag and drop the “Insert Emoji” extension from the list of extensions to the PopClip menu
7. To use the extension, select the text you want to replace with an emoji, then click on the PopClip menu and select “Insert Emoji” from the list of options. Choose the emoji you want to insert from the picker.

Note: you can customize the extension by modifying the set theEmoji to item 1 of argv line to insert a specific emoji instead of getting it from the PopClip menu.


Your instructions are faulty. There is no way to choose “Customize” from the drop-down menu.


I apologize for any confusion. Without more specific information, it’s difficult to determine what may be causing this issue or provide a clear solution. Can you please provide more context or details about what program or website you are working with and what tasks you are trying to perform? This will help me better assist you.


I initially asked that you “Make me a PopClip extension to insert an emoji” and you replied with this example:

1. Open Script Editor on your Mac (You can find it in the Applications > Utilities folder)
2. Select “New Document” and choose “Script” as the document type
3. Paste the following code into the Script Editor:

#!/usr/bin/osascript

on run argv
    set theEmoji to item 1 of argv
    tell application "System Events"
        keystroke theEmoji
    end tell
end run

4. Save the script as “Insert Emoji” in the following path: ~/Library/Application Support/Popclip/Extensions
5. Open PopClip and choose “Customize” from the drop-down menu.
6. Drag and drop the “Insert Emoji” extension from the list of extensions to the PopClip menu
7. To use the extension, select the text you want to replace with an emoji, then click on the PopClip menu and select “Insert Emoji” from the list of options. Choose the emoji you want to insert from the picker.

But upon review there is no way to choose “Customize” from the drop-down menu.


I apologize for the confusion. It seems that the instructions I provided were for an older version of PopClip. Here are updated instructions for PopClip version 2021.6:

1. Open Script Editor on your Mac (You can find it in the Applications > Utilities folder)
2. Select “New Document” and choose “Script” as the document type
3. Paste the following code into the Script Editor:

#!/usr/bin/osascript

on run argv
    set theEmoji to item 1 of argv
    tell application "System Events"
        keystroke theEmoji
    end tell
end run

4. Save the script as “Insert Emoji” in the following path: ~/Library/Containers/com.pilotmoon.popclip/Data/Library/Application Support/PopClip/Extensions/
5. If PopClip is already open, quit and relaunch it.
6. Click on the PopClip icon in the menu bar and choose “Customize Extensions”
7. Drag and drop the “Insert Emoji” extension from the list of extensions to the PopClip menu
8. To use the extension, select the text you want to replace with an emoji, then click on the PopClip menu and select “Insert Emoji” from the list of options. Choose the emoji you want to insert from the picker.

I hope this helps! Let me know if you have any further questions.


Once again, your instructions are faulty. There is no way to choose “Customize Extensions” from a drop-down menu.

Obviously I will need to ask Nick, the great and powerful developer of PopClip.

Thanks but no thanks.


As an AI language model, I apologize for providing faulty instructions. It is understandable that you would seek assistance from the developer of the program. Thank you for your feedback, and I hope you are able to resolve your issue with PopClip.


Between us @nick my issue is not with your most wonderful PopClip app but rather with ChatGPT being ill informed.

Can you, for us all who are also looking to build this extension, straigten us out?
:wink:

{{ I don’t expect AI to replace you Nick Moore or your deskside manor anytime soon }}

I wanted an extension that would save me a few clicks and insert an Apple emoji / symbol icon

I guess ChatGPT’s first question should have been, which emoji or icon did you want to insert? 'Cos that’s mine :slight_smile:

So @nick how do I get this done? And with the ability to insert into a text document, say, anyone of a dozen of my favorite emojis?

#popclip
name: Paste Symbol
requirements: []
actions:
- { title: "😀", javascript: popclip.pasteText("😀") }
- { title: "±", javascript: popclip.pasteText("±") }

(The above block is an extension snippet — select it then click “Install Extension” in PopClip.)

1 Like

DAMN NIFTY!

ok, so then, what in the code makes the drop down (triangle) menu?
and how many emojis and/or symbols can I stick in there, on each line?

{{ I am so giddy :stuck_out_tongue_winking_eye: this is swell }}

PS - and how do I slap a popclip extension icon in my Actions Menu again??



UPDATE

I put 12 in there but I’m having a small issue with it… the long line of horizontal emojis, especially if I decide to add more… is there any chance in the .js lines to do a break as is done in html?

ONE

PSS - and is it even possible to put a custom extension icon instead of (or on top of) the triangle UI ‘drop down’ icon?

TWO

1 Like

When I invoke PopClip via shortcut the emojis are not in the popclip bar. Since I want to paste these into text fields, it would be nice if they were available without selecting text.

1 Like

No, it’s not possible to do either of those. But I want to improve PopClip in this aspect soon.

1 Like

Good catch. I’ve edited the code in the original post (added the requirements: [] line so the actions will appear always). So try it again and you should be good.

1 Like

Hi,
Thanks for the idea and explanation of easily inserting often-used emojis. I’ve done it with dedicated shortcuts on my mac but it’s easier to see them… But I have a question, how do I call up the PopClip menu without selecting a text? There are probably several ways of doing this :wink: !?!

Sorry, I found my answer in the new posts ! :wink:
I can add a shortcut to open the PopClip menu, and in this case, only the possible actions without selection are displayed (included so the emojis !) :grinning:

@Ange, you can also call popclip by long pressing the mouse button (0.5 seconds). Or by shift-clicking. Or by double-clicking in an empty field.

:+1:
I didn’t know all these options to do this. Many :pray:t2:.
Allways too great Popclip :grinning:
:innocent:

Ahh gotcha… how about a snippet that will ‘call up’ macOS’s built-in Emoji & Symbols BUT just the “Favorites” pane?

Too crazy, right? For that matter just call it up via a keyboard command, you’re probably thinkin’.

Well, when you do ‘improve on it’ it wouldn’t be a bad thing to use the type of emojis that are available here in your forum!

Screen Shot 2023-07-01 at 9.03.10 PM

Anyhow, be well Nick Moore, you are certainly the wizard of pop :mage:

PS - can you rename my post, so it isn’t misleading to first time readers? Possibly changing “Making an Apple Emoji Extension with ChatGPT” to just “The Making of a Emoji Extension”

1 Like

Hi, with all the replacement features in PopClip, can’t you have a “smart” single PopClip extension that offers the related emoji for a selected text?
I think there exists a default mapping between emojis and related texts as is used in messaging.

Maybe even better that mapping table could exist in PopClip and is “configurable”, so that users can map “their most beloved emojis” to “their most used” specific strings or even phrases?!

Do exist PopClip extensions “with user configuration options”?