Author Topic: Switch profile and a command ?  (Read 862 times)

bushido

  • Newbie
  • *
  • Posts: 10
Switch profile and a command ?
« on: September 11, 2022, 06:07:55 AM »
Hello, is it possible to execute a command that switches to a profile and executes a command from the destination profile?

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4782
  • RTFM
Re: Switch profile and a command ?
« Reply #1 on: September 11, 2022, 05:17:56 PM »
Commands from the profile being switched from are stopped, in part because there is no guarantee they will be available in the to profile being switched to.

While it's not feasible to keep a command running across profiles, what you could do is to set a variable value before switching, and then use a command assigned to the "Execute a command each time this profile is loaded" option in the profile being switched to to check that variable value and execute a command if required.

E.G.
Code: [Select]
Set Boolean [executeCommandAfterSwitch] to True
Switch to profile, 'Destination profile'
and
Code: [Select]
Begin Boolean Compare : [executeCommandAfterSwitch] Equals True
    Set Boolean [executeCommandAfterSwitch] to False
    Execute command, 'Destination profile command'
End Condition