Advanced Scene Switcher

Advanced Scene Switcher 1.37.2

Hi! Could you please advise what should I use as a ${VarName} in the macro to create a welcome message for the latest follower? I can't retrieve the correct value.
You can find an example how to set this up here in the wiki:
 
A build with additional options to modify JSON values contained in variables is available here on GitHub:
Note that you will have to be logged in to be able to download it.
If that should be a problem I upload it somewhere else.

For example, let's assume My Variable has the following value:
JSON:
{
    "books":
    [
        {
            "category": "fiction",
            "title" : "A Wild Sheep Chase",
            "author" : "Haruki Murakami",
            "price" : 22.72
        },
        {
            "category": "fiction",
            "title" : "The Night Watch",
            "author" : "Sergei Lukyanenko",
            "price" : 23.58
        },
        {
            "category": "fiction",
            "title" : "The Comedians",
            "author" : "Graham Greene",
            "price" : 21.99
        },
        {
            "category": "memoir",
            "title" : "The Night Watch",
            "author" : "Phillips, David Atlee"
        }
    ]
}

This set of actions actions ...

View attachment 112888

... will then reduce the value to The Night Watch.

Let me know if everything works as expected / if you have feedback.
Thank you so much for this! in my case, it's not quite working.

When I put in a hardcoded "lookup" value I get back the value wrapped in [" and "] - Maybe an option to "strip"/pare down to the value, as it appears it is still in a json form.

1745119529824.png


1745119503882.png


And slightly more important to be usable, the variable is not being used for the value in the query, it's just resulting in an empty set json of []

1745119626409.png

It looks like the
$['${CardId}'] .ShortName
is not being parsed and the variable converted to the Id


======
And for context, I can't use the array index as the entries are not guaranteed to be in order or sequential. there are gaps in the Ids.

1745119794042.png


Hopefully that is sufficiently clear. let me know if further explanation is needed.
 
When I put in a hardcoded "lookup" value I get back the value wrapped in [" and "] - Maybe an option to "strip"/pare down to the value, as it appears it is still in a json form.
A JSONPath query will always return a JSON array, as the query can return multiple results.
I also stumbled over that, which is why I decided to include the option to access JSON array elements.

1745145142309.png


I thought about automatically stripping the array in case only one / no result is found, but decided against it, as deviating from default JSONPath behavior might cause incompatibilities in the future / surprise other potential users of this functionality.

And slightly more important to be usable, the variable is not being used for the value in the query, it's just resulting in an empty set json of []

1745119626409.png

It looks like the
$['${CardId}'] .ShortName
is not being parsed and the variable converted to the Id
I just gave it a try, but unfortunately I am not able to reproduce the problem and the variable values used in the query are resolved as expected.
Maybe "CardId" was not set to the expected value?
This would result in the behavior you described, as the query would return an empty array if the given Id was not found.
Example.gif


Or did I misunderstand the problem?

And thank you a lot for your feedback!
 
Hello,

I have a use case I'm attempting to solve for with the use of variables for enabling, pausing, and unpausing of macro actions.

Currently I have 5 OBS scenes. Each scene has 3 respective macros to enable, pause, and un-pause pixel matching. That's 15 macros all performing the same functions just named differently based on the scene name.
Example:
1) Scene1-Pixel-Matching (Video macro matching pattern of png file)
2) Scene1-Pixel-Match ( Macro responsible for taking action if matching pattern)
3) Scene1-Pixel-No-Match ( Macro responsible for taking action if NO pattern match)
(Pixel-Matching, Match, and No-Match macros were once combined into single macro using if/else action, but for other reasons, separated into 3).

Ultimately, I'd like to reduce 15 macros down to 3 total macros to dynamical enable, pause, un-pause these macros.

My initial approach was to create variables with concatenated values to include the "Scene Name" with "-Pixel-Match" or Pixel-No-Match" to produce "Scene1-Pixel-Matching" and so on. I was able to create the desired variables and values but...

It does not appear as though I can pass a variable to pause or un-pause a macro. Am I wrong in my approach? Am I wrong that I cannot pass a variable to macro to pause or un-pause? Is there a better approach to accomplish this?

Thank you all for any assistance!
 
It does not appear as though I can pass a variable to pause or un-pause a macro. Am I wrong in my approach? Am I wrong that I cannot pass a variable to macro to pause or un-pause? Is there a better approach to accomplish this?
Just for clarification / to avoid a misunderstanding:
You are asking if variables can be used in macro selection of the Macro "Pause" action, right?
1745267569090.png

If so, then unfortunately that is indeed not possible at the moment.

I will try to look into making that possible, when I find the time to.
So, thanks for the suggestion!

Without really knowing your macro setup in detail, to work around this limitation you could not pause the macros, and instead add a "Variable value equals" check at the top of each relevant macro to make sure its actions are only executed when the variable has a given value:
1745268398540.png


If you are worried about performance, you can also enable "short circuit evaluation" to ensure that the condition evaluation stops when the overall result of the condition set can no longer result in a match:

1745268618357.png


I hope that helps!
 
Thanks for sharing the crash log!

If I am interpreting the crash log correctly, I don't see any direct involvement of the advanced scene switcher in the crash.
OBS seems to crash when saving the scene collection data.

By default the plugin triggers the saving of the scene collection data when ...
  • closing the advanced scene switcher settings window
  • switching between macros
Does that match your observations?
If it does, do you know what settings you had changed beforehand?
(Maybe some special text characters are triggering the crash)
Thank you for your response. I will continue to monitor these crash issues.

Meanwhile, I've encountered some new problems to report, which are quite critical for me and might even prevent me from continuing to use adv-ss for similar project designs. Here are the details:

In my game livestreams, I need to use OCR functionality to recognize various elements on the game interface, including names, numerical values, timestamps, and other information. These elements contain English, numbers, symbols, and Chinese characters, requiring different Tesseract language models such as **eng**, **chi_sim**, **digits**, and some custom-trained models. Since there are over 50 areas requiring recognition, many macros rely heavily on OCR, leading to severe lag when switching between macros. This lag is extremely frustrating, and I sincerely hope for a resolution.

Now, addressing the core issue: I’ve noticed significant differences in OCR efficiency across models. For example, **digits** works quickly, allowing multiple OCR scans per second, while **chi_sim** is much slower, taking ~10 seconds per scan. However, when using multiple models simultaneously, something strange occurs—the faster models (like **digits**) slow down to match the speed of the slowest model (e.g., **chi_sim**). When the screen is static (i.e., OCR is inactive), the refresh rate returns to normal. But once OCR activates, all models slow to the worst-case speed. Even adding a 1-second loop timer in the macro fails to improve efficiency. Worse, the OCR results often reflect data from 10 seconds prior, making real-time application impossible.

I hope I’ve explained this clearly. Could you please investigate whether this issue exists?

Thank you so much!
If needed, I’d be happy to demonstrate my setup and use case in real time via a suitable method.
 
A JSONPath query will always return a JSON array, as the query can return multiple results.
I also stumbled over that, which is why I decided to include the option to access JSON array elements.

View attachment 112977

I thought about automatically stripping the array in case only one / no result is found, but decided against it, as deviating from default JSONPath behavior might cause incompatibilities in the future / surprise other potential users of this functionality.


I just gave it a try, but unfortunately I am not able to reproduce the problem and the variable values used in the query are resolved as expected.
Maybe "CardId" was not set to the expected value?
This would result in the behavior you described, as the query would return an empty array if the given Id was not found.
View attachment 112978

Or did I misunderstand the problem?

And thank you a lot for your feedback!
Thank you! as too often, it was just a typo. I had CardId, and should just be CarId. So used to pair programing catching these instantly, lol - Now to clean up a lot of the macros.
 
Thank you for your response. I will continue to monitor these crash issues.

Meanwhile, I've encountered some new problems to report, which are quite critical for me and might even prevent me from continuing to use adv-ss for similar project designs. Here are the details:

In my game livestreams, I need to use OCR functionality to recognize various elements on the game interface, including names, numerical values, timestamps, and other information. These elements contain English, numbers, symbols, and Chinese characters, requiring different Tesseract language models such as **eng**, **chi_sim**, **digits**, and some custom-trained models. Since there are over 50 areas requiring recognition, many macros rely heavily on OCR, leading to severe lag when switching between macros. This lag is extremely frustrating, and I sincerely hope for a resolution.

Now, addressing the core issue: I’ve noticed significant differences in OCR efficiency across models. For example, **digits** works quickly, allowing multiple OCR scans per second, while **chi_sim** is much slower, taking ~10 seconds per scan. However, when using multiple models simultaneously, something strange occurs—the faster models (like **digits**) slow down to match the speed of the slowest model (e.g., **chi_sim**). When the screen is static (i.e., OCR is inactive), the refresh rate returns to normal. But once OCR activates, all models slow to the worst-case speed. Even adding a 1-second loop timer in the macro fails to improve efficiency. Worse, the OCR results often reflect data from 10 seconds prior, making real-time application impossible.

I hope I’ve explained this clearly. Could you please investigate whether this issue exists?

Thank you so much!
If needed, I’d be happy to demonstrate my setup and use case in real time via a suitable method.
Using 50 OCR checks is quite unusual and very likely also causes the extreme UI lag you have described.
The plugin does not allow modifying settings while the condition checks are running.
50 OCR checks will take a while to finish and thus the plugin UI will freeze up for quite a while.

The plugin also checks the conditions of every macro sequentially.
So if you have one particular macro, which is using a very slow / resource intensive OCR checks, all other condition checks of the other macros will be on halt during this time.

To work around those limitations I have prepared an experimental build of the plugin, which allows you to run the condition checks of macros in parallel to each other, instead of sequentially.
This build will be available here on GitHub:
(You will have to be logged into a GitHub account to be able to download it - let me know if that should be an issue)

The option can be found in echo of the macro's settings menu:

1745357909824.png


Assuming you have the necessary CPU resources available this might alleviate the problems you are facing.
I was only able to perform some basic testing with this build, so if you face problems, please let me know.
 
Running M3 Macbook pro - someone PLEASE give me a step by step breakdown of exactly what to do in order to get this thing to work. I've tried downloading every file available, cut and pasting in every folder. The best I've gotten is bricking OBS and needing to uninstall and reinstall...
 
Running M3 Macbook pro - someone PLEASE give me a step by step breakdown of exactly what to do in order to get this thing to work. I've tried downloading every file available, cut and pasting in every folder. The best I've gotten is bricking OBS and needing to uninstall and reinstall...
I would recommend you download the *.pkg installer of the desired version of the plugin:

InstallMacOS1.gif


Next you will have to "right-click" on the downloaded *.pkg file and select "Open".
Then click "Open" again and click through the installer's instructions.
InstallMacOS2.gif


On some MacOS versions and depending on its security settings you might also have to explicitly allow the plugin to be loaded:

1745398902663.png


Once that is complete launch OBS and you should be able to see the Advanced Scene Switcher entry in the "Tools" menu:

1745399015955.png


If you do want to manually install the plugin (*not* recommended) you will have to download the "advanced-scene-switcher-*-macos-universal.tar.xz" archive instead and copy the contents to:
~/Library/Application Support/obs-studio/plugins/advanced-scene-switcher.plugin.
Afterwards open up the "Terminal" application and run this command:
codesign --force --deep --sign - ~/Library/Application\ Support/obs-studio/plugins/advanced-scene-switcher.plugin

I hope that helps!
 
Using 50 OCR checks is quite unusual and very likely also causes the extreme UI lag you have described.
The plugin does not allow modifying settings while the condition checks are running.
50 OCR checks will take a while to finish and thus the plugin UI will freeze up for quite a while.

The plugin also checks the conditions of every macro sequentially.
So if you have one particular macro, which is using a very slow / resource intensive OCR checks, all other condition checks of the other macros will be on halt during this time.

To work around those limitations I have prepared an experimental build of the plugin, which allows you to run the condition checks of macros in parallel to each other, instead of sequentially.
This build will be available here on GitHub:
(You will have to be logged into a GitHub account to be able to download it - let me know if that should be an issue)

The option can be found in echo of the macro's settings menu:

View attachment 113017

Assuming you have the necessary CPU resources available this might alleviate the problems you are facing.
I was only able to perform some basic testing with this build, so if you face problems, please let me know.
Thank you! I'll try it!
 
Thank you! I'll try i

Using 50 OCR checks is quite unusual and very likely also causes the extreme UI lag you have described.
The plugin does not allow modifying settings while the condition checks are running.
50 OCR checks will take a while to finish and thus the plugin UI will freeze up for quite a while.

The plugin also checks the conditions of every macro sequentially.
So if you have one particular macro, which is using a very slow / resource intensive OCR checks, all other condition checks of the other macros will be on halt during this time.

To work around those limitations I have prepared an experimental build of the plugin, which allows you to run the condition checks of macros in parallel to each other, instead of sequentially.
This build will be available here on GitHub:
(You will have to be logged into a GitHub account to be able to download it - let me know if that should be an issue)

The option can be found in echo of the macro's settings menu:

View attachment 113017

Assuming you have the necessary CPU resources available this might alleviate the problems you are facing.
I was only able to perform some basic testing with this build, so if you face problems, please let me know.

Thank you for the update. I tested your new changes and checked both options in your example for all macros using OCR. Currently, the OCR results are not being updated—they seem to be stuck. I enabled the "highlight running macros" and "highlight running actions in green" options, and I can see that the macros are indeed running. However, the OCR results are not refreshing.

In the same macro that performs OCR every second, other variable assignment operations are working correctly—the variable table shows that the update time is accurate (once per second). I also tested an incremental variable operation within the same macro, and it continued to increase as expected. However, the OCR results remain unchanged.

When I manually trigger the OCR condition and then manually run the macro (or click "Run Macro" twice in a row), the OCR results do update. This suggests that the macro is functioning properly, and its performance is not being slowed down by OCR delays—the speed is as expected. However, the OCR results themselves are not refreshing automatically.

The above is what I observed during testing.
 
Thank you for the update. I tested your new changes and checked both options in your example for all macros using OCR. Currently, the OCR results are not being updated—they seem to be stuck. I enabled the "highlight running macros" and "highlight running actions in green" options, and I can see that the macros are indeed running. However, the OCR results are not refreshing.

In the same macro that performs OCR every second, other variable assignment operations are working correctly—the variable table shows that the update time is accurate (once per second). I also tested an incremental variable operation within the same macro, and it continued to increase as expected. However, the OCR results remain unchanged.

When I manually trigger the OCR condition and then manually run the macro (or click "Run Macro" twice in a row), the OCR results do update. This suggests that the macro is functioning properly, and its performance is not being slowed down by OCR delays—the speed is as expected. However, the OCR results themselves are not refreshing automatically.

The above is what I observed during testing.
Thanks for your test!

Can you share a log with verbose logging enabled?
What exactly do you mean by "the OCR results are not being updated / refreshed"?
Is the condition simply never true and thus the macros are not being executed?
 
Thanks for your test!

Can you share a log with verbose logging enabled?
What exactly do you mean by "the OCR results are not being updated / refreshed"?
Is the condition simply never true and thus the macros are not being executed?

The condition was met, and the operation under the established condition was executed, but the OCR information was not transmitted or updated.
 

Attachments

I am not finding docs or details to answer this, so please direct me towards them or if you have the answer....

How do I get the value of the OCR matched text into a variable?
 
Hello again.
Unfortunately, I'm still stuck with the following problem:
The stored values in my variable 'ACW___Dummy_Speicher02' are:
0
12
0
14
What conditions/actions do I have to use to execute the following?
The value (0) of the first line should be written to the variable 'ACW_Pre_Cam11'.
The value (12) of the second line should be written to the variable 'ACW_Pre_Cam12'.
The value (0) of the third line should be written to the variable 'ACW_Pre_Cam13'.
And the value (14) of the fourth line should be written to the variable 'ACW_Pre_Cam14'.

Unfortunately, Destroy666's great help isn't helping me, as I don't understand how to read the entire value from a variable and write only a specific part to another variable.
Link


I got a little further with the example from the wiki.
Link
I've adapted what's written there to my case.
Instead of using a variable, I'm working with a source.
Understood, and it's not a problem.​
I don't care where the values are stored.​
The OBS source is fine.​
A variable would be great. Then you'd have everything in one place.​
But an external txt file would also be perfectly fine.​
The further actions shorten the content of the source.
I don't quite understand the RegEx. But it works.​
In the end, the value of my variable 'ACW___Dummy_Speicher02' looks like this:
0\n12\n0\n14
This is where my understanding ends.
How do I write the individual parts (0 & 12 & 0 & 14) of the value into the variable 'ACW_Pre_Cam11'...?

If someone here can explain this in German, that would help me a bit. Otherwise, the translation program is running hot!
 
What conditions/actions do I have to use to execute the following?
The value (0) of the first line should be written to the variable 'ACW_Pre_Cam11'.
The value (12) of the second line should be written to the variable 'ACW_Pre_Cam12'.
The value (0) of the third line should be written to the variable 'ACW_Pre_Cam13'.
And the value (14) of the fourth line should be written to the variable 'ACW_Pre_Cam14'.
You will have to perform the following actions.
  • First assign the value of ACW___Dummy_Speicher02 to each of your ACW_Pre_CamX variables like so:
    1745618479535.png
  • Next up for each of those variables extract the corresponding line using regular expressions like so:
    1745618525477.png

    The following settings have to be used for the regluar expression:
    1745618614113.png

Here it is in action:
Example.gif


If you want to import the example macro you can use this code:

Code:
AAArPHic7Zpbb9s2FID/ikD0Ycs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