I have a python script that can convert binary to decimal and decimal to binary, and I would like to be able to highlight text, right click it, select an option in the drop down menu on windows (10) and have it convert the number, telling me in a notification or something. I know that in order to run the script I will need to edit the registry, but exactly how, and how I can use the highlighted text as input and send a notification is a mystery to me. If it is of any help whatsoever, the code currently is
import math
def binToDec(binary):
decimal = 0
i = 0
while (binary != 0):
remainder = binary%10
binary = int(binary/10)
decimal += remainder*pow(2,i)
i+=1
return int(decimal)
def decToBin(decimal):
binary = ""
while (decimal > 0):
remainder = int(decimal%2)
div = int(decimal/2)
binary += str(remainder)
decimal = div
return int(binary[::-1])
which I know is useless in this state. I generally need a point in the right direction or instructions on how I would go about this, it would be much appreciated.