Follow up question to the extra on using emojis safely

thanks for this helpful article - have just dropped the emojis from my database names.;-). a follow up question though as this is not addressed in the article: is it safe to use emojis in the names of smart groups and smart rules? thanks!..

Generally, yes as they usually only exist within the confines of DEVONthink. However, if you have a smart group or rule you want to export, I would not use an emoji.

1 Like

May I ask - I recently came across this advice

is there any way I can search my databases for file names that contain emoji characters? I can’t remember if I have named files with emoji…

Without knowing the used emojis that’s impossible without using a script that checks whether the filename contains any emoji.

For example:

(() => {
  const app = Application("DEVONthink 3");
// Regular Expression matching Emojis
  const emojiRE = new RegExp(/\p{Extended_Pictographic}/u);
// Collect all documents containing an emoji in their name in the 
// array 'emojiFiles'
  const emojiFiles = app.currentDatabase().contents().filter(r => emojiRE.test(;
// Loop over all elements of the array 'emojiFiles' and add the tag
// 'Emoji-Found' to them.
  emojiFiles.forEach(r => r.tags = r.tags().concat('Emoji-Found'));

That JavaScript code sets the tag Emoji-Found for all documents containing an emoji in the name in the currently selected database. Hopefully, because I never quite get if it’s contents() or records() to get all records of a database. But in this case, it might not matter if it finds groups as well as normal documents.

If the conditions of smart rules offered a scan name entry, the script wouldn’t be necessary. Perhaps a feature request … But perhaps that would slow smart rules down too much?

1 Like

Thank you so much - so do I use this script as part of a smaller file? What do I make as the test conditions to apply this?

The script works on all documents in the currently open database. You can

  • copy & paste it into script editor and run it from there (having set its language selector to JavaScript first!)
  • or copy/paste it into a file and execute that in terminal with osascript -l JavaScript filename
1 Like

ok thanks but what do I use at the initial condition for the smart rule eg “all matches operators and wildcards”?

I didn’t say anything about a smart rule, did I? Expressly not. Because it makes no sense here.

Instead, I said that “it works on the currently open database”. All of it. No point in using a smart rule if you want to handle all documents. Which is necessary since you don’t know where the emojis might be hiding.

Thanks ok… this is all pretty new to me