Iam having a hard time cracking this. I have read an ICS file into AppleScript and I need to parse it. This is my code
set calURL to "https://url.to.ics"
set calenderData to do shell script "curl " & calURL
The data reads in fine, but I need to parse it. I want the script to read data between BEGIN:VEVENT and END:VEVENT for every event. Iam not sure how to do this, but with a foreach loop or something?
Here is a sample calender containing my exams.
BEGIN:VCALENDAR VERSION:2.0 X-WR-CALNAME:Eksamener X-WR-CALDESC: X-APPLE-CALENDAR-COLOR:#CC2B23FF BEGIN:VEVENT UID:C96EF18C-5D17-4170-8C67-832B7F90B464 SUMMARY:TK 1100 Eksamen SEQUENCE:0 LOCATION: DTSTART;VALUE=DATE:20111213 DTEND;VALUE=DATE:20111214 END:VEVENT BEGIN:VEVENT UID:BDBE0B4B-FF3D-4245-B23F-F1BF25F65998 SUMMARY:DB 1100 Eksamen SEQUENCE:0 LOCATION: DTSTART;VALUE=DATE:20111006 DTEND;VALUE=DATE:20111007 END:VEVENT BEGIN:VEVENT UID:21261AF0-FDA7-432B-B513-CC3A9C04393D SUMMARY:PG 1100 Eksamen SEQUENCE:0 LOCATION: DTSTART;VALUE=DATE:20111216 DTEND;VALUE=DATE:20111217 END:VEVENT END:VCALENDAR
This is not related to school, I just want to parse the data to view it on my desktop (GeekTool).
You need to use text item delimiters. Try this and see if you can understand how it works.