Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

Apple Script to remove duplicate entries in iCal
For people suffering from duplicate entries in their ICal database,
here's a script that identifies and then removes them.  This used to be
available on Apple's discussion boards, but then it disappeared.  It's
a very helpful script for anyone who's suffered the consequences of a
poorly executed synchronization from one calendar application to
another.

-- Delete duplicates from iCal v2 --
-- Applescript -- John Maisey 27/5/5 --
-- Modified 2/6/5 --
-- Duplicates being events with same title and start time in one
calendar--

tell application "iCal"
set sourceCal to first calendar whose title is (item 1 of (choose from
list =AC
(title of (every calendar) as list) with prompt "Choose calendar to
delete duplicates"))
set testThen to (current date) -- time tester
set mySumms to summary of events of sourceCal
set myStarts to start date of events of sourceCal
set myUIDs to uid of events of sourceCal
end tell

script myStuff
property aSumms : {}
property aStarts : {}
property aUIDs : {}
property aDeletes : {}
end script

set myStuff's aSumms to mySumms
set myStuff's aStarts to myStarts
set myStuff's aUIDs to myUIDs
set myLength to length of myStuff's aStarts

repeat with aNum from 1 to (myLength - 1)
set thisSumm to (item aNum of myStuff's aSumms)
set thisStart to (item aNum of myStuff's aStarts)
repeat with bNum from (aNum + 1) to myLength
set thatSumm to (item bNum of myStuff's aSumms)
set thatStart to (item bNum of myStuff's aStarts)
if thisSumm is equal to thatSumm and thisStart is equal to thatStart
then
set the end of myStuff's aDeletes to (item bNum of myStuff's aUIDs)
exit repeat
end if
end repeat
end repeat

set n to count of myStuff's aDeletes

tell application "iCal"
repeat with myDel in myStuff's aDeletes
delete (every event of sourceCal whose uid is myDel)
end repeat
display dialog (n & " duplicates deleted in " & ((current date) -
testThen) & " seconds") as text -- time tester=20
end tell
--


Report this thread to moderator Post Follow-up to this message
Old Post
Mars21
10-25-05 12:56 PM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

MAC Applications archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 07:04 AM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.