Automating Zoom
Tags: python, tutorial
Published: 2020-08-31 06:13:56

####Hi,
<p>&nbsp; &nbsp; &nbsp; Well, we all know <b>Zoom</b> is a video conferencing app which allows us to attend/conduct meetings. And because of this pandemic situation, the usage of these video conferencing apps also increased drastically and even for school kids this became a new normal and sometimes these continuous online classes becomes cumbersome.</p>
<p>&nbsp; &nbsp; &nbsp; And today we gonna learn how to automate <b>zoom</b> such that it automatically logs into one's meetings/classes on time.</p>

For this, we need 
<ul>
<li>python</li>
<li>pyautogui</li>
<li>pandas</li>
</ul>

<h2>Behind the scenes:</h2>
<ul>
<li>An infinite loop keeps checking the current time of the system using "datetime.now" funtion.</li>
<li>The zoom app is opened using "os.startfile()" funtion as soon as current time matches the time mentioned in "timings.xlsx".</li>
<li>"pyautogui.locateOnScreen()" function locates the image of join button on the screen and returns the position.</li>
<li>"pyautogui.locateCenterOnScreen()" function locates the center of the first found instance of the image on the screen. </li>
<li>"pyautogui.moveTo()" moves the cursor to that location.</li>
<li>"pyautogui.click()" performs a click operation.</li>
<li>The meeting Id and Passcode are entered using the "pyautogui.write()" command.</li>
</ul>

<h2>Steps for Automating:</h2>
<b>1.</b> import necessary modules
``` python
import os              
import pandas as pd    
import pyautogui
import time
from datetime import datetime
```
<b>os</b> -  Provides a way of using operating system dependent functionality.

<b>pandas</b> - Allows us to store and manipulate tabular data in rows and columns of variables. 

<b>pyautogui</b> - A module which helps to control the mouse and keyboard, and other GUI automation tasks.


<b>2.</b> Open's zoom application from the specified location
``` python
os.startfile(" ") 
```
<b>3.</b> To click join button
``` python
#place the pic location inside quotes
joinbtn=pyautogui.locateCenterOnScreen("")
pyautogui.moveTo(joinbtn)
pyautogui.click()
```

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/0e5g0tgt7ypz9s469b55.gif)


<b>4.</b> Similarly, like join button we have to take screenshot of every button to click or to locate
``` python   
#To type the meeting id
#place the picture location inside quotes
meetingidbtn=pyautogui.locateCenterOnScreen("")
pyautogui.moveTo(meetingidbtn)
pyautogui.write(meeting_id)
```
<b>5.</b> To enter passcode
``` python
#Enter the passcode to join meeting
passcode=pyautogui.locateCenterOnScreen("")
pyautogui.moveTo(passcode)
pyautogui.write(password)
```

<b>6.</b> Create an excel file and add all meeting details like "Timings", "Meeting id" and "Password"

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/e2vn1lw203m1ddbmcab1.png)


<b>7.</b> Now import that excel file using pandas
```python
#place excel file location inside quotes
df = pd.read_excel('',index=False)
```

<b>8.</b> Now we will write while loop to constantly check for the current time and compare the timings in <b>excel file</b>

``` python
while True:
    #To get current time
    now = datetime.now().strftime("%H:%M")
    if now in str(df['Timings']):
        
        mylist=df["Timings"]
        mylist=[i.strftime("%H:%M") for i in mylist]
        c= [i for i in range(len(mylist)) if mylist[i]==now]
        row = df.loc[c] 
        meeting_id = str(row.iloc[0,1])  
        password= str(row.iloc[0,2])  
        time.sleep(5)
        signIn(meeting_id, password)
        time.sleep(2)
        print('signed in')
        break
```
Check out the my GitHub repo to get code and assets for buttons

{% github https://github.com/aletisunil/Automating_Zoom no-readme %}

<center>or</center>

###Source code for Automation

``` python
 import os
 import pandas as pd
 import pyautogui
 import time
 from datetime import datetime


 def signIn(meeting_id,password):

     #Open's Zoom Application from the specified location
     os.startfile("")
     time.sleep(3)

     #Click's join button
     joinbtn=pyautogui.locateCenterOnScreen("")
     pyautogui.moveTo(joinbtn)
     pyautogui.click()
     time.sleep(1)

     #Type the meeting id
     meetingidbtn=pyautogui.locateCenterOnScreen("")
     pyautogui.moveTo(meetingidbtn)
     pyautogui.write(meeting_id)
     time.sleep(2)

     #To turn of video and audio
     mediaBtn=pyautogui.locateAllOnScreen("")
     for btn in mediaBtn:
         pyautogui.moveTo(btn)
         pyautogui.click()
         time.sleep(1)

     #To join
     join=pyautogui.locateCenterOnScreen("")
     pyautogui.moveTo(join)
     pyautogui.click()
     time.sleep(2)

     #Enter's passcode to join meeting
     passcode=pyautogui.locateCenterOnScreen("")
     pyautogui.moveTo(passcode)
     pyautogui.write(password)
     time.sleep(1)

     #Click's on join button
     joinmeeting=pyautogui.locateCenterOnScreen("")
     pyautogui.moveTo(joinmeeting)
     pyautogui.click()
     time.sleep(1)

 df = pd.read_excel('',index=False)

 while True:
     #To get current time
     now = datetime.now().strftime("%H:%M")
     if now in str(df['Timings']):
        
         mylist=df["Timings"]
         mylist=[i.strftime("%H:%M") for i in mylist]
         c= [i for i in range(len(mylist)) if mylist[i]==now]
         row = df.loc[c] 
         meeting_id = str(row.iloc[0,1])  
         password= str(row.iloc[0,2])  
         time.sleep(5)
         signIn(meeting_id, password)
         time.sleep(2)
         print('signed in')
         break
```
<h5>Demo video:</h5>
 
{% youtube c2IlvlirKh4 %}

Lemme know if any queries

Hope it's useful
A ❤️ would be Awesome 😊