Probleme mit einem Script seit Snow Leopard

E

erbhai

Neues Mitglied
Thread Starter
Dabei seit
11.05.2002
Beiträge
16
Reaktionspunkte
0
Hallo,
ich benutze ein Script in Rapidweaver 4.3.
Das Script übernimmt Termine aus iCal und listet sie auf einer Website zeitlich geordnet auf. Unter OS 10.5 funktionierte das sehr gut und ohne Probleme. Seit OS 10.6 bricht es ab.
Ich kenne mich mit Scriptprogrammierung nicht aus, das Script hatte ich im Netz gefunden. Gelesen habe ich, dass seit OS 10.6 die Syntax (?) verändert worden sei und ein altes Script u.U. angepasst werden muss. Bei dem von mir benutzten Script scheint das der Fall zu sein.
Es wäre schön, wenn jemand, der sich auskennt, das Script korrigiert. Ich bin auch bereit, mich dafür erkenntlich zu zeigen.
Gruß
Volker

Hier das Script:
set myCal to "GS-Westerode" -- change it as appropriate
set myPageContents to "<h2>Zukünftige Termine - Schulj. 2008/2009</h2>"
set myPageContents to myPageContents & "<p>Diese Termine wurden zuletzt aktualisiert am: " & (current date) & "</p>" & getdata(myCal)
return myPageContents
on getdata(calName)
tell application "iCal"
set sd to date "Montag, 1. Januar 2007 12:00:00 Uhr"
set ed to date "Freitag, 31. Dezember 2010 12:00:00 Uhr"
try
set this_calendar to the first calendar whose title is the calName
set the returned_events to every event of this_calendar whose start date is greater than or equal to (current date) and start date is greater than or equal to sd and start date is less than or equal to ed
set these_events to {}
repeat with i from 1 to the count of the returned_events
set this_item to item i of the returned_events
if the class of this_item is event then
set the end of these_events to this_item
else if the class of this_item is list then
repeat with z from 1 to the count of this_item
set this_event to item z of this_item
if the class of this_event is event then
set the end of these_events to this_event
end if
end repeat
end if
end repeat
set total_events to the count of the returned_events
on error
return "<font color=\"#FF0000\">An error occurred while fetching events in iCal.</font>"
end try
try
set temp_events to these_events
repeat with i from 1 to total_events - 1
set z to i
set found_item to item i of these_events
repeat with j from i to total_events
set test1_item to item z of the these_events
set test2_item to item j of the these_events
set date1 to start date of test1_item
set date2 to start date of test2_item
if date2 is less than date1 then
set item j of temp_events to test1_item
set item z of temp_events to test2_item
end if
end repeat
end repeat
on error
return "<font color=\"#FF0000\">An error occurred while sorting data.</font>"
end try
try
set resultString to "<ul>"
repeat with this_event in temp_events -- loop in the list
--set the_name to summary of theEvent
--set the_date to short date string of (get start date of the theEvent)
set the event_properties to the properties of this_event
--set this_description to description of the event_properties
set this_summary to the summary of the event_properties
if this_summary is missing value then
set this_summary to "N/A"
end if
set this_location to the location of the event_properties
if this_location is missing value then
set this_location to "N/A"
end if
set start_date to short date string of (get start date of the event_properties)
set start_time to time string of (get start date of the event_properties)
set end_date to short date string of (get end date of the event_properties)
set end_time to time string of (get end date of the event_properties)
set event_description to the description of the event_properties
if event_description is missing value then
set event_description to "N/A"
end if
set event_URL to the url of the event_properties
if event_URL is missing value then
set event_URL to "N/A"
end if
set the event_recurrence to the recurrence of the event_properties
set prevTIDs to AppleScript's text item delimiters
set AppleScript's text item delimiters to "="
set repeatList to every text item of event_recurrence
set repeater to 0
if the (count of every text item of event_recurrence) is greater than 1 then
set repeater to 1
set newItem to last text item of repeatList as text
set newYear to text 3 thru 4 of newItem as string
if (item 5 of newItem) is equal to "0" then
set newMonth to item 6 of newItem as string
else
set newMonth to text 5 thru 6 of newItem as string
end if
if (item 7 of newItem) is equal to "0" then
set newDay to item 8 of newItem as string
else
set newDay to text 7 thru 8 of newItem as string
end if
set end_date to newMonth & "/" & newDay & "/" & newYear
set AppleScript's text item delimiters to prevTIDs
end if
set notimes to the allday event of event_properties
set resultString to resultString & "<i>" & start_date
if repeater is equal to 1 then
set resultString to resultString & " bis " & end_date
end if
set resultString to resultString & "</i> -- <b><u>"
if event_URL is equal to "N/A" then
set resultString to resultString & this_summary & "</b></u><ul>"
else
set resultString to resultString & "<a href=\"" & event_URL & "\">" & this_summary & "</a></b></u><ul>"
end if
if this_location is not equal to "N/A" then
set resultString to resultString & "<li>Location: " & this_location & "</li>"
end if
if not notimes then
set resultString to resultString & "<li><b>Zeit:</b> " & start_time & " bis " & end_time & "</li>"
end if
if event_description is not equal to "N/A" then
set resultString to resultString & "<li><b></b> " & event_description & "</li>"
end if
set resultString to resultString & "</ul></li><br />"
end repeat
set resultString to resultString & "</ul>"
return resultString
on error
return "<font color=\"#FF0000\">An error occurred while ending the script.</font>"
end try
end tell
end getdata
 
Hallo,

wie lautet die Fehlermeldung?

Viele Grüße
 
gerade mal probiert, wenn man oben in der ersten zeile den richtigen kalendar einträgt, funktioniert es doch...
 

Anhänge

  • Bildschirmfoto 2009-09-18 um 11.40.48.png
    Bildschirmfoto 2009-09-18 um 11.40.48.png
    18,2 KB · Aufrufe: 138
Bei mir nicht, wenn ich es unter OS 10.6 einsetze, unter 10.5. läuft es.
Wenn es bei dir unter 10.6 läuft, macht mich das noch ratloser.
Volker
 
heisst denn dein kalendar GS-Westerode, den du auslesen willst?
 
bei mir gibt es dann keinen fehler, aber ich krieg auch kein event ausgegeben.
hab gerade eins zum testen eingetragen...
 
Ich habe noch einmal ein Bild von der Ausgabe unter OS 10.5 angehängt. Das Script ist unverändert geblieben.
 

Anhänge

  • Bild 1.png
    Bild 1.png
    24,4 KB · Aufrufe: 132
so problem gefunden: recurrence wurde nicht gegen missing value gecheckt:

Code:
			set the event_recurrence to the recurrence of the event_properties
			if event_recurrence is missing value then
				set event_recurrence to "N/A"
			end if

behebt es...
 
Zuletzt bearbeitet:
  • Gefällt mir
Reaktionen: erbhai
SUPER!
Du glaubst gar nicht, wie du mir damit geholfen hast.
Danke
Volker
 
Zurück
Oben Unten