TCNOco / TcNo-Acc-Switcher

A Super-fast account switcher for Steam, Battle.net, Epic Games, Origin, Riot, Ubisoft and many others!
GNU General Public License v3.0
1.74k stars 121 forks source link

Is it possible to get a powershell script to login a particular user? #242

Open xCeeTee opened 2 years ago

xCeeTee commented 2 years ago

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.

TCNOco commented 2 years 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?

jh0nny2k commented 2 years ago

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

TCNOco commented 2 years ago

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.

jh0nny2k commented 2 years ago

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