New To Mac-Forums?

Welcome to our community! Join the discussion today by registering your FREE account. If you have any problems with the registration process, please contact us!

Get your questions answered by community gurus Advice and insight from world-class Apple enthusiasts Exclusive access to members-only contests, giveaways and deals

Join today!

 
Start a Discussion
 

Mac-Forums Brief

Subscribe to Mac-Forums Brief to receive special offers from Mac-Forums partners and sponsors

Join the conversation RSS
OS X - Operating System General OS operation information and support

iCal edit/ modify Todo items with applescript


Post Reply New Thread Subscribe

 
Thread Tools
wild4life

 
Member Since: Aug 03, 2013
Posts: 3
wild4life is on a distinguished road

wild4life is offline
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
QUOTE Thanks
wild4life

 
Member Since: Aug 03, 2013
Posts: 3
wild4life is on a distinguished road

wild4life is offline
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
QUOTE Thanks

Post Reply New Thread Subscribe


« Trouble connecting to wifi | automatically change to the priority of to do list based on due date applescript »
Thread Tools

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread
Thread Starter
Forum
Replies
Last Post
AppleScript - I get a {} when trying to separate items into categories. moonman239 OS X - Development and Darwin 1 01-16-2013 02:27 PM
Finder won't start laurag OS X - Operating System 5 04-13-2012 05:46 PM
I want to mass edit all events in an ical file bpetruzzo OS X - Apps and Games 1 03-13-2009 06:06 PM
Link contacts to To Do items in iCal Havana Switcher Hangout 0 04-22-2008 01:08 AM
iCal applescript always fails ganderson OS X - Apps and Games 0 11-09-2007 03:51 AM

All times are GMT -4. The time now is 03:21 PM.

Powered by vBulletin
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
X

Welcome to Mac-Forums.com

Create your username to jump into the discussion!

New members like you have made this community the ultimate source for your Mac since 2003!


(4 digit year)

Already a member?