Results 1 to 2 of 2
  1. #1
    iCal edit/ modify Todo items with applescript

    Member Since
    Aug 03, 2013
    Posts
    3
    iCal edit/ modify Todo items with applescript
    I am trying to create an applescript that will automatically change to the priority of the todo list item based on the due date.
    The close it is to the due date the priority would change.

    I have an applescript that people can send me appointments via email. I use icalbuddy to display them on the desktop with geektool.

    I have used a do shell script command that get the uid (unique todo id key) which is below from icalbuddy

    Code:
     set theUids to do shell script "/usr/local/bin/icalBuddy -nc -uid  uncompletedTasks|grep uid|sed -e 's/u[^:]*://'"
    I found a script that finds iCal events with the uid but dont know how to modify it for todo list items

    Code:
    tell application "iCal"    tell calendar "Home"       set theEvent to first event whose uid = "1BCA3512-F3A9-4BCB-A0FD-BE812968D371"    end tell end tell
    thanks in advance for any help

  2. #2
    iCal edit/ modify Todo items with applescript

    Member Since
    Aug 03, 2013
    Posts
    3
    as I said in the post above I am trying to create an applescript that will automatically change to the priority of the todo list item based on the due date.

    I have found an application called Things that is scriptable.

    I also have the script addition Satimage.osax which has some useful commands.

    I have started the applescript using Things at the moment I have it sorting the to do by priority.
    I would like it to sorted them by date and if there are two with the same date then to look in the notes of the to do where I put the time and sort them by time.

    The code below is what I have so far which sorts them by priority.

    Main
    Code:
    tell application "Things"
    	try
    		close window "Things"
    	end try
    	set thelist to {}
    	set theToDos to to do of list "today"
    	set theCount to count theToDos
    	repeat with i from 1 to theCount
    		set ToDo to to do i of list "today"
    		
    		set thename to name of ToDo
    		set theduedate to due date of ToDo
    		set theduedate to date string of theduedate
    		set thenote to notes of ToDo
    		set thepriority to tag names of ToDo
    		
    		set theToDo to " " & thename & return & "due: " & theduedate & return & thenote & return & "priority: " & thepriority & return
    		
    		set end of thelist to theToDo
    		
    	end repeat
    	set listCount to count thelist
    	set new_list to {}
    	repeat with f from 1 to listCount
    		set itemlist to get item f of thelist
    		set lastword to last word of itemlist
    		
    		if lastword is equal to "High" then
    			set beginning of new_list to itemlist
    			
    		else if lastword is equal to "Medium" then
    			set end of new_list to itemlist
    			
    		else if lastword is equal to "Low" then
    			set end of new_list to itemlist
    			
    			
    		end if
    		
    		
    		
    	end repeat
    	
    	
    	
    	
    	
    	
    	
    	tell application "Finder"
    		activate
    		display dialog new_list as string buttons {"OK"} default button 1
    	end tell
    end tell
    the code below can be used to extract to time from the notes as I put other information in the notes as well as the time in this format 14:00.
    Code:
    set theOffset to offset of ":" in thenote
    set num to theOffset - 2
    set thetime to text (theOffset + 2) thru num of thenote
    set thehours to characters 1 thru 2 of thetime as string
    set themins to characters 4 thru 5 of thetime as string
    here is the command to set the priority in things below
    Code:
    set tag names of ToDo to "High" --"Medium" or "Low"
    the ToDo is a variable I set in the main code above.

    thanks for any help

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. AppleScript - I get a {} when trying to separate items into categories.
    By moonman239 in forum OS X - Development and Darwin
    Replies: 1
    Last Post: 01-16-2013, 02:27 PM
  2. iCal Todo alert reminders
    By dpbklyn in forum OS X - Apps and Games
    Replies: 0
    Last Post: 04-24-2012, 11:20 AM
  3. Appigo Todo Sync with iCal
    By orbit79 in forum iOS and Apps
    Replies: 1
    Last Post: 01-29-2011, 08:17 AM
  4. lost todo lists in ical when email server updated
    By csoares in forum OS X - Apps and Games
    Replies: 6
    Last Post: 12-13-2010, 07:57 AM
  5. Printing ToDo's on ICal
    By yugtun in forum OS X - Apps and Games
    Replies: 0
    Last Post: 09-30-2007, 01:51 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •