What is still a problem in the AScr. is there a path problem?
(*
======================================
// MAIN PROGRAM
======================================
*)
tell application "OmniFocus"
--SET THE REPORT TITLE
set ExportList to (current date) & return & return & "Completed Projects in the Last Day" & return & "---" & return & return as Unicode text
--PROCESS THE PROJECTS
tell default document
set refFolders to a reference to (flattened folders where hidden is false)
repeat with idFolder in (id of refFolders) as list
set oFolder to folder id idFolder
set ExportList to ExportList & my IndentAndProjects(oFolder) & return
end repeat
--ASSEMBLE THE COMPLETED TASK LIST
set ExportList to ExportList & return & return & "Tasks Completed in the last day" & return & "---" & return & return & return
set day_ago to (current date) - 1 * days
set refDoneInLastWeek to a reference to (flattened tasks where (completion date ≥ day_ago))
set {lstName, lstContext, lstProject, lstDate} to {name, name of its context, name of its containing project, completion date} of refDoneInLastWeek
set strText to ""
repeat with iTask from 1 to length of lstName
set {strName, varContext, varProject, varDate} to {item iTask of lstName, item iTask of lstContext, item iTask of lstProject, item iTask of lstDate}
if varDate is not missing value then set strText to strText & short date string of varDate & " - "
if varProject is not missing value then set strText to strText & " [" & varProject & "] - "
set strText to strText & strName
if varContext is not missing value then set strText to strText & " *@" & varContext & "*"
set strText to strText & " " & return
end repeat
end tell
set ExportList to ExportList & strText as Unicode text
-- Modify "/usr/local/bin/dayone/dayone" to "/usr/local/bin/dayone" if you didn't screw it up like I did.
set destnpath to (quoted form of "/usr/local/bin/dayone new")
set myshellscript to "echo " & (quoted form of ExportList) & "|tr -d \"\\t\"| " & destnpath
do shell script myshellscript password “XXXX" with administrator privileges
end tell
(*
======================================
// MAIN HANDLER SUBROUTINES
======================================
*)
on IndentAndProjects(oFolder)
tell application id "OFOC"
set {dlm, my text item delimiters} to {my text item delimiters, return & return}
set day_ago to (current date) - 1 * days
set strCompleted to (name of (projects of oFolder where its status is done and completion date ≥ day_ago)) as string
set my text item delimiters to dlm
return strCompleted & return
end tell
end IndentAndProjects