{ "cells": [ { "cell_type": "code", "execution_count": 32, "metadata": {}, "outputs": [], "source": [ "#Execute the script, then highlight something. It will turn the \n", "#highlighted text into an equation and put the result in your clip board.\n", "#Noice\n", "\n", "import random\n", "import pyautogui as pya #Used to press ctrl-c\n", "import pyperclip #Handy cross-platform clipboard text handler\n", "import time\n", "from Equation import Expression\n", "\n", "time.sleep(5) #Gives a 5 second delay, so you can highlight stuff\n", "\n", "def copy_clipboard():\n", " pya.hotkey('ctrl', 'c')\n", " time.sleep(.01) #ctrl-c is usually very fast but the program may execute faster\n", " return pyperclip.paste()\n", "\n", "text = str(copy_clipboard()) #This copies what you have highlighted and makes it to a string\n", "\n", "def calculate(equation): #This calculates\n", " fn = Expression(equation)\n", " \n", " pyperclip.copy(fn()) #Copies the new sentence as a string to the clip board\n", " \n", "calculate(text) #The executioner" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.7.6" } }, "nbformat": 4, "nbformat_minor": 4 }