• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: iCal organization with dates & events & lists....
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: iCal organization with dates & events & lists....


  • Subject: Re: iCal organization with dates & events & lists....
  • From: Adam Wuellner <email@hidden>
  • Date: Fri, 18 Mar 2005 11:27:47 -0600

On Thu, 17 Mar 2005 01:21:05 -0800 (PST), Patrick Collins
<email@hidden> wrote:

>  set string_fun to 1
>  set list_number to 0
>  set event_choose to {}
>  set final_location to ""
>  set final_url to ""
>  set uid_list to {}
>  set attendee_list to {}
>  set summary_list to {}
>  set description_list to {}
>  set startdate_list to {}
>  set enddate_list to {}
>  set status_list to {}
>  set url_list to {}
>  set location_list to {}
>  set final_description to ""
>  set final_status to ""
>  tell application "iCal"
>          activate
>          set visible of window "iCal" to true
>          set the_cal to the title of every calendar
>          set list_choice to (choose from list the_cal)
>          set list_string to (list_choice as string)
>          repeat with list_number in my the_cal
>                  set descriptionval to {item string_fun of the_cal} as string
>                  if descriptionval = list_string then
>                  else
>                          set string_fun to string_fun + 1
>                  end if
>          end repeat
>
>          set event_list to calendar string_fun's events
>          repeat with event_cur in my event_list
>                  tell event_cur
>                          set editdate to (start date as string)
>                          set the end of event_choose to editdate & "   " & summary
>                          set the end of summary_list to summary
>                          set the end of startdate_list to start date
>                          set the end of enddate_list to end date
>                          set the end of location_list to location
>                          set the end of url_list to url
>                          set the end of description_list to description
>                          set the end of status_list to status
>                          set the end of attendee_list to {display name of attendees}
>                          set the end of uid_list to uid
>                  end tell
>          end repeat
>
>          set event_choice to (choose from list event_choose)
>
>          repeat with I from 1 to (count of event_choose)
>                  set char_line to item I of event_choose
>
>                  if (char_line as string) is equal to (event_choice as string) then
>
>                          set the_uid to item I of uid_list
>                          set the_summary to item I of summary_list
>                          set the_startdate to item I of startdate_list
>                          set the_enddate to item I of enddate_list
>                          set the_location to item I of location_list
>                          set the_url to item I of url_list
>                          set the_attendee to item I of attendee_list
>                          set the_status to item I of status_list
>                          set the_description to item I of description_list
>
>                          exit repeat
>                  end if
>          end repeat
>  end tell

I'd replace everything to this point with something like:

tell application "iCal"
	set calendar_titles to title of calendars
	set chosen_cal to first calendar whose title is (first item of
(choose from list calendar_titles))
	set event_list to events of chosen_cal
	set event_choose to {}
	repeat with event_cur in event_list
		tell contents of event_cur
			set editdate to (start date as string)
			set the end of event_choose to editdate & "   " & summary
		end tell
	end repeat

	set event_choice to (choose from list event_choose)

	repeat with I from 1 to (count of event_choose)
		set char_line to item I of event_choose
		if (char_line as string) is equal to (event_choice as string) then
			tell contents of item I of event_list to ¬
				set {the_uid, the_summary, the_startdate, the_enddate,
the_location, the_url, the_attendee, the_status, the_description} to ¬
					{uid, summary, start date, end date, location, url, {display name
of attendees}, status, description}
			exit repeat
		end if
	end repeat
end tell

Watch for wrapped lines.

That still doesn't help you with sorting, but it improves the speed.
For sorting, as John M said, you're best off trying to sort the date
objects, since you can just compare dates with arithmetic operators (
< > = etc.).
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >iCal organization with dates & events & lists.... (From: "Patrick Collins" <email@hidden>)

  • Prev by Date: Re: .acgi & form to send vars to an APP
  • Next by Date: Re: Round a number towards zero!
  • Previous by thread: Re: iCal organization with dates & events & lists....
  • Next by thread: Re: iCal organization with dates & events & lists....
  • Index(es):
    • Date
    • Thread