import sys def exceptionHandler(exc_type, exc_value, tb): oldExceptionHandler(exc_type, exc_value, tb) input("\nPress ENTER to exit.") sys.exit(1) oldExceptionHandler = sys.excepthook sys.excepthook = exceptionHandler import os p = os.path.join pUp = os.path.dirname sp = pUp(os.path.realpath(__file__)) class reg: class path: sep = "\\\\\\\\"; def clear(): os.system('cls' if os.name=='nt' else 'clear') def qmInt(st,max): integer = -1 try: integer = int(st) except: return -1 if integer < 1: return -1 if integer > max: return -1 return integer def init(): holdShift = False execPath = p(pUp(pUp(sp)),"launch.bat").replace(os.sep,reg.path.sep) iconPath = p(pUp(pUp(sp)),"assets","logo.ico").replace(os.sep,reg.path.sep) print("This tool will add Universal Modloader to your context menu.") input("\nPress ENTER to continue.") while True: clear() print("Would you like the option to only appear while holding SHIFT? [Y/N]") yn = input("Choice: ").lower() if yn == "y": holdShift = True; break if yn == "n": break regFile = open("Output.reg","w") regFile.write('Windows Registry Editor Version 5.00\n') regFile.write('\n') regFile.write('[-HKEY_CLASSES_ROOT\\Directory\\shell\\UniversalModloader]\n') regFile.write('\n') regFile.write('[HKEY_CLASSES_ROOT\\Directory\\shell\\UniversalModloader]\n') regFile.write('@="Open with Universal Modloader"\n') if holdShift == True: regFile.write('"Extended"=""\n') regFile.write('"Icon"="\\"' +iconPath+ '\\""\n') regFile.write('\n') regFile.write('[HKEY_CLASSES_ROOT\\Directory\\shell\\UniversalModloader\\command]\n') regFile.write('@="\\"' +execPath+ '\\" \\"%1\\""\n') regFile.write('\n') regFile.close() clear() print("An Output.reg file has been generated, simply execute it.") print("If you seek to disable the integeration, use Remove.reg.") input("\nPress ENTER to quit.") if __name__ == "__main__": init()