"Get Productive with a Tickler File": script outdated?

Hello
My opening screen showed the tip mentioned above. The creation of the Tickler file worked. But the corresponding script “Add Tickler Reminder Event to iCal” seems outdated and not adapted to Devonthink 3. I can’t script myself and don’t know what has to be adapted. Is there still a chance to restore the function?

Thanks und greetings
abro1

Bump because I’d like to have this function as well.

I would like to leverage smart rules and AppleScript to do the following:

  1. Add a file to a subfolder in the “Tickler File” register created by the “Install Add-ons” function in DTP3.
  2. Have a reminder created on a specific calendar in Calendar.app based on the subfolder (Tickler File>May>5>somefile.txt turns into “Tickler Reminder: somefile” at 9am on May 5th).

I noticed that creating “Tickler File” includes a subfolder in the register called “Script and Readme” but there is no script, only a readme. I’ve tried to edit an older script from the DTPO2 tickler (embedded below) but I cannot get the script to run either by shortcut or smart rule.

The error I am currently receiving is Error adding item to iCal / "Can’t get text 1 thru 2 of "1".

Any help would be most appreciated!

-- Script to add a selected record in the electronic Tickler File System to iCal as a full day reminder with an alarm
-- Date, Month and Year picked up automatically from the Tickler Files
-- Written by Luc Beaulieu with portion from the original iCal script of Eric Böhnisch-Volkmann (DEVONtechnologies, LLC) left intact

-- Set properties: Please change user dependent variables here - Note that my iCal calendar name if Tickler...
property pPrefix : "Tickler Reminder" -- Prefix for the created to do item
set MyAlarmHour to "09"
set myAlarmMinute to "00"
set myAlarmSecond to "00"
set MyCalendar to "Tickler"

try
	-- Get the selection
	tell application id "DNtp" to set thisSelection to the selection
	tell application id "DNtp" to set this_database to the current database
	tell application id "DNtp" to set this_path to path of this_database
	
	-- Error handling
	if thisSelection is {} then error localized string "Please select a document or group, the try again."
	if (length of thisSelection) > 1 then error localized string "Please select only one document or group, then try again."
	
	-- Get and format the data we need
	set pLocalizedPrefix to localized string pPrefix
	tell application id "DNtp"
		set thisItem to first item of thisSelection
		set theSummary to (pLocalizedPrefix & ": " & name of thisItem) as string
		set theURL to ("x-devonthink-item://" & uuid of thisItem) as string
		set MyMonths to parent of thisItem
		set MyMonth_name to first item of MyMonths
		set nameM to (name of MyMonth_name) as string
		set MyMonth_num to texts 1 thru 2 of nameM
	end tell
	
	-- Tickler item will be set as a full day reminder, I pick 9AM for the alarm
	set alld to true
	set AlternateDate to current date
	set day of AlternateDate to name of thisItem
	set month of AlternateDate to MyMonth_num
	set hours of AlternateDate to MyAlarmHour
	set minutes of AlternateDate to myAlarmMinute
	set seconds of AlternateDate to myAlarmMinute
	
	-- 	…Make sure were are in the right year, a Tickler file system must be continuous!
	if AlternateDate is less than (current date) then
		set year of AlternateDate to (year of (current date)) + 1
	end if
	
	-- prepare for iCal event creation (not sure it is really needed)
	set theStartDate to AlternateDate
	set theEndDate to theStartDate + (1 * hours)
	
	-- Add new to do to iCal (section from Eric Böhnisch-Volkmann)
	tell application id "com.apple.iCal"
		tell calendar MyCalendar
			-- Create new to do
			set theEvent to make event with properties {summary:theSummary, start date:theStartDate, end date:theEndDate, allday event:alld, url:theURL}
			tell theEvent
				set theAlarm to make display alarm with properties {trigger date:theStartDate, trigger interval:-15}
			end tell
			-- Show new to do item in iCal so that the user can edit it right away
			view calendar MyCalendar at theStartDate
			show theEvent
			activate
		end tell
	end tell
	
	-- This section is only for BusyCal users (I am one!)
	-- Quit iCal and go to BusyCal
	--tell application id "com.apple.iCal"
	--quit
	--end tell
	
	--tell application id "com.busymac.busyCal"
	--activate
	--end tell
	
on error errMsg
	
	display alert (localized string "Error when adding item to iCal") message errMsg
	
end try

The day of the event was set to the name of the file, not the name of the enclosing folder. Similarly, the month of the event, was set to the day of the event, instead of the name of the enclosing folder of the enclosing folder of the file. The Tickler folder setup is Month (folder) -> Day (folder) -> files.

The Tickler script is in the template file (which is a package). Control-clicking file “Tickler File.dtTemplate”" and selecting “Show Package Contents” will show the contents. Open the “English.lproj” folder and the enclosed “Tickler File” folder. A list of folders appears, of which the “Script and Readme” folder contains the script. It is no different in my version than what was posted earlier in this thread.

The corrected script is:

use AppleScript version "2.4" -- Yosemite (10.10) or later
use scripting additions

-- Script to add a selected record in the electronic Tickler File System to iCal as a full day reminder with an alarm
-- Date, Month and Year picked up automatically from the Tickler Files
-- Written by Luc Beaulieu with portion from the original iCal script of Eric Böhnisch-Volkmann (DEVONtechnologies, LLC) left intact

-- Set properties: Please change user dependent variables here - Note that my iCal calendar name is Tickler...
property pPrefix : "Tickler Reminder" -- Prefix for the created to do item
set MyAlarmHour to "09"
set myAlarmMinute to "00"
set myAlarmSecond to "00"
set MyCalendar to "Tickler"

try
	-- Get the selection
tell application id "DNtp" to set thisSelection to the selection
tell application id "DNtp" to set this_database to the current database
tell application id "DNtp" to set this_path to path of this_database

-- Error handling
if thisSelection is {} then error localized string "Please select a document or group, the try again."
if (length of thisSelection) > 1 then error localized string "Please select only one document or group, then try again."

-- Get and format the data we need
set pLocalizedPrefix to localized string pPrefix
tell application id "DNtp"
	set thisItem to first item of thisSelection
	set theSummary to (pLocalizedPrefix & ": " & name of thisItem) as string
	set theURL to ("x-devonthink-item://" & uuid of thisItem) as string
	set MyDay to name of first item of (parent of thisItem)
	set MyMonths to item 1 of parent of thisItem
	set MyMonth_name to item 1 of parent of MyMonths
	-- set MyMonth_name to first item of MyMonths
	set nameM to (name of MyMonth_name) as string
	set MyMonth_num to texts 1 thru 2 of nameM
end tell

-- Tickler item will be set as a full day reminder, I pick 9AM for the alarm
set alld to true
set AlternateDate to current date
-- set day of AlternateDate to name of thisItem
set day of AlternateDate to MyDay
set month of AlternateDate to MyMonth_num
set hours of AlternateDate to MyAlarmHour
set minutes of AlternateDate to myAlarmMinute
set seconds of AlternateDate to myAlarmMinute

-- 	…Make sure were are in the right year, a Tickler file system must be continuous!
if AlternateDate is less than (current date) then
	set year of AlternateDate to (year of (current date)) + 1
end if

-- prepare for iCal event creation (not sure it is really needed)
set theStartDate to AlternateDate
set theEndDate to theStartDate + (1 * hours)

-- Add new to do to iCal (section from Eric Böhnisch-Volkmann)
tell application id "com.apple.iCal"
	tell calendar MyCalendar
		-- Create new to do
		set theEvent to make new event at end with properties {summary:theSummary, start date:theStartDate, end date:theEndDate, allday event:alld, url:theURL}
		tell theEvent
			set theAlarm to make new display alarm at end with properties {trigger date:theStartDate, trigger interval:-15}
		end tell
		-- Show new to do item in iCal so that the user can edit it right away
		view calendar MyCalendar at theStartDate
		show theEvent
		activate
	end tell
end tell

-- This section is only for BusyCal users (I am one!)
-- Quit iCal and go to BusyCal
--tell application id "com.apple.iCal"
--quit
--end tell

--tell application id "com.busymac.busyCal"
--activate
--end tell

on error errMsg

display alert (localized string "Error when adding item to iCal") message errMsg

end try
1 Like