Is it possible to do batch import of tags into Drafts?

, ,

I have a large list of tags that I wrote in both Agenda and Upnote apps that I would like to transfer to Drafts. Is it possible to do a batch import of tags? If yes, can you point me the way?

I was able to copy them into a draft with the hashtags. However, what I want to do is to be able to just copy and paste them into “tags” so that I have all the tags available in Drafts without having to reenter them one at a time.

Thanks for your tips!

When all drafts with that tag (including ones in the Trash) are gone, the tag will automatically be deleted from any visible filtering lists.

What you can do as a workaround:

  • create a draft and assign all tags you usually use to that draft
  • the downside is that this “dummy draft” will be shown for every tag you filter for as long as you don’t delete it :wink:
  • to automate this you can use the list of tags you already have and write a script to assign all the tags to a draft.
    • I can help you with that if you provide some details about how the “list with the hashtags” looks like

e.g. does your exported list of tags look like this:

#tag1 #tag2 #tag-3 #tag 4

Another solution would be to built a custom “add tag” action for your list of tags - the useability depends on how many tags you use (e.g. you could display all possible tags in a prompt where you can then select all the tags which should be applied to the draft.

I think you are saying you have hashtags in the text of your drafts that you would like converted to be assigned as native tags. This example action from the directory does that, maybe helpful…

Thanks. I presume I can only run these when I’m on a Mac, right?

And yes, you are correct. I already have all the hashtags in a draft. All I would like is for them to be converted to tags.

No you can run actions on any platform :slight_smile:

If your tags are single words the shared action from @agiletortoise will work perfectly.
If you have tags with whitespaces the action will not work as expected

Thanks. So, I was able to run the action on my Mac. For whatever reason, it wouldn’t run on my iPad.

Anyway, I ran the action and it did create the tags. however, they were truncated. For example, one tag is:

#79_05-Evaluations

However, the tag came out as 79_05. I’ve attached a screenshot with how they look on top.

That happened with all the tags.

Is it that the action doesn’t recognize the “-” sign? How can I change the action to allow for this to be fully read?

Another issue: when I write a new Draft, if I go to tags, they don’t appear automatically. Any idea why that isn’t happening?

I’m new to Drafts actions, so forgive me for the very newbie question. :slight_smile:

Thanks!

And here’s an example when I write a new draft note. Nothing appears.

In the action, the first line of the script defines a regular expression to be used for matching hash tags.

var re = /#[\w\d]+/g;

The section in square brackets denotes a set of things that will be matched. The \w is word character (equivalent to [a-zA-Z0-9_]), and the \d any digit. You should just need to add a hyphen in to this like so.

var re = /#[\w\d-]+/g;

There is no reason the action should not run on your iPad. Did you modify the action? What was shown in the log after you attempted to run it?

Based on your subsequent post, what exactly are you expecting to happen?

Are you expecting a new draft to automatically populate the tags area as you type in a hash tag? If so, that isn’t how tags work - they are tags, not hash tags, hence the action to run to add tags to the draft based on hash tags in its contents.

If it is when you select to add a tag, I think it should start by displaying the most recently used tags, and then as you type it should filter from the entire set of tags or create a new one where there is no match.

Hope that helps.

You don’t need to type the hashtag in there (as the hashtag is not included in the tags you added to your note so typing just „71“ should be sufficent to make related tags pop up

1 Like