Closed xCeeTee closed 2 months ago
Sounds like a good idea. Currently, the switcher doesn't know about games that you have on X account. The best it can open to let you pick something along those lines.
You could use the program with a command line shortcut like TcNo-Acc-Switcher.exe +s<SteamId>
or the CLI tcno:\\s:<steamid>
for example. See https://github.com/TcNobo/TcNo-Acc-Switcher/wiki/CLI-&-Protocol
You would probably want to use an argument with the program. That way once switching is complete, the account switcher closes and the powershell script continues.
As for a Playnite addon; I've never used Playnite so I'm not familiar with the environment. Maybe someone else here has experience?
Try this :
For before execute
cd "C:\Program Files\TcNo Account Switcher" ./TcNo-Acc-Switcher.exe +s:YourPayday2steamidhere Start-Sleep -Milliseconds 4200
After you left payday : cd "C:\Program Files\TcNo Account Switcher" ./TcNo-Acc-Switcher.exe +s:YourPayday2steamidhere
It's not elegant at all but it works :D
If anyone has something more elegant please let me know
You can shorten it to just C:\Program Files\TcNo Account Switcher\TcNo-Acc-Switcher.exe +s:YourPayday2steamidhere
.. You don't need to CD first.
Also, if you have the protocol turned on in the app settings, you can use tcno:\\s:YourPayday2steamidhere
for example.
It actually doesn't work. Probably because of the way playnite is setup to run PowerShell scripts. Or maybe i don't understand powershell (that's most likely it). But it works using my low tech way so i'm more than happy with it
I managed to get Start-Process tcno:\\s:SteamId
to work well as powershell scripts for playnite. However, it does kill and restart steam each time even when i'm already logged on to the correct account, which is a little bit silly/slow.
The switcher UI seems fully aware of which account is currently on, too.
Do you know of any workaround for that ?
Found a workaround ! Thanks to this.
We can get the steamID3 of the currently active user in one powershell line. TcNo uses the steamID64 so it's not the same value but it's still unique per account so this simple powershell script does the trick for me :
$steamid = (Get-ItemProperty -Path HKCU:\Software\Valve\Steam\ActiveProcess -Name ActiveUser).ActiveUser
if ($steamid -ne <steamID3>)
{
Start-Process tcno:\\s:<steamID64*>
}
You can find your steamID3 either by running the command in a powershell or simply by checking the name of the userdata folder (from TcNo's UI : right click the account > Manage > Open userdata). You can find your by creating a shortcut from TcNo's UI and looking into the generated shortcut.
*Side note : you should be able to also get it from your steam profile page but it seems it's not actually the steamID64 that TcNo uses. Maybe there's a failed conversion in the code somewhere ? Regardless, the id that TcNo uses doesn't seem official (websites like steamid.xyz point me to a random account when I paste my tcno steam id in)
It would still be nice if the switcher was able to handle this edge case directly tho.
EDIT: Here is the full playnite script I use with the waiting included to delay the game launch until after the account has switched. Timeout value was set arbitrarily so feel free to adjust it.
$USER_TCNO = "tcno:\\s:<steamID>"
$USER_ID3 = "<steamID3>"
function Switch-Account {
param (
[string] $TcNoUrl,
[string] $SteamID3,
[int] $Timeout = 30
)
function Get-ActiveUserID3 {
(Get-ItemProperty -Path HKCU:\Software\Valve\Steam\ActiveProcess -Name ActiveUser).ActiveUser
}
if ($SteamID3 -ne (Get-ActiveUserID3))
{
Start-Process $TcNoUrl
while ($SteamID3 -ne (Get-ActiveUserID3))
{
if ($Timeout -le 0)
{
throw "Steam account switching timed out!"
}
Start-Sleep -Seconds 1
$Timeout = $Timeout - 1
}
}
}
Switch-Account -TcNoUrl $USER_TCNO -SteamID3 $USER_ID3
I also use playnite's API $Game.Platforms
and $Game.Tags
to figure out when I want to switch to which account.
Found a workaround ! Thanks to this.
You are amazing. I was just about to look into this issue again now I've started learning to code properly. All I have to do is make a toggle for competitive games because I have a 2nd account for when I'm under the influence.
I also use playnite's API
$Game.Platforms
and$Game.Tags
to figure out when I want to switch to which account.
Even better. I just tried last night to make scripts use game tags but I wasn't able to find the right variable before I had to go to bed.
I use a game launcher, Playnite, that has the ability to run powershell scripts before and after the game launches. Since I still use my old account purely to play Payday 2, I want to have the launcher close Steam and then trigger the account switcher to login to my old account.
I'm also able to create prompts, so I'm thinking for games where I have 2 accounts I can have the prompt ask which account to play under too.
I also wonder if it would be possible to create a Playnite addon to be able to have the launcher natively handle setting up the account switcher in the way I have planned. I understand 100% if you have no interest in creating a Playnite addon.