Jump to content

Workflow to get next meeting location/url and open it


Recommended Posts

I'd like help on creating a workflow that'd open the next zoom.us meeting on my calendar.

 

Specifically it'd 

1) get next calendar item

2) parse the location field and the notes field for a link to zoom

3) open the url 

Link to comment
  • 10 months later...

I'm looking for exactly the same thing, but in my case regex for Google Meet  URL instead, but I think this workflow should probably regex for all the common videoconf provider URLs. I tried doing something with AppleScript but have struggled. 

 

The URL may be either in the Location field, but also is sometimes just in the event description.

 

Has anyone managed to do this?

Link to comment

This is extremely difficult to do with plain AppleScript/JXA.

 

The reason is that the AppleScript API doesn't support recurring events very well. It only returns the original event with the recurrence definition. It's up to you to parse the recurrence and calculate the dates on which the event is repeated. That also means you can't just grab events for the next few days, but have to go through all past events, too, in case they're recurring. Which takes a very, very long time.

 

You'd have to use the EventKit API to search your calendar events in any reasonable way.

Link to comment

@deanishe that's pretty awesome stuff. I'm new to Alfred and AppleScript,  so wasn't going anywhere fast with my attempts. 

 

My feedback would be: I'd ideally only show the next meeting, and the current meeting (in case it's just started, or I'm late for it). The reason for this is that I probably have no reason to be finding URLs for meetings much later, let alone after today. It would also be cool to be able to either whitelist which calendars to include - or - to be able to exclude certain calendars (e.g. shared ones) by name.

 

But you've pretty much nailed it. My workflow for this would be: a meeting is coming up (or has just started), you hit ".vc <enter>" and boom, you're in. :)

 

Nice work on your other workflows too.

Link to comment
6 hours ago, SJ2K said:

I'd ideally only show the next meeting, and the current meeting (in case it's just started, or I'm late for it).

 

Yeah, I realised I should also include meetings that are in progress.

 

6 hours ago, SJ2K said:

The reason for this is that I probably have no reason to be finding URLs for meetings much later, let alone after today.

 

Perhaps you don't, but it's a fast way to double-check when upcoming meetings are starting.

 

6 hours ago, SJ2K said:

My workflow for this would be: a meeting is coming up (or has just started), you hit ".vc <enter>" and boom, you're in.

 

I'll change it to include ongoing meetings, but in any case, the results are in chronological order, so the current/next meeting should be the top one (i.e. automatically selected).

 

6 hours ago, SJ2K said:

It would also be cool to be able to either whitelist which calendars to include

 

Somebody hasn't read the documentation ;)

 

Link to comment

lol, apologies. I was so excited that I just installed and played with it, glanced through the code for 30 seconds, with screaming kids in the background. RTFM.

 

Just played with it again with lookahead_days set to 1 and it seems to work perfectly. Will battle test it all day Monday :)

 

Couldn't find this workflow on your Git to make a PR, but here's the regex for a Google Meet URL: 

https://meet\.google\.com/[a-z-]+

 

Link to comment
1 hour ago, SJ2K said:

Couldn't find this workflow on your Git to make a PR

 

No, it's not on my GitHub (it's over here) because I don't have much use for it myself (at least currently), so I don't intend to invest any time in it. If it's not on GitHub, the only way for people to submit feature requests is to find this thread.

 

After fixing it to show ongoing meetings and adding your Google Meet regex (thanks for that!), I don't envisage updating it again.

Edited by deanishe
Link to comment

Understood! Well, I appreciate you taking on this challenge, I think given the current number of people working from home, hopefully others will find it as useful as I think I will. I'll take a closer look at the Python sometime.

Link to comment

I like the addition of being able to show events in calendar.

 

I'm getting the following error in the new version:

 

video-conferences.py", line 258, in main
    icon=icons.get_icon(d['colour']))
KeyError: 'colour'

 

Link to comment
3 hours ago, SJ2K said:

I'm getting the following error in the new version

 

Clear the cached data with .vc workflow:delcache.

 

1 hour ago, SJ2K said:

Also not entirely sure if it's something due to my calendar set, but it takes 3 or so seconds for it to show the calendar event when I Cmd-Enter.

 

That's just AppleScript being crap, I'm afraid. It doesn't help that the script can't directly retrieve the calendar by ID (this appears to be broken on Catalina), but fundamentally it takes ~2 seconds to connect to an application.

 

Ideally, I'd be able to show events using a URL (which would be much faster), but I haven't been able to find an appropriate URL scheme for Calendar.app.

Link to comment
1 hour ago, deanishe said:

Clear the cached data with .vc workflow:delcache.

 

I wasn't even able to do that, because as soon as I typed '.vc' it would crash. But I've managed to get it working now (and shouldn't be a problem for any users moving forward).

 

Thanks again.

Link to comment
9 hours ago, SJ2K said:

I wasn't even able to do that, because as soon as I typed '.vc' it would crash.

 

Yeah, you would have been able to do that if you hadn't given up immediately. If you type the full query as given, it won't crash because the code that was throwing the error isn't run.

 

9 hours ago, SJ2K said:

But I've managed to get it working now

 

All you had to do was wait for the cached data to expire.

Link to comment
12 hours ago, deanishe said:

If you type the full query as given, it won't crash because the code that was throwing the error isn't run.

 

 

It closed as soon as I typed .vc, but I didn't consider trying to paste the whole command in. I didn't know it was due to the cache at the time.

 

btw, one other potentially nice to have: if users have Zoom installed (many will, especially if they plan to be using this kind of Alfred workflow), you can auto-join the meeting in the Zoom application, without having to go through the stupid step of loading the Zoom page in your browser and then it simply launching the Zoom application from there.

 

Just call this URI:

zoommtg://zoom.us/join?confno={id}&pwd={pwd}

 

Obviously this requires parsing out the Zoom meeting ID (and optional password) from the regex'd link. I also noticed that your Zoom regex seems to follow a different format to some of the Zoom meeting URLs I'm seeing, which are in the format: https://zoom.us/j/1234567890?pwd={pass}.

Link to comment
7 hours ago, SJ2K said:

I also noticed that your Zoom regex seems to follow a different format to some of the Zoom meeting URLs I'm seeing, which are in the format: https://zoom.us/j/1234567890?pwd={pass}

 

I have very little experience with Zoom, so I probably missed something. I'll add this URL format, too. Thanks 👍

 

7 hours ago, SJ2K said:

you can auto-join the meeting in the Zoom application, without having to go through the stupid step of loading the Zoom page in your browser and then it simply launching the Zoom application from there.

 

That should be easy enough to add yourself with a Replace utility before the Open URL action.

 

Adding another bunch of find+replace regexes to the configuration would be more extensible, but like I said, I don't plan to invest any more time in this workflow unless I start using it more heavily myself. Sorry.

Edited by deanishe
Link to comment
13 hours ago, deanishe said:

That should be easy enough to add yourself with a Replace utility before the Open URL action.

 

 

You're right, it was easy (this is literally one of the first workflows I've played with so I'm still not that with what Alfred can do natively). I had to use one replace after your conditional to go from "https://zoom.us/j/1234567890?pwd=aodw98da7d" to "zoommtg://zoom.us/join?confno=1234567890?pwd=aodw98da7d" and then another one to just change the "?pwd=" to "&pwd=".

 

I currently only handle the subdomainless Zoom URLs, as I haven't come across the other ones you've got a regex for (those will simply go through the browser as normal). Not the most elegant but it does work.

Link to comment
15 hours ago, deanishe said:

You can do that with a single replace using groups: https://.+/j/(\d+)\?pwd=(.+) and zoommtg://zoom.us/join?confno=$1&pwd=$2

 

 

Yeah, I know a regex approach would be much nicer, wasn't sure how to get that right in Alfred. Particularly given that it's a bit trickier, as the `?pwd=(.+)` component is optional.

I cheated again by replacing `https://.+/j/(\d+)(\?(pwd=(.+)))?` with `zoommtg://zoom.us/join?confno=$1&$3`. If the URL has no `?pwd` the `zoommtg` URI still ends up with a trailing `&`, but that doesn't affect anything. Is there a cleaner way in native regex/Alfred (apart from using another Replace)? 

 

Apologies, but I can't for the life of me figure out how to do inline code on this forum.

Link to comment
1 hour ago, SJ2K said:

Is there a cleaner way in native regex/Alfred (apart from using another Replace)?

 

Don't think so. I think that's a fundamental limitation of regular expressions.

 

1 hour ago, SJ2K said:

I can't for the life of me figure out how to do inline code on this forum

 

There's no markup for it. We "cheat" by writing in Markdown and using Vítor's MarkdownTransform workflow, which replaces Markdown's backticks with BBCode background and font tags.

Link to comment
1 hour ago, deanishe said:

Don't think so. I think that's a fundamental limitation of regular expressions.

 

 

Yeah, that's what I thought. But nevermind, it works.

 

1 hour ago, deanishe said:

There's no markup for it. We "cheat" by writing in Markdown and using Vítor's MarkdownTransform workflow, which replaces Markdown's backticks with BBCode background and font tags.

 

Haha, that's a hack if ever I saw one.

Link to comment
  • 2 weeks later...
On 5/1/2020 at 9:09 AM, deanishe said:

This was an interesting challenge for me because I'd like to replace my Google Calendar workflow with one that works on the local Calendar.app database.

 

Here’s a workflow that will show you upcoming video conferences from Calendar.app. It currently works with Zoom and Lync, but it’s easy enough to add support for additional services.

 

Says I have none - but I do have a Zoom meeting today at 8 Lima Time - is there a special calendar needed. I do use iCloud calender

Link to comment
1 hour ago, tosbsas said:

Says I have none - but I do have a Zoom meeting today at 8 Lima Time - is there a special calendar needed. I do use iCloud calender

 

I hadn't added support for the other style of Zoom URL. I've just pushed an update. Download the workflow again (v0.0.3) and it should work.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...