Added Windows Integration Tool

Add UML to Windows' context menu with this tool.
This commit is contained in:
Fierelier 2019-06-02 17:56:33 +02:00
parent 14673a0413
commit 32b07aeb9a
2 changed files with 68 additions and 0 deletions

Binary file not shown.

View File

@ -0,0 +1,68 @@
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()