Author Topic: Execute command when leaving a profile  (Read 4531 times)

Exergist

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 405
  • Ride the lightning
Execute command when leaving a profile
« on: February 10, 2017, 07:12:28 AM »
I understand that VA can automatically execute a command when a given profile is loaded. However, I'm trying to figure out if it is possible to execute a command right before a given profile is switched to a different profile.

Extra info:
My use case is this. I like to run my PC games through Steam, whether they are Steam games or non-Steam games. Games like Mass Effect 3 and Dragon Age Inquisition (non-Steam games) also require Origin to be running to start the game. Unfortunately the new version of Origin removed the option to automatically close Origin after an Origin game is closed. Starting an Origin game through Steam and then closing the game without closing Origin has weird side effects for Steam. It is cumbersome to close Origin while Steam is running in "big picture mode." This is where I'm hoping VA can take care of business.

Thoughts so far:
I can get Origin to close using the "close process" command with VA, but I'm trying to figure out how to create the logic to properly execute this command when an Origin game closes. Automatic profile switching only gives me the power to run a command for the profile I'm moving TO, not the profile I'm moving FROM. I could have a Steam profile run a command to check for a hard-coded list of game windows related to Origin (because Windows should automatically go back to Steam upon exiting any game executed through Steam's "big picture mode"), but something more automatic and profile-specific (i.e. game-specific) would be more elegant.

THANKS!

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4778
  • RTFM
Re: Execute command when leaving a profile
« Reply #1 on: February 10, 2017, 05:03:58 PM »
I wouldn't mind a built-in "Execute this command each time this profile is unloaded" option(actually mainly for when VoiceAttack shuts down to clean up anything left set or running), but that does not currently exist.


Now, you don't want to hard-code a list of games into on profile, but what you could do is have the game-specific profile set a variable with the game's process name, and have a command in your steam profile that runs on load to check for that process specifically.

That way, if you add a new game profile, you just have to add an on load command that sets the variable, and the command on the steam profile side takes care of the rest.

Exergist

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 405
  • Ride the lightning
Re: Execute command when leaving a profile
« Reply #2 on: February 14, 2017, 10:35:21 AM »
Thanks for the comment Pfeil. That's probably what I'll end up doing: having Origin games change a variable when loaded that Steam can pick up when it gets auto-switched-to when the game closes.

Side note not related to VA: I learned that I can close an Origin game AND Origin if I use the "exit shortcut" action from within the Steam overlay while playing the Origin game. So that works too.

But yes I do think that adding an "Execute this command each time this profile is unloaded" option would be a nice addition. I'll post it to the Feature Request board.

CMDR_Hoodathunk

  • Newbie
  • *
  • Posts: 3
Re: Execute command when leaving a profile
« Reply #3 on: March 02, 2017, 03:47:43 PM »
I wouldn't mind a built-in "Execute this command each time this profile is unloaded" option(actually mainly for when VoiceAttack shuts down to clean up anything left set or running), but that does not currently exist.


Ditto, I asked for this some time ago. Got a response but not a definitive yes/no one.