Pages

Showing posts with label reminders. Show all posts
Showing posts with label reminders. Show all posts

Thursday, January 30

Why I ditched Omnifocus for Reminders

Why I ditched Omnifocus for Reminders....

I've talked about both many times on this blog, but I've made the switch, wrote it down:

Monday, January 27

My Morning Workflow with my iPad, Apple Notes, Reminders, and Shortcuts

Experimenting with posting over on Medium.  Seems to be easier, and has some very interesting features.

Anyway, my first post is up over there:


Since I have lots of readers here, I figured they might be interested.

Please leave comments below.

Monday, December 9

Auto Creating Reminders from Email Messages

In my constant state of trying to make things a bit more efficient for myself. (I'm a big believer in automation, ask anyone that has ever worked with me.) We have computers! Make the computers do work instead of us manually doing things on the computer.  

I wanted to find a way to auto-create a reminder from an email. I assume you can figure out how to create a rule to match an email in Mail.app, but one of the actions you can take on a mail rule is "Run AppleScript".

This AppleScript, given the email match, will create a reminder that links back to the email for you:

using terms from application "Mail"

    on perform mail action with messages selectedMessages

        try

            log "Starting script execution"

            tell application "Reminders"

                repeat with theMessage in selectedMessages

                    try

                        tell application "Mail"

                            -- Fetch subject and message ID

                            set emailSubject to subject of theMessage

                            set messageID to message id of theMessage

                            

                            -- Mark email as read

                            set read status of theMessage to true

                            

                            -- Change email color to blue

                            set background color of theMessage to blue

                        end tell

                        

                        -- Log values for debugging

                        log "Email Subject: " & emailSubject

                        log "Message ID: " & messageID

                        

                        -- Construct reminder properties

                        set reminderText to emailSubject

                        set emailLink to "message://%3C" & messageID & "%3E"

                        set reminderNotes to "Link to the email: " & emailLink

                        

                        -- Create reminder in default list

                        tell list "Reminders" -- Change "Reminders" to your desired list name

                            make new reminder with properties {name:reminderText, body:reminderNotes}

                        end tell

                        

                    on error errMsg

                        log "Error processing message: " & errMsg

                    end try

                end repeat

            end tell

        on error errMsg

            log "Script execution error: " & errMsg

        end try

        log "Script finished execution"

    end perform mail action with messages

end using terms from



You need to change the "list" (see "tell list") you want the reminder to go into.

This will take an email, mark it as read, change the background color of the email to blue, create the reminder, and then exit.

You can't put the "message://" link in the URL field directly with AppleScript, as there is no method within the AppleScript reminders dictionary to access "URL". Shortcuts.app can, but AppleScript can't. (I know, right?)

But I have a Shortcut that I execute from the end of this AppleScript that moves it for me. You can execute the shortcut from the AppleScript by putting this after the last "end tell”.

            do shell script "shortcuts run \"URL Mover for Reminders message\""

            log "Shortcut executed successfully"



There's the shortcut. It'll handle both "message://" and "<message:" links (the latter created by OmniFocus if you moved from OmniFocus to Reminders).



Please leave comments below.

Monday, November 13

Moving from Omnifocus to Reminders

Let's say you're like me, an avid Omnifocus user, but you've been hearing great things about Reminders on MacOS/iOS/iPadOS, and you want to give it a shot.  Well, here's an AppleScript that will move everything over for you. It won't delete anything out of Omnifocus, so nothing will get messed up, but, it will take your existing projects and move them over as separate lists, then move the tasks over, preserving flagged, priorities, and the notes in each task (to Reminders.app's limitations).

TWO CAVEATS THOUGH

1. It can't move nested (subtasks) tasks from Omnifocus over, this is a very tricky problem to solve, and it's beyond my AppleScripting skills to access the subtasks and move them over properly.  
2. I wanted to implement "tags" from Omnifocus over to the "tags" feature in Reminders, however Apple doesn't have "tags" as a Reminders dictionary item in AppleScript.

Other than that, this works fine:

property defaultList : "Inbox"


tell application "OmniFocus"

activate

tell front document of application "OmniFocus"

set theProjects to flattened projects -- Gets all projects, ignoring folders

repeat with aProject in theProjects

set projectName to name of aProject

set projectStatus to completed of aProject

-- Process only if the project is not completed

if not projectStatus then

set theTasks to tasks of aProject

-- Create a list in Reminders for each non-completed project

my createListInReminders(projectName)

repeat with aTask in theTasks

set taskStatus to completed of aTask

-- Process only if the task is not completed

if not taskStatus then

set theTaskName to name of aTask

set theNote to note of aTask

set theDueDate to due date of aTask

set isFlagged to flagged of aTask -- Check if the task is flagged

-- Determine priority based on flagged status

set thePriority to 0 -- default no priority

if isFlagged then

set thePriority to 1 -- high priority for flagged tasks

end if

-- Add tasks to the corresponding list in Reminders

my createReminder(projectName, theTaskName, theDueDate, theNote, thePriority)

end if

end repeat

end if

end repeat

end tell

end tell


on createListInReminders(listName)

tell application "Reminders"

if not (exists (list listName)) then

make new list with properties {name:listName}

end if

end tell

end createListInReminders


on createReminder(thelist, theTask, theDate, theNote, thePriority)

try

set theBody to theNote

tell application "Reminders"

if not (exists (list thelist)) then

my createListInReminders(thelist)

end if

tell list thelist of default account

if theDate is not missing value then

make new reminder with properties {name:theTask, remind me date:theDate, body:theBody, priority:thePriority}

else

make new reminder with properties {name:theTask, body:theBody, priority:thePriority}

end if

end tell

end tell

on error

-- Error handling can be implemented here if needed

end try

end createReminder





Please leave comments below.