I was going to check this script for similar outcome but it is also greyed out..
-- Prefix with creation date (YYYYMMDD)
-- Created by Christian Grunenberg on Mon Aug 15 2011.
-- Modified by Jim Neumann on May 17, 2013.
-- Copyright (c) 2011. All rights reserved.
tell application "DEVONthink"
try
set theSelection to the selection
if theSelection is {} then error "Please select some documents."
repeat with theRecord in theSelection
set {originalName, theDate} to {name, creation date} of theRecord
set theName to (((characters -4 thru -1 of ((year of theDate) as string)) as string) & my twodigits(((month of theDate as integer) as string)) & my twodigits(((day of theDate) as string)) & " - " & originalName) as string
set name of theRecord to theName
end repeat
on error error_message number error_number
if the error_number is not -128 then display alert "DEVONthink Pro" message error_message as warning
end try
end tell
on twodigits(theStr)
local theLen
set theLen to length of theStr
if theLen is 0 then return "00"
if theLen is 1 then return "0" & theStr
return theStr
end twodigits
Firstly, you must have some process going on to cause this to work sporadically. This still needs investigating.
Secondly, these are very old scripts and no longer necessary, even as of DEVONthink 3.x. You can very easily create a smart rule or batch process to accomplish prefixing a filename with a creation date.
Unzip and double-click this batch processing configuration: Prefix with Creation Date.dtBatchProcess.zip (1.0 KB)
Then select a document, choose Tools > Batch Process > Batch Process or press Control-Command-B, select the configuration, and press Apply.
Is this an AI generated script? Because the syntax is not correct, this should look like this:
set strMonth to characters -1 thru -2 of ("0" & (month of dtRecordDate as number))
set strDay to characters -1 thru -2 of ("0" & day of dtRecordDate)
In addition, how many items were selected before using this script?
Thank you BlueFrog. That batch processing configuration file worked. Control-Command-B does show 4 x entries âPrefix with Creation Date - I actionâ. Is this normal?
The script didnât. All of the scripts in the drop down remain greyed out. Perhaps I could start by deleting these old scripts from the dropdowns!
These scripts were oldies I found a couple of years ago in the forum and have worked pretty well all the time. They are not AI generated. I use it in individual or multiple file selects and it generally works without fault - clearly identifying creation date - but sometimes I have found it sticks âtodayâs dateâ on all files selected - but this is the exception not the rule. BlueFrog gave me a batch-processing config file so perhaps I should start some self help by deleting these old scripts from the library of drop downs. What say you. I mentioned to Jim that the Scripts (all of) remain greyed out.
Thanks BueFrog⌠that is neat. Rule one for scripters no doubt! Appreciated! This is just a test of your suggestion. Leigh
tell application id "DNtp"
set thisSelection to the selection
try
--Check selection
if not (exists think window 1) then error "No window is open."
repeat with theRecord in thisSelection
--Build creation date stamp string
set dtRecordDate to date of theRecord
set strYear to year of dtRecordDate
set strMonth to rich texts -1 thru -2 of ("0" & (month of dtRecordDate as number))
set strDay to rich texts -1 thru -2 of ("0" & day of dtRecordDate)
set strDateStamp to strYear & strMonth & strDay & " - "
--Rename with date stamp prefix
set strNewName to strDateStamp & " " & name of theRecord
set name of theRecord to strNewName as string
end repeat
on error error_message number error_number
if the error_number is not -128 then display alert "DEVONthink" message error_message as warning
end try
end tell
Youâre welcome.
Could you post a screen capture of this?
Seems that Jimâs configuration was added multiple times. One is of course sufficient.