Skip to content

Instantly share code, notes, and snippets.

@sakshatshinde
Last active February 2, 2020 10:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sakshatshinde/a5c7a23f798fd84f094920b7e3ab1907 to your computer and use it in GitHub Desktop.
Save sakshatshinde/a5c7a23f798fd84f094920b7e3ab1907 to your computer and use it in GitHub Desktop.
A simple way to find installed games' uPlay IDs with python
'''
There are folders in -> C:\\Program Files (x86)\\Ubisoft\\Ubisoft Game Launcher\\data
The names of the folders are "Uplay IDs" of the installed games.
'''
import winreg, os, re
# Finding Uplay IDs by going through the uPlay data folder
def getUplayIDs(filePath = 'C:\\Program Files (x86)\\Ubisoft\\Ubisoft Game Launcher\\data'):
listOfFiles = os.listdir(filePath)
def findIDs():
result = re.findall(r'\d+', str(entry))
try : return result[0]
except : pass
for entry in listOfFiles:
uPlayID = findIDs() # '\d' finds any number (a digit)
if uPlayID != None : print(uPlayID)
#getUplayIDs()
#-----------------------------------------------------------------------------------------------------------------------------
# Finding Uplay IDs by going through the Windows Registry
def getUplayIDs():
# ubisoftGameList = {}
baseReg = winreg.ConnectRegistry(None, winreg.HKEY_LOCAL_MACHINE)
subKey = winreg.OpenKey(baseReg, "SOFTWARE\\WOW6432Node\\Ubisoft\\Launcher\\Installs\\")
for i in range(50) :
try :
gameId = winreg.EnumKey(subKey,i)
gameNameKey = winreg.OpenKey(baseReg, "SOFTWARE\\WOW6432Node\\Ubisoft\\Launcher\\Installs\\" + gameId + "\\")
name = winreg.EnumValue(gameNameKey, 1)
path = name[1]
path = os.path.dirname(path)
gameName = os.path.basename(path)
print('\nThe Game name is: ' + gameName + ' \nThe Game ID is: ' + gameId)
except :
pass
winreg.CloseKey(baseReg)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment