You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Even when the user is offline, the running Steam app id appears in the registry under HKEY_CURRENT_USER\Software\Valve\Steam\RunningAppID. It can be checked with Python like this:
importwinregdefget_running_app_id():
try:
# Open the Steam registry keysteam_key=winreg.OpenKey(winreg.HKEY_CURRENT_USER, r"Software\Valve\Steam")
# Try to get the RunningAppId valueapp_id, _=winreg.QueryValueEx(steam_key, "RunningAppId")
# Close the registry keywinreg.CloseKey(steam_key)
returnapp_idexceptFileNotFoundError:
returnNoneexceptExceptionase:
returnf"Error: {str(e)}"if__name__=="__main__":
app_id=get_running_app_id()
ifapp_id:
print(f"Running App ID: {app_id}")
else:
print("No game is currently running or the registry key was not found.")
Game details can then be obtained via the public Steam store:
details=requests.get(f"https://store.steampowered.com/api/appdetails?appids={app_id}").json()[str(app_id)]['data']
details['name'] # gives the title of the running game
The text was updated successfully, but these errors were encountered:
Even when the user is offline, the running Steam app id appears in the registry under
HKEY_CURRENT_USER\Software\Valve\Steam\RunningAppID
. It can be checked with Python like this:Game details can then be obtained via the public Steam store:
The text was updated successfully, but these errors were encountered: