Author Topic: Profile Switching Breaks Loops  (Read 1715 times)

Exergist

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 405
  • Ride the lightning
Profile Switching Breaks Loops
« on: January 17, 2018, 12:37:38 AM »
I noticed that if Profile A is running a while loop and I activate a window with a title that will auto-load profile B (from automatic profile switching) the command with the loop in Profile A is immediately terminated and Profile B loads.

Is there any way to prevent profile switching from breaking running loops (or maybe some way to create a profile hierarchy in which lower ranked profiles cannot interrupt or switch away from those that are higher)?

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4761
  • RTFM
Re: Profile Switching Breaks Loops
« Reply #1 on: January 17, 2018, 12:57:00 AM »
Not with the built-in autoswitcher, as far as I'm aware.

You could set up a profile that handles switching according to your own ruleset, which could include waiting until a loop sets a variable to indicate it's in a switchable state(so you can restart it at that point in the next loaded profile) before switching.

That said, loops aren't really designed to permanently run in the background, in the context of VoiceAttack; Looping commands will be terminated just like any other when switching profiles, or stopping all running commands.

If you need something that runs in the background, a plugin would likely be the best way to accomplish that, as you can have much more control over when and how it runs(pretty much the only restriction is that it starts and stops with VoiceAttack itself, provided plugin support isn't explicitly disabled).

Exergist

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 405
  • Ride the lightning
Re: Profile Switching Breaks Loops
« Reply #2 on: January 21, 2018, 12:10:13 AM »
I checked to see if a loop within an inline function would be maintained but it too was broken by the auto switcher. Maybe at some point I'll check out the documentation for creating a plugin.