Last active
January 7, 2020 00:27
-
-
Save kyleturman/7b947741005bdb94d5d5e994ea4eb36a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(* | |
Meet with Google Calendar | |
- | |
A way to create a meeting invite quickly from | |
a selected email address in macOS. | |
1. Open Automator on your Mac and create a new Quick Action | |
2. Change "Workflow recieves current" to "text" and in "any application" | |
3. Find "Run AppleScript" in the Actions library on the left and double click it | |
4. Paste in the contents of this file | |
5. Save the quick action (CMD+S) and name it something like "Meet with Google Calendar" | |
6. Open System Preferences -> Keyboard -> Shortcuts then click "Services" on left | |
7. Scroll down to the "Text" section and find your quick action | |
8. Double click where it says "none" on the side and give it a shortcut (I did Shift+CMD+') | |
9. Select an email address with your cursor and press your keyboard shortcut! | |
*) | |
on run {input, parameters} | |
set email to (input as text) | |
set start_time to current date | |
tell start_time | |
set {its hours, its minutes, its seconds} to {hours, 0, 0} | |
end tell | |
set end_time to start_time + 0 | |
tell end_time | |
set its minutes to 30 | |
end tell | |
set cal_url to "https://calendar.google.com/calendar/r/eventedit?add=" & email & "&dates=" & date_time_to_iso(start_time) & "/" & date_time_to_iso(end_time) | |
open location cal_url | |
return input | |
end run | |
on date_time_to_iso(dt) | |
set {year:y, month:m, day:d, hours:h, minutes:min, seconds:s} to dt | |
set y to text 2 through -1 of ((y + 10000) as text) | |
set m to text 2 through -1 of ((m + 100) as text) | |
set d to text 2 through -1 of ((d + 100) as text) | |
set h to text 2 through -1 of ((h + 100) as text) | |
set min to text 2 through -1 of ((min + 100) as text) | |
set s to text 2 through -1 of ((s + 100) as text) | |
return y & m & d & "T" & h & min & s | |
end date_time_to_iso |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment