ShareShortcuts

Weekly agenda and weather

twilsonco
Fork “Weekly agenda and weather”

Built something new on top of this Shortcut? Share it as a fork: it becomes a Shortcut of your own, which you manage, and both pages link to each other so twilsonco gets credit.

  1. 1Get the Shortcut and change it in the Shortcuts app. Give it a name of its own.
  2. 2Share it from the Shortcuts app and copy the iCloud link.
  3. 3Come back here, paste the link and describe what is different, e.g. “Added a step that uses Apple Intelligence to personalise the text.”
Downloads
26K
Saved
0
Actions
125
Category
Productivity
Version
1.0
Language
EN

Summarized by "Google via API"

Define a list of iOS calendars and reminder lists which are used to fetch your scheduled events for the week, and have Gemini read back a summary of your agenda along with the weather, translated into the specified language.

Uses "Gemini via API" shortcut and "Weather summary" shortcut.

What's New

Version 1.0

First release

Version History
1.0 Feb 9, 2024

First release

What it does

125 actions
  1. Comment
    Weekly agenda and weather By Tim Wilson, November 2023 Use Google Gemini to read back a natural summary of your week’s agenda along with weather information. Uses “Gemini via API” shortcut https://routinehub.co/shortcut/17624/. And “Weather Summary”…
  2. Comment
    Enter language into which Google Gemini should translate responses
  3. Text
  4. Change Case
  5. Comment
    Enter your name
  6. Text
  7. Comment
    Enter a list of calendars that should be used to check your daily agenda
  8. Text
  9. Comment
    Enter a list of reminder lists that should be used in creating your agenda.
  10. Text
  11. Comment
    For checking for overdue reminders, how many days into the past should be checked?
  12. Number
  13. Comment
    Check for shortcut updates
  14. Nothing
  15. Comment
    【Auto-Update Routine】 Checks For Latest Shortcut Version ↳ https://routinehub.co/shortcut/16590/
  16. Dictionary
  17. Get Dictionary Value
  18. If
  19. Get IP Address
  20. If
  21. Get Contents of URL
    https://routinehub.co/api/v1/shortcuts/…/versions/latest
  22. If
  23. Split Text
  24. Repeat with Each
  25. Calculate Expression
  26. Set Variable
    Latest Version
  27. Split Text
  28. Repeat with Each
  29. Calculate Expression
  30. Set Variable
    Current Version
  31. If
  32. Choose from Menu
    New Version: … Release: … Whats New: "…"
  33. Choose from Menu
    Update → Result (Version)
  34. Expand URL
  35. Replace Text
  36. Open URLs
  37. Stop This Shortcut
  38. Choose from Menu
    Skip (Info (Version))
  39. Comment
    【Auto-Update Routine Ends Here】 Support → https://www.reddit.com/r/shortcuts/comments/18j4f9p/ 【⚙️】 Convert Semantic Number to Decimals ↳ https://routinehub.co/shortcut/16589/
  40. Nothing
  41. Comment
    Begin dependency check (using “Check-install dependencies (v1)” by Tim Wilson: https://routinehub.co/shortcut/17694/) Dictionary of dependencies, where each: * Key is the name fo the shortcut (used to check if install, so much match perfectly), and …
  42. Dictionary
  43. Get My Shortcuts
  44. Repeat with Each
  45. Filter Files
  46. If
  47. Get IP Address
  48. If
  49. Show Result
  50. If
  51. Show Result
  52. Get Dictionary Value
  53. Set Variable
    URL
  54. Match Text
  55. If
  56. Get Contents of URL
    https://routinehub.co/api/v1/shortcuts/…/versions/latest
  57. Expand URL
  58. Set Variable
    URL
  59. Replace Text
  60. Open URLs
  61. Stop This Shortcut
  62. Nothing
  63. Comment
    End dependency check
  64. Text
  65. Text
  66. Date
  67. Nothing
  68. Set Variable
    Events
  69. Get Time Between Dates
  70. If
  71. Text
  72. If
  73. Text
  74. Dictionary
  75. Run Shortcut
    Gemini via API
  76. Speak Text
  77. Number
  78. Find Calendar Events
  79. Repeat with Each
  80. Match Text
  81. If
  82. Get Details of Calendar Events
  83. Text
  84. Add to Variable
  85. Adjust Date
  86. Adjust Date
  87. Adjust Date
  88. Set Variable
    Reminders
  89. Find Reminders
  90. Repeat with Each
  91. Match Text
  92. If
  93. Get Details of Reminders
  94. Text
  95. Add to Variable
  96. Get Current Location
  97. Get Current Weather
  98. Run Shortcut
    Weather summary
  99. Get Weather Forecast
  100. Run Shortcut
    Weather summary
  101. Get Weather Forecast
  102. Run Shortcut
    Weather summary
  103. If
  104. Text
  105. If
  106. Text
  107. If
  108. If
  109. Text
  110. If
  111. Text
  112. Text
  113. If
  114. Text
  115. Text
  116. Dictionary
  117. Run Shortcut
    Gemini via API
  118. Replace Text
  119. Set Variable
    Output
  120. If
  121. Text
  122. Dictionary
  123. Run Shortcut
    Gemini via API
  124. Set Variable
    Output
  125. Speak Text

View as code
Beta

Every action of this Shortcut written out as Cherri, a programming language for Shortcuts. Great for learning how it works.

#include 'actions/web'
#include 'actions/text'
#define color blue
#define glyph calendar

/*
Weekly agenda and weather
By Tim Wilson, November 2023

Use Google Gemini to read back a natural summary of your week’s agenda along with weather information.

Uses “Gemini via API” shortcut https://routinehub.co/shortcut/17624/. And “Weather Summary” shortcut.
*/
// Enter language into which Google Gemini should translate responses

const OutLanguage = "English"
const OutLanguageLower = uppercase(OutLanguage)
// Enter your name

const UserName = ""
// Enter a list of calendars that should be used to check your daily agenda

const ListOfCalendars = "Home\nWork"
// Enter a list of reminder lists that should be used in creating your agenda.

const ReminderListList = "Work\nReminders"
// For checking for overdue reminders, how many days into the past should be checked?

const ReminderNumPastDays = 7
// Check for shortcut updates

nothing()
/*
【Auto-Update Routine】
Checks For Latest Shortcut Version
↳ https://routinehub.co/shortcut/16590/
*/
const Info = {
	"Author": "twilsonco",
	"RoutineHub ID": 17675,
	"Version": "1.1.1",
	"Version Check": true
}
const True = getValue(Info, "Version Check")

if True == "Yes" {
	const CurrentIPAddress = getExternalIP("IPv4")
	if CurrentIPAddress {
		const Result = downloadURL("https://routinehub.co/api/v1/shortcuts/{Info['RoutineHub ID']}/versions/latest")
		if Result contains "success" {
			const SplitText = splitText(Result['Version'], ".")
			for _ in SplitText {
				@LatestVersion = ((1/1000)^@RepeatIndex)*@RepeatItem+@LatestVersion
			}
			const SplitText1 = splitText(Info['Version'], ".")
			for _ in SplitText1 {
				@CurrentVersion = ((1/1000)^@RepeatIndex)*@RepeatItem+@CurrentVersion
			}
			if @LatestVersion > @CurrentVersion {
				menu "New Version: {Result['Version']}\nRelease: {Result['Release']}\nWhats New: \"{Result['Notes']}\"" {
				item "Update → {Result['Version']}":
					expandURL(Result['URL'])
					const UpdatedText = replaceText("https://www.icloud.com/", "shortcuts://", false)
					openURL(UpdatedText)
					stop()
				item "Skip ({Info['Version']})":
				}
			}
		}
	}
}
/*
【Auto-Update Routine Ends Here】
Support → https://www.reddit.com/r/shortcuts/comments/18j4f9p/

【⚙️】
Convert Semantic Number to Decimals
↳ https://routinehub.co/shortcut/16589/
*/
nothing()
/*
Begin dependency check
(using “Check-install dependencies (v1)” by Tim Wilson: https://routinehub.co/shortcut/17694/)

Dictionary of dependencies, where each:
* Key is the name fo the shortcut (used to check if install, so much match perfectly), and each value is either:
  * The RoutineHub ID (number), or
  * The URL (text type; iCloud link to shortcut or some other URL)
*/
const DependencyDict = {
	"Gemini via API": 17624,
	"Weather summary": 17674
}
const FullShortcutList = getShortcuts()

for _ in DependencyDict['Keys'] {
	const Files = filterFiles(FullShortcutList, 1, "Last Modified Date", "Latest First")
	if !Files {
		const CurrentIPAddress1 = getExternalIP()
		if !CurrentIPAddress1 {
			show("This shortcut depends on the \"{@RepeatItem}\" shortcut, which was not found (by name) in your installed Shortcuts. You need to be connected to the internet in order to install it. Please connect and try again.")
		} else {
			show("This shortcut depends on the \"{@RepeatItem}\" shortcut, which was not found (by name) in your installed Shortcuts. Contiunue to install it now, then try this Shortcut again.")
			@URL = DependencyDict[@RepeatItem]
			const Matches = containsText(DependencyValue, "^[0-9]+$")
			if Matches {
				const Result1 = downloadURL("https://routinehub.co/api/v1/shortcuts/{DependencyValue}/versions/latest")
				expandURL(Result1['URL'])
				@URL
			}
			const UpdatedText1 = replaceText("https://www.icloud.com/", "shortcuts://", @URL, false)
			openURL(UpdatedText1)
		}
		stop()
	}
}
nothing()
// End dependency check

const TranslationPrompt = "I need to translate some text from English to {OutLanguage}. Where there are dates and times, I need to convert them into the appropriate format. For example, convert times to 24-hour time if necessary, and use the correct versions of \\"AM\\" and \\"PM\\" used in {OutLanguage}. \n\nThe text contains a summary of weather conditions as well, so please rephrase that in the new language in the style of a professional meteorologist from the language's country of origin. \n\nDo not include the original English message; only respond with the translated text. \n\nNow, please translate the following text into {OutLanguage}. \n\n"
const TranslationPromptShort = "please translate your response into the following language: {OutLanguage}. Do not include the English version of your response; only include your response translated into {OutLanguage}."
const Now = currentDate()
nothing()
@Events
rawAction("is.workflow.actions.gettimebetweendates", {
	"WFInput": "{Now}",
	"WFTimeUntilFromDate": "12:00PM"
})

if TimeBetweenDates <= 0 {
} else {
}
const Dictionary = {
	"disablelogging": 1,
	"prompt": "{}"
}
run("Gemini via API", Dictionary)
speak(['output'], false, "en-US")
const NumberOfDays = 7
rawAction("is.workflow.actions.filter.calendarevents", {
	"WFContentItemFilter": "",
	"WFContentItemSortOrder": "Oldest First",
	"WFContentItemSortProperty": "Start Date"
})

for _ in CalendarEvents {
	const Matches1 = containsText(ListOfCalendars, @RepeatItem['Calendar'], true)
	if Matches1 {
		getEventDetail(@RepeatItem, "Start Date")
		@Events += "{\\"title\\": \\"{@RepeatItem}\\", \\"start\\": \\"{}\\", \\"end\\": \\"{@RepeatItem['End Date']}\\", \\"duration\\": \\"{@RepeatItem['Duration']}\\", \\"all day\\": \\"{@RepeatItem['Is All Day']}\\", \\"location\\": \\"{@RepeatItem['Location']}\\", \\"attendees\\": \\"{@RepeatItem['Attendees']}\\", \\"calendar\\": \\"{@RepeatItem['Calendar']}\\"}"
	}
}
const OneWeekAgo = adjustDate(Now, "Subtract")
adjustDate(Now, "Add")
const TonightMidnight = adjustDate(, "Get Start of Day")
@Reminders
rawAction("is.workflow.actions.filter.reminders", {
	"WFContentItemFilter": "",
	"WFContentItemSortOrder": "Oldest First",
	"WFContentItemSortProperty": "Due Date"
})

for _ in Reminders {
	const Matches2 = containsText(ReminderListList, @RepeatItem['List'])
	if Matches2 {
		rawAction("is.workflow.actions.properties.reminders", {
			"WFContentItemPropertyName": "Due Date",
			"WFInput": "@RepeatItem"
		})
		@Reminders += "{\\"title\\": \\"{@RepeatItem}\\", \\"due date\\": \\"{}\\"}"
	}
}
const CurrentLocation = getCurrentLocation()
const CurrentWeather = getCurrentWeather(CurrentLocation)
const CurWeatherStr = run("Weather summary", CurrentWeather)
const HourlyForecast = getWeatherForecast("Hourly")
const HourlyWeatherStr = run("Weather summary", HourlyForecast)
const DailyForecast = getWeatherForecast("Daily")
const DailyWeatherStr = run("Weather summary", DailyForecast)

if @Events {
} else {
	const BlankText = "Please inform me that I have no more scheduled events for the week. \n\n"
}

if @Reminders {
	if @Events {
	} else {
	}
} else {
}
const Prompt = "{EventReminderPrompts}Please summarize the following weather information for {CurrentLocation['City']} fetched at {Now}.  First discussing current temperatures and conditions, and then how those will change for the remainder of the day, followed by the daily summary. When summarizing it, please verbally combine temperatures or conditions that persist over several hours or days. Summarize it the style of a professional meteorologist.  \n\nCurrent weather:\n{CurWeatherStr}\n\nHourly forecast:\n{HourlyWeatherStr}\n\nDaily forecast:\n{DailyWeatherStr}\n\nPlease write this in paragraph form, avoiding long words. Please be as concise as possible. Include a polite closing. Do not ask if I need more help or assistance. Do not include a greeting. The event and reminder summaries should precede the weather summary."
const Dictionary1 = {
	"disablelogging": 1,
	"prompt": "{Prompt}"
}
run("Gemini via API", Dictionary1)
replaceText("°(F|C)", "", ['output'], false, true)
@Output

if OutLanguageLower != "english" {
	const Dictionary2 = {
		"disablelogging": 1,
		"prompt": "{}"
	}
	run("Gemini via API", Dictionary2)
	@Output = ['output']
}
speak(@Output, true, "en-US")
Decompiled with cherri 2.3.0 (GPL-2.0). May need small fixes before it compiles.

Ratings & Reviews

Write a Review
–
out of 5
★★★★★
★★★★
★★★
★★
★
0 ratings

No reviews yet. Be the first to share what you think!

Advertisement

More by twilsonco

See All

You Might Also Like

See All
Advertisement