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

automatically change to the priority of to do list based on due date applescript

Post Reply New Thread Subscribe

Thread Tools

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.

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.
tell application "Things"
		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"
		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.
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
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

« iCal edit/ modify Todo items with applescript | iPhoto Drag n Drop to Desktop issue »
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 Starter
Last Post
run applescript automatically on file and close humanengr OS X - Operating System 0 06-10-2012 05:11 PM
Finder won't start laurag OS X - Operating System 5 04-13-2012 05:46 PM
Change Folder date Help pimpgimp OS X - Operating System 0 08-18-2010 05:17 PM
How can you mass rename based on date on a MAC? Let me explain... visodd Images, Graphic Design, and Digital Photography 6 08-28-2008 05:38 PM

All times are GMT -4. The time now is 07:01 AM.

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

Welcome to

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?