Makro adding date in front of item name

I love to have file names starting with the date (yyyyMMdd), blank, original name. I have written a service in Automator, but is there something similar in DT3?

I use an applescript to process notes in the Inbox database
The process includes assigning note title with a date prefix
I added an icon in the DT3 top menu bar to trigger the script

Naming files this way has been discussed numerous times in the forum. There’s probably a thread that helps you to get what you want.

1 Like

I’m not a wizzard. If you could share that script that would be great.

If you’re maintenancing some files, select the files and choose Tools > Batch Process with this action, like so…

1 Like

Here’s a sample script

set yyyymmdd to FormatDate()
tell application id "DNtp"
	set selectedNotes to get selection
	repeat with selectedNote in selectedNotes
		set name of selectedNote to yyyymmdd & " " & name of selectedNote
		set theFilingGroup to get record at "/🗂Filing" in database "Devonthink"
		set theNote to move record selectedNote to theFilingGroup
	end repeat
end tell

on FormatDate()
	set {year:yyyy, month:mmm, day:d, weekday:dddd} to (current date)
	set dd to ("0" & d as string)
	set dd to (text -2 thru -1 of dd) as string
	set m to mmm as integer
	set mm to ("0" & m as string)
	set mm to (text -2 thru -1 of mm) as string
	set yyyymmdd to (yyyy as string) & "-" & mm & "-" & dd
	return yyyymmdd
end FormatDate

That looks like a complexity which I can handle :wink: But how do I get Year, Month, Day to be accepted as variables?

I have a solution: %shortDate%-%time% before the Name. Not so impressing, but it works;-) Eventhough it is only the time of change and not the creation time.

Control-click in the text field and choose Insert Placeholder > Creation Date > Year, then Month, then Day.

Thank you so much. I used Short Creation Date-Creation Time Name and had the result I wanted.
I just have to learn the couple of thousands tricks :grinning: :grinning:

You’re welcome and enjoy the discovery :slight_smile: