Smart rule to convert hashtags to tags

Hello, I am trying to automatically convert hashtags to tags using a smart rule with the same functionality as Data->Tags->Convert Hasgtags to Tags. I’ve tried using the enclosed, but it isn’t working - no tags added? Any ideas?

That’s the wrong action, just use Tags > Convert Hashtags to Tags

Awesome, thank you. Asking lots of questions, but learning fast :smiley:

I have to say that I love your product and the forum is great - fab bunch of people…

2 Likes

Help > Documentation > Appendix > Smart Rule Events & Actions

We have extensive help readily available in the app or as a downloadable manual.

Thanks. I did look in the manual, but didn’t spot that.

You’re welcome.
The Appendix is where the rubber hits the road in terms of details. :slight_smile:

Thanks again. Is it just me or is the automation quite addictive…? :grinning:

2 Likes

You’re welcome.

It’s been a huge part of my employment since 1997, so I’d say yes. :smiley:

1 Like

Sorry another question - if a hashtag is renamed is there a way of updating the smart rule to remove the old one?

if a hashtag is renamed is there a way of updating the smart rule to remove the old one?

Why would you be using a smart rule in this case?
And if “a hashtag is renamed” where?

Hi @BLUEFROG apologies a very poorly worded question.

Having given it more thought, what I am trying to do is select a DT record using the URL? e.g.x-devonthink-item://xxxxxxxx-xxxxxx-xxxxxx then I can change tags etc. The URL is stored as a note field in Things3.

I’ve looked in the manual and the forums, but they only seem to reference sharing the URL from DT to another app not using it to select a DT note/record.

tell application id "com.culturedcode.ThingsMac"
	set sel to item 1 of selected to dos
	set theID to notes of selected to dos
end tell

tell application id "DNtp"
	
	set thisItem to get record with uuid theID
	set tagList to tags of thisItem
end tell

results in error “Can’t get tags of missing value.” number -1728 from «class tags» of missing value

So is the value you pass on from the other app really a UUID of an existing record?

Yes, that’s correct.

An example is x-devonthink-item://BC695877-BF88-4817-8868-6C92CD115400. If I click the link it opens the note/record in DT.

That is not a UUID. It is an URL. The UUID is part of this URL, but the two are not the same. You have to retrieve the UUID from the URL and then pass that on to DT’s get record method.

Aaah. Apologies, my mistake. Are you able to share how to retrieve the UUID from the URL?

It’s okay, I think I’ve got it - the UUID is the alpha-numeric string from “://” on?

It is. BTW: It is always helpful to run scripts in Script Editor or Script Debugger (a commercial product with a free version). They give better traces and messages, and those are a lot more useful than fiddling around blind-folded :wink:
Personally, I wouldn’t use AppleScript for all this, given its poor string functions. That is, of course, a matter of taster. But if you already “speak” JavaScript, you might be better of with it.

Thanks @chrillek appreciate your thoughts and help. I’ve got it to identify the record now.

I am running them in Script Editor (with lots of display dialogs) - I’ll have a look at Script Debugger. As you can tell :slight_smile: I am a newbie at AppleScript and unfortunately don’t speak Javascript :wink:

@chrillek I like Script Debugger :slight_smile:

It has been recommended here by a lot of AppleScript aficionados, and from what I glimpsed of it, it’s a lot more convenient then Script Editor. But then, even VS Code is better than Script Editor for writing AS code.