Importing tag lists and list of aliases

is there a way to import via csv (or any form) a list of tags and their aliases? so maybe a spreadsheet where column 1 was the tag and column 2 was the list of aliases, separated by commas? i don’t know how this would work, perhaps it would require a script of some type. just thought i’d ask. thank you!

Why not just create a sheet in DEVONthink? :thinking:

sure but can i then turn that sheet into tags and aliases? i don’t care where the sheet is created, as long as every entry in column one could be a tag and every entry in column two could be aliases for the tag.

I suppose that this could be scripted.
Update Indeed, the following is a small proof of concept in JavaScript. It relies on a sheet currently selected in DT, no error checking for that:

(() => {
  let app = Application("DEVONthink 3");
  let w = app.thinkWindows()[0];
  let rows= w.numberOfRows();
  let columns = w.numberOfColumns();
  for (i = 1;  i <= rows; i++) {
    let tag = w.getCellAt({column: 1,row: i});
	let alias = w.getCellAt({column: 2, row: i});
	console.log(`tag: ${tag}, aliases: ${alias.split(',').join('#')}`);
  }
})()

First column contains the tag, second column contains the aliases, separated by commas, as requested.
However, I have no idea what you want to achieve now. I don’t use aliased tags (or I’m not aware of it). One could of course create a new tag in the TagGroup of the current database (or somewhere else). But aliases? No idea. Maybe @BLUEFROG knows more about that.

1 Like

AMAZING! thank you!!

i tried to do this in dt and the script wouldn’t work! any idea what i need to do?

The only thing that this script does is to write the tag and aliases to the script editors console if it’s run in script editor. As I said: proof of concept. You won’t see anything if you run that in DT because it’s not doing anything visible there. This is according to specification:

If you want to create those tags, you’d have to

  • get the database you want to use them in
  • get this databases’s tagsGroup element
  • get this group’s tags list
  • append the tags to it.

However, aliases seem to be related to groups (if I understand the online help correctly). And I do not see anything in DT’s scripting dictionary to set a group’s alias. Alias are only ever mentioned there as “alias for wiki pages”. Perhaps I’m overlooking something and @BLUEFROG can shed some light on this?

Actually you can alias all items: groups, tags, and files. Wikis are just we’re the idea originated and is still valid today.

Thanks for clearing that up (maybe a good idea to mention that in the documentation and the scripting dictionary, too).
So, to set aliases "a,b"for a tag X via scripting, I’d

  • Go to the database’s tag group
  • get the record with the name X
  • add “a,b” to its alias property?

I will look at potential revisions for the documentation. Thanks!