Scripters,
Script A below results in Fantastical (http://flexibits.com/fantastical) creating a Calendar.app entry with notes (the url).
Script B below will have Fantastical batch create Calendar.app entries but it does not include script logic and parsing to allow entry of notes. i.e. it could not add the url to the notes section of the calendar entry as Script A does.
Could any of you modify Script B so that it would break each line/paragraph it is fed into two parts: the part before the string “Notes:” and the part after, so the modified Script B could process entries with notes just like Script A?
For example, if Script B would pull this string from a file: “Softball game #1 at Martinez East on 5/15 at 8pm for 60 minutes Notes: http://tinyurl.com/bpc62mh” then it would process it along the lines of Script A with the appended ‘notes’ addition.
Thank you,
Erik
Script A
tell application “Fantastical”
parse sentence “Softball game #1 at Martinez East on 5/15 at 8pm for 60 minutes” notes “http://tinyurl.com/bpc62mh”
end tell
Script B
– Created based on code found in these sources:
– https://discussions.apple.com/thread/3956557?start=0&tstart=0
– https://discussions.apple.com/thread/3678943?start=0&tstart=0
– ask the user for a file:
set theFile to (choose file)
– read the file contents:
set theFileContents to (read theFile)
– break out the lines/paragraphs of text:
set theLines to paragraphs of theFileContents
– now iterate through those lines, one by one:
repeat with eachLine in theLines
tell application “Fantastical”
activate
parse sentence eachLine with add immediately
– delay 1
– tell application “System Events”
– keystroke return using command down --CMD+Enter
– keystroke return using command down --CMD+Enter
delay 2
– end tell
end tell
end repeat