Jump to content

Apple Reminders


Recommended Posts

  • 5 weeks later...
  • 3 years later...
8 hours ago, Acidham said:


Yep, try it and you will see...

 

It's not working for me :( New reminders don't show up in any lists (or the default list). Not sure if any of this matters but I'm on 10.15 not 10.15.2. Would really appreciate any suggestions you may have!

Link to comment

Ah ok you already tried 🤔

 

I am on macOS 10.15.2 but I believe that does not make different. 

 

Let's start with that: Did you visit Preferences → Privacy →  Reminders and set checkmark on Alfred 4.app ?

Edited by Acidham
Link to comment
3 hours ago, Acidham said:

Let's start with that: Did you visit Preferences → Privacy →  Reminders and set checkmark on Alfred 4.app ?

 

Yep! Not sure why the reminders won't log.. When the Reminders app is closed and I run the Alfred workflow, the Reminders app will open but no new reminders will be set

Link to comment

Ok, let's proceed with two additional tests: 

 

1. Is Alfred raising some issues in Debug Console? Open Alfred Preference  → Search for Apple Reminders workflow → click on the small bug top right corner →  execute workflow. Please post result in case you encounter an issue.

2. Execute following script in ScriptEditor. Open Script Editor (e.g. with Alfred of Spotlight), copy&paste the following and execute it by pressing CMD-R

tell application "Reminders"
	set defaultList to name of default list
	make new reminder with properties {name:"Test"}
end tell

If successful you should find a reminder in Inbox with name "Test". Let me know if Script Editor throws an error. 

Link to comment
15 hours ago, Acidham said:

1. Is Alfred raising some issues in Debug Console? Open Alfred Preference  → Search for Apple Reminders workflow → click on the small bug top right corner →  execute workflow. Please post result in case you encounter an issue.

2. Execute following script in ScriptEditor. Open Script Editor (e.g. with Alfred of Spotlight), copy&paste the following and execute it by pressing CMD-Rows an error. 

 

1. Here is the result! 

[08:56:22.626] Logging Started...
[08:59:05.291] Apple Reminders[Keyword] Processing complete
[08:59:05.293] Apple Reminders[Keyword] Passing output 'test 2' to Arg and Vars
[08:59:05.294] Apple Reminders[Arg and Vars] Processing complete
[08:59:05.294] Apple Reminders[Arg and Vars] Passing output '' to Keyword
[08:59:05.425] Apple Reminders[Keyword] Processing complete
[08:59:05.427] Apple Reminders[Keyword] Passing output '' to Arg and Vars
[08:59:05.427] Apple Reminders[Arg and Vars] Processing complete
[08:59:05.428] Apple Reminders[Arg and Vars] Passing output '' to Keyword
[08:59:05.556] Apple Reminders[Keyword] Processing complete
[08:59:05.558] Apple Reminders[Keyword] Passing output '' to Arg and Vars
[08:59:05.558] Apple Reminders[Arg and Vars] Processing complete
[08:59:05.559] Apple Reminders[Arg and Vars] Passing output '' to Keyword
[08:59:06.656] Apple Reminders[Keyword] Processing complete
[08:59:06.659] Apple Reminders[Keyword] Passing output '' to Arg and Vars
[08:59:06.660] Apple Reminders[Arg and Vars] Processing complete
[08:59:06.660] Apple Reminders[Arg and Vars] Passing output '' to Arg and Vars
[08:59:06.661] Apple Reminders[Arg and Vars] Processing complete
[08:59:06.662] Apple Reminders[Arg and Vars] Passing output 'test 2;;;' to Run NSAppleScript
[08:59:06.866] ERROR: Apple Reminders[Run NSAppleScript] {
    NSAppleScriptErrorAppName = Reminders;
    NSAppleScriptErrorBriefMessage = "Can\U2019t get list \"Inbox\".";
    NSAppleScriptErrorMessage = "Reminders got an error: Can\U2019t get list \"Inbox\".";
    NSAppleScriptErrorNumber = "-1728";
    NSAppleScriptErrorRange = "NSRange: {3276, 66}";
}
[08:59:06.875] Apple Reminders[Run NSAppleScript] Processing complete
[08:59:06.875] Apple Reminders[Run NSAppleScript] Passing output '' to Post Notification

 

2. Executing the script in ScriptEditor worked! I see that "test" was logged in my default folder

Link to comment

What is the name of your default list?  (Reminders →  Preferences  → Default List)

 

Please also try to get default list via Apple Script Editor and let me know: 

tell application "Reminders"
	get name of default list
end tell

 

Link to comment

I figured out what the problem was! I had my default list nested in a folder in the Reminders app. After moving the default list out of a folder the workflow started to work properly. 

When I run:

tell application "Reminders"
	get name of default list
end tell

The default list comes up as "Inbox", which is right.

 

I'm happy to keep my default list out of folders to ensure this works properly. I will say that I'm not able to selectively input reminders to specific lists that are nested in folders right now. Not a huge deal at all! (But something I wanted to share)

Link to comment
  • 1 month later...
  • 3 weeks later...

Hey @Acidham

Like a few previous people I am a newbie and also really having trouble with time. 

 

Appreciate any help. 

 

Below is debug log
 

[08:28:26.962] Logging Started...

[08:28:37.833] Apple Reminders[Keyword] Processing complete

[08:28:37.834] Apple Reminders[Keyword] Passing output 'Test' to Arg and Vars

[08:28:37.835] Apple Reminders[Arg and Vars] Processing complete

[08:28:37.835] Apple Reminders[Arg and Vars] Passing output '' to Keyword

[08:28:41.761] Apple Reminders[Keyword] Processing complete

[08:28:41.762] Apple Reminders[Keyword] Passing output 'Wednesday' to Arg and Vars

[08:28:41.763] Apple Reminders[Arg and Vars] Processing complete

[08:28:41.764] Apple Reminders[Arg and Vars] Passing output '' to Keyword

[08:29:04.179] Apple Reminders[Keyword] Processing complete

[08:29:04.180] Apple Reminders[Keyword] Passing output '7:00' to Arg and Vars

[08:29:04.181] Apple Reminders[Arg and Vars] Processing complete

[08:29:04.181] Apple Reminders[Arg and Vars] Passing output '' to Keyword

[08:29:07.654] Apple Reminders[Keyword] Processing complete

[08:29:07.658] Apple Reminders[Keyword] Passing output 'Work' to Arg and Vars

[08:29:07.658] Apple Reminders[Arg and Vars] Processing complete

[08:29:07.659] Apple Reminders[Arg and Vars] Passing output '' to Arg and Vars

[08:29:07.659] Apple Reminders[Arg and Vars] Processing complete

[08:29:07.660] Apple Reminders[Arg and Vars] Passing output 'Test;Wednesday;7:00;Work' to Run NSAppleScript

[08:29:08.317] Apple Reminders[Run NSAppleScript] Processing complete

[08:29:08.325] Apple Reminders[Run NSAppleScript] Passing output 'Test

Due: Wednesday, 12 February 2020 at 12:00:00 am, in List: Work' to Post Notification

Link to comment

@Bogga The WF output looks ok and Reminder should be created. 

 

What macOS version are you using?

Are you sure that Reminders has a list "Work" and not in subfolders?

 

You can run following test in Apple ScriptEditor and see if the reminder will be created:

tell application "Reminders"
	set theDate to date ("12 February 2020 at 12:00:00 am")
	tell list "Work"
		make new reminder with properties {name:"Test", remind me date:theDate}
	end tell
end tell

 

Edited by Acidham
Link to comment
13 minutes ago, Bogga said:

On Catalina 10.15.3

 

The reminder is getting created but having the time 12am instead of 7am.

 

Appreciate the help. 

 

That's not really enough information to work with. Fixing a bug is extremely difficult if you can't replicate it yourself. From what you've posted, it's not even possible to tell that it is a bug: You might have entered invalid input.

 

So please—at the very minimum—specify the input, expected output and actual output.

Link to comment
1 hour ago, deanishe said:

 

That's not really enough information to work with. Fixing a bug is extremely difficult if you can't replicate it yourself. From what you've posted, it's not even possible to tell that it is a bug: You might have entered invalid input.

 

So please—at the very minimum—specify the input, expected output and actual output.

 

Sorry @deanishe , Was just using the previous chats that all log the 12 am time issue. 

 

@Acidham

 

My reminder gets created fine but always appears at 12am no matter what time I put. 

 

This is the only issue I have with the workflow. 

 

Thanks

Link to comment

Strange, When I enter

  1. Test
  2. Friday
  3. 7:00
  4. Work

Can you confirm to get Reminder added at 12:00 am with entries in WF steps above?

 

Can you execute the following script in ScriptEditor? At what time the Reminder gets created?

 

tell application "Reminders"
	set theDate to date ("12 February 2020 at 07:00:00 am")
	tell list "Work"
		make new reminder with properties {name:"Test", remind me date:theDate}
	end tell
end tell

 

Link to comment

From my testing it only likes times in the format

hh:mm:ss am/pm

 

so 7 am, 7:00, 07:00, 07:00:00,  all fail 

but

07:00:00 am or 7:00:00 am works.

 

[20:53:20.854] Apple Reminders[Arg and Vars] Passing output 'title;tomorrow;07:00:00;' to Run NSAppleScript

[20:53:30.351] Apple Reminders[Run NSAppleScript] Processing complete

[20:53:30.418] Apple Reminders[Run NSAppleScript] Passing output 'title

Due: Thursday, 13 February 2020 at 12:00:00 am, in List: Reminders' to Post Notification

 

 

[20:54:21.657] Apple Reminders[Arg and Vars] Passing output 'test;tomorrow;07:00:00 am;' to Run NSAppleScript

[20:54:31.144] Apple Reminders[Run NSAppleScript] Processing complete

[20:54:31.165] Apple Reminders[Run NSAppleScript] Passing output 'fart

Due: Thursday, 13 February 2020 at 7:00:00 am, in List: Reminders' to Post Notification

 

Edited by Pearcen
Link to comment
8 hours ago, Pearcen said:

From my testing it only likes times in the format

hh:mm:ss am/pm

 

so 7 am, 7:00, 07:00, 07:00:00,  all fail 

but

07:00:00 am or 7:00:00 am works.

 

[20:53:20.854] Apple Reminders[Arg and Vars] Passing output 'title;tomorrow;07:00:00;' to Run NSAppleScript

[20:53:30.351] Apple Reminders[Run NSAppleScript] Processing complete

[20:53:30.418] Apple Reminders[Run NSAppleScript] Passing output 'title

Due: Thursday, 13 February 2020 at 12:00:00 am, in List: Reminders' to Post Notification

 

 

[20:54:21.657] Apple Reminders[Arg and Vars] Passing output 'test;tomorrow;07:00:00 am;' to Run NSAppleScript

[20:54:31.144] Apple Reminders[Run NSAppleScript] Processing complete

[20:54:31.165] Apple Reminders[Run NSAppleScript] Passing output 'fart

Due: Thursday, 13 February 2020 at 7:00:00 am, in List: Reminders' to Post Notification

 

 

Legend!! That works. 

 

Thanks @Pearcen and @Acidham for your time. 

Link to comment

I've had a play with the workflow AppleScript and think I have added some logic to help it deal with times.

 

it should now accept times in the formats:  <hour> am/pm or 24hr time.  

eg:

8 am. 3:45 pm, 2:39 am, 05:00 am

00:02, 13:56, 15:00, 23:49

 

This is my first attempt at AppleScript so hopefully it works and is useful to add to this already great workflow :)

 

Code replaces all in the RunNSAppleScript block

(* For using in Script Editor *)
--alfred_script("xxx;;14;Wishlist")

on alfred_script(q)
	set noDate to "no"
	set theDayArray to {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"}
	
	(* Explode query input *)
	set myList to explode(";", q)
	
	(* get the Title of the Reminder *)
	set theReminder to item 1 of myList
	
	(* try to get Date, tomorrow or next week on error set to "none" *)
	set queryDay to item 2 of myList
	if queryDay is "" then set queryDay to "none"
	
	(* Replace . with : <OLD:Set default Reminder Time 8:00> *)
	set queryTime to item 3 of myList
	--	if queryTime is "" then set queryTime to "8:00"
	set queryTime to replace_chars(queryTime, ".", ":")
	
	(* Get List of for Reminder *)
	set queryList to trim(item 4 of myList)
	
	(* try to get entered time. if only hours are provided at the missing ":00" *)
	if queryTime is not "" and queryTime does not contain ":" then
		set Pos to offset of " " in queryTime
		set theHour to characters 1 thru (Pos - 1) of queryTime as string
		set queryTime to theHour & ":00" & characters (Pos) through end of queryTime as string
	else if (queryTime does not contain "am") and (queryTime does not contain "pm") then
		set Pos to offset of ":" in queryTime
		set theHour to characters 1 thru (Pos - 1) of queryTime as string
		set theHour to returnNumbersInString(theHour)
		set theHour to theHour as number
		set queryTime to characters (Pos + 1) through end of queryTime as string
	
		-- Get the "minute"
		set Pos to offset of ":" in queryTime
		set theMin to characters 1 thru (Pos - 1) of queryTime as string
		set queryTime to characters (Pos + 1) through end of queryTime as string
	
		--Get "AM or PM"
		set Pos to offset of " " in queryTime
		set theSfx to characters (Pos + 1) through end of queryTime as string
		if theSfx does not contain "pm" and theSfx does not contain "am" then
			if (theHour is less than 24) or (theHour is greater than or equal to 0) then
				if theHour is less than 12 then
					set theSfx to "am"
				else
					set theSfx to "pm"
					set theHour to theHour - 12
				end if
			end if
		end if
		set queryTime to theHour & ":" & theMin & " " & theSfx as string
	end if
    
	
	
	
	(* calculate due date when "today" was entered. If time string is emptpy, add 3 hours from now *)
	if queryDay contains "today" then
		if queryTime is not equal to "" then
			set theDate to date string of (current date)
			set DueDate to date (theDate & " " & queryTime)
		else
			set DueDate to ((current date) + (3 * hours))
		end if
		
		(* calculate tomorrow's due date. If time string is empty get current time *)
	else if queryDay contains "tomorrow" then
		if queryTime is equal to "" then
			set queryTime to time string of (current date)
		end if
		set theDate to date string of ((current date) + (1 * days))
		set DueDate to date (theDate & " " & queryTime)
		
		(* Calculate next weeks due date. If time string is empty get current time *)
	else if queryDay contains "next week" then
		if queryTime is equal to "" then
			set queryTime to time string of (current date)
		end if
		set theDate to date string of ((current date) + (1 * weeks))
		set DueDate to date (theDate & " " & queryTime)
		
		(* if weekday was provided set due date to the next weekday*)
	else if theDayArray contains queryDay then
		
		set theNext to list_position(queryDay, theDayArray)
		set theNextWeekday to date string of (nextWeekday(theNext))
		set DueDate to date (theNextWeekday & " " & queryTime)
		
		(* if no day was provided set noDate flag to "yes" *)
	else if queryDay contains "none" then
		set noDate to "yes"
		
		(* In case date where provided check if only DD and MM was provided and add current year *)
	else if queryDay contains "." then
		if queryTime is equal to "" then
			set queryTime to time string of (current date)
		end if
		set expDate to explode(".", queryDay)
		if (count of expDate) is equal to 2 then
			set theYear to year of (current date)
			set queryDay to queryDay & "." & theYear
		end if
		set DueDate to date (queryDay & " " & queryTime)
		
	end if
	
	(* Create reminder without a DueDate *)
	if noDate is equal to "yes" then
		tell application "Reminders"
			-- get default list set in Reminders
			if queryList is equal to "" then
				set listName to name of default list
			else
				set listName to queryList
			end if
			
			set availList to name of lists
			if availList does not contain listName then
				set listName to name of default list
			end if
			
			tell list listName
				make new reminder with properties {name:theReminder}
			end tell
		end tell
		set output to theReminder & ", in List: " & listName
		
		(* Create reminder with DueDate *)
	else
		tell application "Reminders"
			-- get default list set in Reminders
			if queryList is equal to "" then
				set listName to name of default list
			else
				set listName to queryList
			end if
			
			set availList to name of lists
			
			if availList does not contain listName then
				set listName to name of default list
			end if
			
			tell list listName
				make new reminder with properties {name:theReminder, remind me date:DueDate}
			end tell
			
		end tell
		set output to theReminder & "
Due: " & DueDate & ", in List: " & listName
	end if
	
end alfred_script


(* explode string with given delimter *)
on explode(delimiter, input) -- explode(delimiter (String),input (String)) (Array)
	local delimiter, input, ASTID
	set ASTID to AppleScript's text item delimiters
	try
		-- save delimiters to restore old settings
		set oldDelimiters to AppleScript's text item delimiters
		set AppleScript's text item delimiters to delimiter
		set input to text items of input
		set AppleScript's text item delimiters to ASTID
		set AppleScript's text item delimiters to oldDelimiters
		return input --> list
	on error eMsg number eNum
		set oldDelimiters to AppleScript's text item delimiters
		set AppleScript's text item delimiters to ASTID
		set AppleScript's text item delimiters to oldDelimiters
		error "Can't explode: " & eMsg number eNum
	end try
end explode

(* calculates next weekday as an integer *)
on nextWeekday(wd)
	set today to current date
	set twd to weekday of today
	if twd is wd then
		set d to 7
	else
		set d to (7 + wd - twd) mod 7
	end if
	return today + (d * days)
end nextWeekday

(* returns position in a list *)
on list_position(this_item, this_list)
	repeat with i from 1 to the count of this_list
		if item i of this_list is this_item then return i
	end repeat
	return 0
end list_position

(*Replaces a character witin a text*)
on replace_chars(this_text, search_string, replacement_string) -- (string,char,char)
	set AppleScript's text item delimiters to the search_string
	set the item_list to every text item of this_text
	set AppleScript's text item delimiters to the replacement_string
	set this_text to the item_list as string
	set AppleScript's text item delimiters to ""
	return this_text
end replace_chars

on returnNumbersInString(inputString)
	set s to quoted form of inputString
	do shell script "sed s/[a-zA-Z\\']//g <<< " & s
	set dx to the result
	set numlist to {}
	repeat with i from 1 to count of words in dx
		set this_item to word i of dx
		try
			set this_item to this_item as number
			set the end of numlist to this_item
		end try
	end repeat
	return numlist
end returnNumbersInString

(* =======================================================
FUNTION: Trim trailing whitespaces from a string
RETURNS: String
======================================================== *)
on trim(str)
	set cmd to "echo \"" & str & "\" |  sed 's/ //g'"
	set trimmed to do shell script cmd
	return trimmed
end trim

 

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...