Mac:~ dima$ whatis calendar
Mac:~ dima$ whatis calendar cal(1), ncal(1) - displays a calendar and the date of easter calendar(1) - reminder service iwidgets_calendar(n), iwidgets::calendar(n) - Create and manipulate a monthly calendar widget_calendar(n) - widget::calendar Megawidget
set startDate to date ", 25 2015 ., 0:00:00" set endDate to date ", 25 2015 ., 10:00:00" tell application "Calendar" tell calendar ", " make new event with properties {description:"Test", summary:"Something", start date:startDate, allday event:true} end tell end tell
using System; namespace barca_matches_to_the_calendar { /// <summary> /// . /// </summary> public class SingleMatch { /// <summary> /// . /// </summary> /// <value> <see cref="DateTime"/>.</value> public DateTime StartTime { get; set; } /// <summary> /// . /// </summary> /// <value> .</value> public string Tournament { get; set; } /// <summary> /// -. /// </summary> /// <value> - .</value> public string Rival { get; set; } /// <summary> /// ( /). /// </summary> /// <value> (" "/"").</value> public string Place { get; set; } /// <summary> /// SingleMatch /// <see cref="barca_matches_to_the_calendar.SingleMatch"/> class. /// </summary> public SingleMatch() { StartTime = new DateTime(); Tournament = null; Rival = null; Place = null; } /// <summary> /// SingleMatch /// <see cref="barca_matches_to_the_calendar.SingleMatch"/> class. /// </summary> /// <param name="startTime"> .</param> /// <param name="tournament">.</param> /// <param name="rival">.</param> /// <param name="place"> ( /).</param> public SingleMatch(DateTime startTime, string tournament, string rival, string place) { StartTime = startTime; Tournament = tournament; Rival = rival; Place = place; } /// <summary> /// a <see cref="System.String"/>, /// <see cref="barca_matches_to_the_calendar.SingleMatch"/>. /// </summary> /// <returns> /// a <see cref="System.String"/>, /// <see cref="barca_matches_to_the_calendar.SingleMatch"/>. /// </returns> public override string ToString() { return string.Format(" ={0}, ={1}, ={2}, ={3}", StartTime, Tournament, Rival, Place); } } }
using System.Collections.Generic; namespace barca_matches_to_the_calendar { public class Matches { /// <summary> /// . /// </summary> /// <value> .</value> public string NameFC { get; set; } /// <summary> /// /// </summary> /// <value> </value> public List<SingleMatch> ListMatches { get; set; } /// <summary> /// Initializes a new instance of the <see cref="barca_matches_to_the_calendar.Matches"/> class. /// </summary> public Matches() { ListMatches = new List<SingleMatch>(); NameFC = null; } /// <summary> /// Initializes a new instance of the <see cref="barca_matches_to_the_calendar.Matches"/> class. /// </summary> /// <param name="nameFC"> .</param> public Matches(string nameFC) { ListMatches = new List<SingleMatch>(); NameFC = nameFC; } /// <summary> /// a <see cref="System.String"/>, /// <see cref="barca_matches_to_the_calendar.Matches"/>. /// </summary> /// <returns> /// a <see cref="System.String"/>, /// <see cref="barca_matches_to_the_calendar.Matches"/>. /// </returns> public override string ToString() { return string.Format(" \"{0}\", {1}", NameFC, ListMatches); } } }
using System; using HtmlAgilityPack; using System.Collections.Generic; using System.Linq; namespace barca_matches_to_the_calendar { class MainClass { public static void Main(string[] args) { // , . string WebAddress = @"http://www.sports.ru/barcelona/calendar/"; // - - HtmlWeb WebGet = new HtmlWeb(); // html- . HtmlDocument htmlDoc = WebGet.Load(WebAddress); // Matches MatchesFC = new Matches(); // ( ) MatchesFC.NameFC = htmlDoc.DocumentNode. SelectSingleNode(".//*[@class='titleh2']"). FirstChild.InnerText.Replace("\r\n", ""); // XPath-. HtmlNode Table = htmlDoc.DocumentNode.SelectSingleNode(".//*[@class='stat-table']/tbody"); // - "tr". IEnumerable<HtmlNode> rows = Table.Descendants().Where(x => x.Name == "tr"); foreach (var row in rows) { // . HtmlNodeCollection cells = row.ChildNodes; // SingleMatch, . SingleMatch match = new SingleMatch(); // , "|", // TryParse . DateTime time; DateTime.TryParse(cells[1].InnerText.Replace("|", " "), out time); match.StartTime = time; // , . match.Tournament = cells[3].InnerText; // "" (" ") match.Rival = cells[5].InnerText.Replace(" ", ""); match.Place = cells[6].InnerText; // . MatchesFC.ListMatches.Add(match); } // . foreach (SingleMatch match in MatchesFC) { // // ( ) string path = @"matches.txt"; // using (StreamWriter file = new StreamWriter(path, true)) { file.WriteLine(match); } } Console.WriteLine(" !"); } } }
tell application "Finder" -- , (.. ) set Matches to paragraphs of (read (choose file with prompt " , ")) repeat with Match in Matches if length of Match is greater than 0 then -- '=', ',' '\n' set AppleScript's text item delimiters to {"=", ",", ASCII character 13} -- my CreateEvent(text item 2 of Match, text item 4 of Match, text item 6 of Match, text item 8 of Match, text item 10 of Match) end if end repeat end tell on CreateEvent(textDate, tournament, fc, rival, place) -- set startDate to the current date set the day of startDate to (text 1 thru 2 of textDate) set the month of startDate to (text 4 thru 5 of textDate) set the year of startDate to (text 7 thru 10 of textDate) set the hours of startDate to (text 12 thru 13 of textDate) set the minutes of startDate to (text 15 thru 16 of textDate) set the seconds of startDate to (text 18 thru 19 of textDate) -- set endDate to (startDate + 2 * hours) tell application "Calendar" create calendar with name "" tell calendar "" -- make new event with properties {description:"" & fc & " : " & rival & ". " & place, summary:"", start date:startDate, end date:endDate} end tell end tell end CreateEvent
using System; using HtmlAgilityPack; using System.Collections.Generic; using System.Linq; using DDay.iCal; using DDay.iCal.Serialization.iCalendar; using System.Security.Cryptography; namespace barca_matches_to_the_calendar { class MainClass { public static void Main(string[] args) { // , . string WebAddress = @"http://www.sports.ru/barcelona/calendar/"; // - - HtmlWeb WebGet = new HtmlWeb(); // html- . HtmlDocument htmlDoc = WebGet.Load(WebAddress); // Matches MatchesFC = new Matches(); // ( ) MatchesFC.NameFC = htmlDoc.DocumentNode. SelectSingleNode(".//*[@class='titleH1']"). FirstChild.InnerText.Replace("\r\n", ""); // XPath-. HtmlNode Table = htmlDoc.DocumentNode.SelectSingleNode(".//*[@class='stat-table']/tbody"); // - "tr". IEnumerable<HtmlNode> rows = Table.Descendants().Where(x => x.Name == "tr"); foreach (var row in rows) { // . HtmlNodeCollection cells = row.ChildNodes; // SingleMatch, . SingleMatch match = new SingleMatch(); // , "|", // TryParse . DateTime time; DateTime.TryParse(cells[1].InnerText.Replace("|", " "), out time); match.StartTime = time; // , . match.Tournament = cells[3].InnerText; // "" (" ") match.Rival = cells[5].InnerText.Replace(" ", ""); match.Place = cells[6].InnerText; // . MatchesFC.ListMatches.Add(match); } // , . iCalendar CalForMatches = new iCalendar { Method = "PUBLISH", Version = "2.0" }; // Mac, // (.. Mac Calendar) CalForMatches.AddProperty("CALSCALE", "GREGORIAN"); CalForMatches.AddProperty("X-WR-CALNAME", "M " + MatchesFC.NameFC); CalForMatches.AddProperty("X-WR-TIMEZONE", "Europe/Moscow"); CalForMatches.AddLocalTimeZone(); // . foreach (SingleMatch match in MatchesFC.ListMatches) { Event newMatch = CalForMatches.Create<Event>(); newMatch.DTStart = new iCalDateTime(match.StartTime); newMatch.Duration = new TimeSpan(2, 30, 0); newMatch.Summary = string.Format("{0} : {1}", MatchesFC.NameFC, match.Rival); newMatch.Description = string.Format("{0}. {1} : {2}, {3}", match.Tournament, MatchesFC.NameFC, match.Rival, match.Place); // , Alarm alarm = new Alarm(); alarm.Trigger = new Trigger(TimeSpan.FromMinutes(-10)); alarm.Description = " "; alarm.AddProperty("ACTION", "DISPLAY"); newMatch.Alarms.Add(alarm); } // . iCalendarSerializer serializer = new iCalendarSerializer(); serializer.Serialize(CalForMatches, MatchesFC.NameFC + ".ics"); Console.WriteLine(" " + Environment.NewLine); return; } } }
alarm.AddProperty("ACTION", "DISPLAY");
alarm.Action = AlarmAction.Display;
because of which all the reminders did not want to be imported into the calendar just because the word “Display” was not written in capital letters, but as an ordinary word and the poppy calendar could not recognize this monstrous cryptocode .Source: https://habr.com/ru/post/265393/
All Articles