Hi,
I’m new to Macs, Applescript and Programming and I am trying to build an App which enables me to load an HTML file and then extract information from it so I am able to recompile it into iCal Events.
This is a sample of the really poorly produced HTML file:
Ideally, I would like to split the dates into strings and subsequent information into separate strings so I can call up Item 1 of List A and collate it with Item 1 of List B and add them to an event in iCal for January 1st, for example.
I have this so far but I’m not getting past an error message which states "Can’t make {“Jan01”, “Jan02”, “Jan03”…} into type string.
property serialBeginning : “<DIV STYLE="top:93px;”
property serialEnd : “”
– Read a chosen file and prepare to search for serialBeginning
set theContents to read (choose file with prompt “Please choose your latest AIMS Roster”)
set originalDelimiters to AppleScript’s text item delimiters
set AppleScript’s text item delimiters to “width:88px" Class="S5">”
– Split the file into a list of strings that start with serialBeginning
– Ignore the first item, which is just the text before the occurence
set theItems to text items 2 thru 32 of theContents
– Iterate through the items to look for serial day termination strings
set serialArrayDate to {} – this will store the data
set AppleScript’s text item delimiters to {serialEnd}
repeat with nextItem in theItems
– Add text before serialEnd to serialArray
set serialArrayDate to serialArrayDate & first text item of nextItem
end repeat
set AppleScript’s text item delimiters to originalDelimiters
I’d be very grateful if any of you are able to point me in the right direction! Maybe a bit ambitious for a newb!!!