Hello!
Being just a happy user of AppleScripts I’m having problems with an old OS9 script in OSX.
The script creates an (Outlook Express) mail with selected (by category) appointments from Palm Desktop.
(after the first error prompt, I tried to change the syntax, but I think, it made it worse
Is there a list of changed commands? Are you guys so good, that you can point out the promblems directly?
Any help is very appreciated!
Here is the script:
I changed this line:
repeat with n from 1 to (count event on day tomorrowDate)
to
repeat with n from 1 to (count event of calendar day tomorrowDate)
now I’m getting an error here:
set theCat1 to primary category of appoint as string
on to2Wide(theInt)
local theString
set theString to theInt as string
if (count of the characters of theString) is 1 then
set theString to “0” & theString
end if
return theString
end to2Wide
on toStringTime(theTime)
local theHours
local theMinutes
set theHours to theTime div hours
set theMinutes to (theTime - theHours * hours) div minutes
– display dialog "in toStringTime, theHours: " & theHours & " theMinutes: " & theMinutes
return “” & theHours & “:” & to2Wide(theMinutes)
end toStringTime
set tomorrowDate to a reference to (current date)
–set tomorrowDate to a reference to current date
tell application “Palm Desktop”
set m to {}
set n to {}
set appointList to {}
repeat with m from 1 to 99
set tomorrowDate to ((current date) + (m * (3600 * 24)))
--show DateRest Terminbereich in window "Daily Calendar"
repeat with n from 1 to (count event of calendar day tomorrowDate)
--set currentAppoint to appointment n of day (current date)
--set taskList to taskList & {get title of task (objNumber of currentTask)}
set appoint to (a reference to event n of calendar day tomorrowDate)
set theAppoint to event n of calendar day tomorrowDate
set theTitle to title of appoint
set theCattoGrab1 to " Presse VF"
set theCattoGrab2 to "Presse alt"
set theCat1 to primary category of appoint as string
set theCat2 to secondary category of appoint as string
set theDay to tomorrowDate as string
set theDaytoGrab to characters 1 thru ((count (characters of theDay)) - 12) of theDay as string
-- display dialog ((item 1 of ((appointment n of day tomorrowDate) as list)) as string)
if item 1 of (theAppoint as list) is equal to «class RAPP» then
set appointEntry to name of appoint
else
set theStartTime to start time of appoint as integer
set theEndTime to end time of appoint as integer
set appointEntry to "" & theDaytoGrab & tab & my toStringTime(theStartTime) & tab & "-" & my toStringTime(theEndTime) & tab & theTitle
end if
if the theCat1 is equal to theCattoGrab1 or the theCat2 is equal to theCattoGrab1 or the theCat1 is equal to theCattoGrab2 or the theCat2 is equal to theCattoGrab2 then
set appointList to appointList & {appointEntry}
end if
end repeat
end repeat
set contactName to full name of address 0
end tell
tell application “Palm Desktop” to set contactEmail to field text of custom one of address 0
if (count of appointList) is 0 then
display dialog “Keine Filmtermine während
der nächsten drei Wochen.”
return
else
say “Constructing Service Mail”
end if
tell application “Microsoft Entourage”
set theSubject to “Termine der nächsten Wochen” as string
set outputString to “”
repeat with n from 1 to count of items in appointList
set outputString to outputString & return & item n of appointList
end repeat
make new outgoing message with properties {subject:“Pressetermine der nächsten Wochen”, content:“Liebe KollegInnen, hier wieder ein Update mit den nächsten Presseterminen.” & return & “Viel Spaß!” & return & return & “cd - CineDom Köln” & return & “Off - Off-Broadway Köln” & return & “Ufa-K - Ufa-Palast Köln” & return & “” & return & “ufa-D - Ufa-Palast Düsseldorf” & return & “(wie immer ohne Gewähr + nach bestem Gewissen)” & return & outputString}
activate
end tell