When I duplicated a calendar event, the alarm was not copied to the duplicate. Is it supposed to be this way?
Bruce
on 10/18/00 9:18 PM, Paul Berkowitz at [EMAIL PROTECTED] wrote:
On 10/18/00 4:32 PM, "Joshua Jabbour" <[EMAIL PROTECTED]> wrote:
> When I try to check syntax, I get “Expected “,” but found identifier”...
>
> Any ideas?
As it says, you need Akua Sweets 1.4.1 (probably 1.3.8 and 1.4 are OK , but no earlier). Sorry, everyone – I forgot that to compile a script with the actual terms in it, you really do need Akua. To use a script which I compiled and saved, you wouldn’t. Here’s a copy of the same script that will compile and work without having Akua, but will use Akua if you ever get it.
--------------------DUPLICATE CALENDAR EVENTS E ----------------------
global dateFormat
tell application "Microsoft Entourage"
set theName to name of window 1
set theEvents to (every event whose subject = theName)
set check to "Next"
repeat until check = "Done"
set lastEvent to last event whose subject = theName
set {theprops, theCategories, theLinks} to lastEvent's {properties, category, links}
if recurring of theprops then set recurring of theprops to false
set theStart to start time of theprops
set theEnd to end time of theprops
try
set theDate to («event AkusDtmQ» given «class from»:theStart, «class FoRM»:"%d") -- needs Akua Sweets!
on error
set dateFormat to my FormatDate()
set theDate to my ShortDate(theStart) -- always m/d/yy in correct order (no leading zeros, 2-digit year)
end try
set nextDay to theStart + (1 * days)
try
set nextDate to («event AkusDtmQ» given «class from»:nextDay, «class FoRM»:"%d")
set theTime to («event AkusDtmQ» given «class from»:theStart, «class FoRM»:"%t")
set theStop to («event AkusDtmQ» given «class from»:theEnd, «class FoRM»:"%t")
on error
set nextDate to my ShortDate(nextDay)
set theTime to my GetTime(theStart)
set theStop to my GetTime(theEnd)
end try
display dialog "Enter a date for the next " & theName & "." & return & return & "If same start and end times, click Done to finish or Next to add another date." & return & return & "To change times, click Change Time." default answer nextDate buttons {"Next", "Change Time", "Done"} default button "Done" with icon 1
set {check, nextDate} to {button returned, text returned} of result
if check is in {"Done", "Next"} then
tell me to set nextStart to date (nextDate & " " & theTime)
tell me to set nextEnd to date (nextDate & " " & theStop)
else
display dialog "Enter a start time for the next " & theName & " on " & nextDate & ":" default answer theTime buttons {"OK"} default button "OK" with icon 1
set nextTime to text returned of result
tell me to set nextStart to date (nextDate & " " & nextTime)
display dialog "Enter an end time for the next " & theName & " on " & nextDate & "." & "Click Done to finish or Next to add another date." default answer theStop buttons {"Next", "Done"} default button "Done" with icon 1
set {check, nextStop} to {button returned, text returned} of result
tell me to set nextEnd to date (nextDate & " " & nextStop)
end if
set start time of theprops to nextStart
set end time of theprops to nextEnd
set nextEvent to make new event with properties theprops
set category of nextEvent to theCategories
repeat with theLink in theLinks
link nextEvent to theLink
repeat with anEvent in theEvents
link nextEvent to anEvent
end repeat
end repeat
end repeat
close window 1 saving yes
display dialog "All done!" buttons {"OK"} default button "OK" with icon 1
end tell
to FormatDate()
get "1/2/3"
set testDate to date (result)
set theFormat to ""
repeat with i from 1 to 3 -- as in "1/2/3"
if i = the day of testDate then
get "dd"
else if (i + 2000) = the year of testDate then
get "yy"
else
get "mm"
end if
set theFormat to theFormat & the result & "/"
end repeat
return text 1 thru -2 of theFormat
end FormatDate
on ShortDate(theDate) --with thanks to Emmanuel Levy
copy theDate to d
set day of d to 1
copy d to f
set month of f to January
if dateFormat = "mm/dd/yy" then
return "" & (1 + (d - f + 1314900) div 2629800) & "/" & (day of theDate) & "/" & (text -2 thru -1 of ("" & year of theDate))
else if dateFormat = "dd/mm/yy" then
return (text -2 thru -1 of ("0" & (day of theDate))) & "/" & (text -2 thru -1 of ("0" & (1 + (d - f + 1314900) div 2629800))) & "/" & (text -2 thru -1 of ("" & year of theDate))
else if dateFormat = "yy/mm/dd" then
return "" & year of theDate & "/" & (text -2 thru -1 of ("0" & (1 + (d - f + 1314900) div 2629800))) & "/" & (text -2 thru -1 of ("0" & (day of theDate)))
else -- some wierd thing
return theDate -- leave it in long form
end if
end ShortDate
on GetTime(theDate)
set t to time string of theDate
try
if (count of words of t) > 3 then --(if in AM/PM format. or German)
set t to word 1 of t & ":" & word 2 of t & " " & word -1 of t
else -- 24-hr format
set t to word 1 of t & ":" & word 2 of t
end if
on error -- if German/Swedish-style "." time separators used or some other problem
set {ods, AppleScript's text item delimiters} to {AppleScript's text item delimiters, {"."}}
try
set t to text item 1 of t & "." & text item 2 of t
set AppleScript's text item delimiters to ods
on error
set AppleScript's text item delimiters to ods --make sure
end try --leave t as complete time string if there's any problem
end try
return t
end GetTime
--------------------end script--------------------------------------------
--
Bruce Klutchko
[EMAIL PROTECTED]
