I never was able to solve this problem. I’m now trying again.
I want to eliminate the quote, weather and news headlines. I just want an empty file with timestamps as # headers.
Here’s what I tried:
I copied the original template.
I modified main.scpt to remove everything I could find in it that seemed to refer to a quote and headlines. Here is the result:
(*
Based on script by Chuck Lane October 2, 2013
https://discourse.devontechnologies.com/t/daily-journal-script/16509
Updated and optimized for DEVONthink 3 by Christian Grunenberg April 30, 2019
Localized by Eric Böhnisch-Volkmann June 28, 2019
Revised for Markdown by Christian Grunenberg Oct 19, 2020
*)
property headerColor : {40000, 20000, 0}
property blackColor : {0, 0, 0}
property dateColor : {30000, 30000, 30000}
property numHeadlines : 4
-- Import helper library
tell application "Finder" to set pathToAdditions to ((path to application id "DNtp" as string) & "Contents:Resources:Template Script Additions.scpt") as alias
set helperLibrary to load script pathToAdditions
-- Format the time, strip out the seconds but keep the AM/PM indicator
set theDate to current date
set theTime to time string of theDate
if (theTime contains "AM" or theTime contains "PM") then
if character 5 of theTime is ":" then
set theTime to (characters 1 through 4 of theTime) & (characters 8 through 10 of theTime) as string
else
set theTime to (characters 1 through 5 of theTime) & (characters 9 through 11 of theTime) as string
end if
else if character 5 of theTime is ":" then
set theTime to (characters 1 through 4 of theTime)
else
set theTime to (characters 1 through 5 of theTime)
end if
-- Format the month number
set numMonth to (month of theDate as integer) as string
if the (length of numMonth) < 2 then set numMonth to "0" & numMonth
-- Format the day, calculate suffix for English if needed
set theDay to day of theDate as string
set shortDay to theDay -- shortDay won't have a leading zero
if the (length of theDay) < 2 then set theDay to "0" & theDay
set daySuffix to ""
if theLocale is not "de" then
set suffixList to {"st", "nd", "rd"}
set theIndex to last character of theDay as integer
if (theIndex > 0) and (theIndex < 4) and the first character of theDay is not "1" then
set daySuffix to item theIndex of suffixList
else
set daySuffix to "th"
end if
end if
-- Format the year
set theYear to year of theDate as string
-- Format month and weekday names (localized)
set shortWeekday to characters 1 thru 3 of longWeekday
tell application id "DNtp"
try
activate
set myGroup to create location "/Journal/" & "/" & theYear & "/" & numMonth
set recordName to theYear & "-" & numMonth & "-" & theDay & " " & shortWeekday
set myRecords to children of myGroup whose name is recordName and type is markdown
if ((count of myRecords) is 0) then -- Create the document from scratch
set myRecord to create record with {name:recordName, content:theContent, type:markdown, tags:theYear & "," & theMonth} in myGroup
else -- Record already exists, just add new weather/time header
set myRecord to item 1 of myRecords
end if
set theContent to plain text of myRecord
set plain text of myRecord to theContent & return & return & "## " & theTime & return & "- "
open tab for record myRecord
on error errMsg number errNum
display alert (localized string "An error occured when adding the document.") & space & errMsg
end try
end tell
After making the modifications, I closed and restarted DevonThink, and then run the modified, duplicate template.
Expected outcome:
A markdown file that just shows a # header with timestamp–no quote, no headline.
Here’s what I get:
A markdown file that starts with a quote and five headlines from the NY Times.
In other words, even after I modify the script it still seems to run the original script, as if I had made no modifications at all.
How do I fix this?
Bluefrog, I did not run your script modification because it produces an RFT file, not an RTD, and has a quote at the top, which I do not want.
UPDATE:
I removed blank lines from the end of the script, compiled, and saved. I also tried closing DevonThink, modifying the script, adding or removing a blank line from the end, and then restarting DevonThink–this is an alternative to modifying the script with DT open, and then closing and restarting DT.
And now I’ve made progress! The script does absolutely nothing! It does not create groups or documents! So, progress I guess? Yay?