Title: Re: Category of Event via apple script
Paul,

Thanks very much! What a big help. Below is an Apple Script that will place all events within a given date range into an open Excel worksheet. I now can use Entourage to keep track of client billing. I already have a system that filters such a list from the exported calendar items for Palm desktop (which I’m now enthusiastically discarding) in to individual billing records.  It’s a simple matter from here to maintain an Excel list of all pertinent categories, and then simply fire this script from Excel and then filter the list from Entourage to generate the invoices. One button push in Excel will get the whole job done.

Here’s the script for anyone who is interested.  Many thanks again to Paul Berkowitz who got me over an incredible impasse.

-- Note that these dates are for testing, you’ll have to change them as needed
set startdate to date "Sunday, October 1, 2000 12:00:00 AM"
set EndDate to date "Thursday, November 30, 2000 12:00:00 AM"
set RowNum to 2
set ods to AppleScript's text item delimiters -- the default {""} normally
set AppleScript's text item delimiters to {", "}
tell application "Microsoft Excel" to set FormulaR1C1 of Range "a1:f1" to {"Start", "End", "Duration", ¬ "Subject", "Description", "Category"}
tell application "Microsoft Entourage"
    
set searchResults to every event whose start time ¬
        
is greater than startdate and ¬
        
start time is less than EndDate
    
    
if (count of searchResults) > 1 then
       repeat with theEvent in searchResults
            
set sStart to start time of theEvent
            
set EEnd to end time of theEvent
            
set Ssubject to subject of theEvent
            
set Desc to content of theEvent
            
set theCats to category of theEvent
            
if theCats = {} then
               set theCats to "None"
            
else
               set catNames to {}
                
repeat with aCat in theCats
                    
set end of catNames to name of aCat
                
end repeat
               set catNames to catNames as string
           end if
           set sRange to "r" & RowNum & "c1:r" & RowNum & "c6"
            
tell application "Microsoft Excel" to set FormulaR1C1 of Range sRange to {sStart, ¬
                EEnd, "=24*(rc[-1]-rc[-2])", Ssubject, Desc, catNames}
            
set RowNum to RowNum + 1
        
end repeat
   end if
   set AppleScript's text item delimiters to ods -- restore delimeters
end tell



-----------------------
Bob Greenblatt
[EMAIL PROTECTED]


Reply via email to