Automate the following Python functions

53 Views Asked by At

I have created the following script in tkinter. The initial outcome of the script that I am trying to achieve is for each on the following functions to automate with very little manual effort. For example, I have the function.

def install_chrome():
    chrome_download_link = "https://www.google.com/chrome/dr/download/?brand=AYYF&geo=US&gclid=EAIaIQobChMI8MO67O-0gQMVfButBh0spwPFEAAYASAAEgLZi_D_BwE&gclsrc=aw.ds"
    webbrowser.open(chrome_download_link)

What I am trying to accomplish is once "Run" Button is clicked in tkinter I want to open https://www.google.com/chrome/dr/download/. Go to the ChromeSetup.exe and begin the download process simultaneously at once.

What tweaks and modifications should I make within my script so that this can be accomplished?

Here is my attached script I am trying to create the same exact process for the other following functions.

from tkinter import * 
import tkinter as tk 
import webbrowser 
import subprocess  
import time 
import sys
import os
  
  
master = Tk() 

master.geometry("250x350") 
master.title("Software Installation") 
  
#======================================funtions================================== 




def install_chrome():
    chrome_download_link = "https://www.google.com/chrome/dr/download/?brand=AYYF&geo=US&gclid=EAIaIQobChMI8MO67O-0gQMVfButBh0spwPFEAAYASAAEgLZi_D_BwE&gclsrc=aw.ds"
    webbrowser.open(chrome_download_link)



def install_office_2019(): 
    office_2019_download_link = "https://www.microsoft.com//en-us//microsoft-365//store//download-office-2019//" 
    webbrowser.open(office_2019_download_link) 
  
def run_windows_updates(): 
    subprocess.call('cmd \/c start ms-settings:windowsupdate', shell=True) 
  
def uninstall_office_365(): 
    subprocess.call('appwiz.cpl', shell=True) 
  
def disable_network_sharing(share_name): 
    command = f"net share {share_name} \/delete" 
    subprocess.Popen(command, shell=True) 
    disable_network_sharing("SharedFolder") 
  

def install_egnyte(): 
    chrome_download_link = "https://helpdesk.egnyte.com/hc/en-us/articles/204909984-Desktop-App-for-Windows-Installation" 
    webbrowser.open(chrome_download_link)

def install_sophos(): 
    chrome_download_link = "https://login.sophos.com/login.sophos.com/oauth2/v2.0/authorize?p=B2C_1A_signup_signin&client_id=d8ce821f-a1da-4b03-b7e2-1d1a9cc028f3&redirect_uri=https%3A%2F%2Fcloud.sophos.com%2Fmanage%2Flogin%2Fazureb2c&scope=openid&response_type=id_token&prompt=login&state=" 
    webbrowser.open(chrome_download_link)  

def install_adobe(): 
    chrome_download_link = "https://www.adobe.com/downloads.html" 
    webbrowser.open(chrome_download_link) 

  
  
  
  
  
  
#=============================Icons======================================================= 
  
var1 = IntVar() 
Checkbutton(master, text="Delete office Programs", variable=var1).grid(row=0, sticky=W) 
btn2 = Button(master, text = 'RUN',command=uninstall_office_365) 
btn2.grid(row=0, column=1) 
  
var2 = IntVar() 
Checkbutton(master, text="Run Updates", variable=var2).grid(row=1, sticky=W) 
btn2 = Button(master, text = 'RUN',command=run_windows_updates) 
btn2.grid(row=1, column=1) 
  
var3 = IntVar() 
Checkbutton(master, text="Install Chrome", variable=var3).grid(row=2, sticky=W) 
btn2 = Button(master, text = 'RUN',command=install_chrome) 
btn2.grid(row=2, column=1) 
  
var4 = IntVar() 
Checkbutton(master, text="Install Office 19", variable=var4).grid(row=3, sticky=W) 
btn2 = Button(master, text = 'RUN',command=install_office_2019) 
btn2.grid(row=3, column=1) 
  
var5 = IntVar() 
Checkbutton(master, text="Install Sophos", variable=var5).grid(row=4, sticky=W) 
btn2 = Button(master, text = 'RUN',command=install_sophos) 
btn2.grid(row=4, column=1)  
  
  
var6 = IntVar() 
Checkbutton(master, text="Install Egnyte", variable=var6).grid(row=5, sticky=W) 
btn2 = Button(master, text = 'RUN',command=install_egnyte) 
btn2.grid(row=5, column=1)  
  
  
var7 = IntVar() 
Checkbutton(master, text="Turn off Network Sharing", variable=var7).grid(row=6, sticky=W) 
btn2 = Button(master, text = 'RUN',command=disable_network_sharing) 
btn2.grid(row=6, column=1) 
  
var8 = IntVar() 
Checkbutton(master, text="Install Adobe Reader ", variable=var8).grid(row=7, sticky=W) 
btn2 = Button(master, text = 'RUN',command=install_adobe) 
btn2.grid(row=7, column=1) 




if __name__=='__main__':
    master.mainloop()
0

There are 0 best solutions below