Created
April 22, 2020 00:27
-
-
Save deepanchal/10b3b75e54e77a943948bb116d54d43b to your computer and use it in GitHub Desktop.
A python bot which takes multiple article links and automates your GUI to generate citations from (zbib.org)
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
import pyautogui | |
import webbrowser | |
import time | |
import tkinter as tk | |
from tkinter import messagebox | |
url = "https://zbib.org/" | |
instructions = "This bot needs to have access to you keyboard and mouse to function.\nPlease don't mess with keyboard or cursor while this bot is running\nTo use this bot, copy and paste all your article(references) website links in the textbox.\nPlease make sure that every link is on newline or else bot won't work.\nDon't worry, its just a bot, not A.I. ;)\n" | |
doneMsg = "All given citations have been generated on the website.\n\nYou can now select the you desired style(APA, MLA, Chicago) from the dropdown menu.\n\nAfter you select citation style, just scroll down and click `Copy to Clipboard` button.\n\nThanks for using my bot\n" | |
root = tk.Tk() | |
root.title("BiblioBot") | |
root.config(bg="grey", padx=20, pady=10) | |
root.resizable(0, 0) | |
infoLabel = tk.Label(root, text=instructions, bg="grey", | |
font=("Arial", 18)).pack() | |
textBox = tk.Text(root, height=16, width=100, bg="white", bd=0, | |
fg="black", padx=10, pady=10, font=("Arial", 16)) | |
textBox.pack() | |
buttonSubmit = tk.Button(root, height=2, width=50, bd=0, bg="#42f498", fg="black", font=( | |
"Arial", 16), text="Do the Magic and Generate Citations", command=lambda: retrieve_input()).pack(pady=10) | |
def retrieve_input(): | |
websites = textBox.get("1.0", "end-1c") | |
if websites == "meme": | |
webbrowser.open_new_tab("https://www.youtube.com/watch?v=dQw4w9WgXcQ") | |
return | |
for i, website in enumerate(websites.split('\n')): | |
if(not (website.startswith('http://') or website.startswith('https://'))): | |
tk.messagebox.showerror( | |
'Error', "Atleast one of the links doesn't start with `http://` or `https://`\n\n Please check the links you entered and try again") | |
return | |
if i == 0: | |
webbrowser.open_new_tab(url) | |
time.sleep(6) | |
if(website == '' or website == ' '): | |
continue | |
pyautogui.typewrite(website, interval=0.02) | |
time.sleep(1) | |
pyautogui.typewrite(['enter']) | |
time.sleep(3.5) | |
tk.messagebox.showinfo("Task Completed", doneMsg) | |
root.mainloop() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment