Advanced Scene Switcher

Advanced Scene Switcher 1.28.1

Warmuptill

Active Member
Thanks for the quick reply. I attached my settings export and here's a video of what happens too if it helps at all. I also tried re-installing using the windows non-installer version (original install was with the installer) just in case but still ended up with the same thing.

I can't reproduce the behaviour on my end when using your settings.
But one thing seemed a bit strange to me and might be related to the cursor issue.

What do you intend to achieve with this condition?

1704301462165.png


It will result in "valheim.exe" being started every 250 milliseconds which is probably not what you are trying to do.
This probably causes a lot of system load and could result in this cursor behavior.
 
Last edited:

miko3ed

New Member
Does anyone know if there is a way to have a macro action reset a sequence inside of another macro to start back at the first macro in its list?
 

Warmuptill

Active Member
Does anyone know if there is a way to have a macro action reset a sequence inside of another macro to start back at the first macro in its list?
A build with the requested functionality will be available here in a few minutes:
(You will have to be logged into GitHub to be able to download it)

While i don't expect any problems, I would recommend to backup your settings just in case before installing this build.
If you do run into any issues let me know! :)

1704559296805.png
 
Last edited:

AaronD

Active Member
A build with the requested functionality will be available here in a few minutes:
(You will have to be logged into GitHub to be able to download it)

While i don't expect any problems, I would recommend to backup your settings just in case before installing this build.
If you do run into any issues let me know! :)

View attachment 100688
Nice! Arbitrary index, not just "reset to start". That'll be useful for other things too.
 

BallLicker42069

New Member
I can't reproduce the behaviour on my end when using your settings.
But one thing seemed a bit strange to me and might be related to the cursor issue.

What do you intend to achieve with this condition?

View attachment 100617

It will result in "valheim.exe" being started every 250 milliseconds which is probably not what you are trying to do.
This probably causes a lot of system load and could result in this cursor behavior.
That was actually just me messing around with it to see if any of the conditions were causing it but I forgot to change it back before sending bc I was frustrated after trying to fix it for a while lol, it was originally set up to start recording when the game starts like the one that was above it for rocket league.

Very odd that I seem to be the only one having this issue... not a single post anywhere about someone having the same issue. When I get back home I'll probably try doing a fresh OBS/SceneSwitcher install on a different drive, see if that fixes it.
 

phillymantis

New Member
Is there a computational limitation when it comes to checking if media is playing?

I run a RIPPER of a PC.... 4090 gfx 14900 cpu

normally everything runs smooth as butter but i tried something interesting today...
i wanted to see if i could simplify how i handle hiding videos after playback
so instead of playing a video (waiting in streamdeck) then hiding a video

i used Adv SS and ran two macros

one for if media "any media source on (scene with 20 medias) state is playing do this
and one for if media "any media source on (scene with 20 medias) state is playing do this

they both work flawlessly...but im noticing OBS starts to hang a little every now and then now, and one of my macros that enables a media on scene change....now comes in 5 seconds later

i tried a few things like choosing run macro in parallel to other macros but same outcome.
I even raised the priority thread level to highest and still

I figured maybe checking the state of 20 videos is too much even though i dont see a rise in cpu usage or gpu usage
So i tried to prepend the conditions with a condition that first checks for scene item visibility matching a pattern...and left it on all

my thought process was ...maybe checking scene visibility will happen first...then if true...it will move to the "and" media playing
but got the same outcome again...perplexing

is this not a good idea?

(EDIT: I got creative and did a OCR condition for screen brightness on the scene containing all the videos.... which seems to work way better....if a video is playing the screen is bright....if not...its dark....one check to rule them all lol)
 
Last edited:

Uzor

New Member
I'm trying to run a macro that's proving difficult. I do not know if it is because I don't understand or maybe the plugin might use another feature.

My problem is thus: I have a scroll text and on a colour source and grouped them together. I want the macro to run such that when I activate the group, the colour source slides up and the scrolling text starts 1 second after. And when I deactivate the group, the scrolling text disappears 1 second before the colour source deactivates.

Any workaround with this will be highly appreciated
 

redteatoo

New Member
I'm posting this question again in the wrong discussion thread!
AaronD, thanks for pointing me to the correct discussion thread :)

-

I need help with Advanced Scene Switcher's macros.

1. In normal times, scene “1” is shown and then
Is it possible to implement a macro where the scene "2" video appears briefly and then disappears only at "9 a.m." and "7 p.m." every day?

2. And will it work offline?

- I checked the article and tried it, but failed. I don't understand

This is the current setting, but it seems that an error occurs offline after 12 PM.
scene 1-2-3.jpg

It would be of great help to me if you could capture the screen and let me know what is wrong.


Thank you Happy New Year! :)
 

AaronD

Active Member
1. In normal times, scene “1” is shown and then
Is it possible to implement a macro where the scene "2" video appears briefly and then disappears only at "9 a.m." and "7 p.m." every day?
From your screenshots, it appears that you've forgotten to remove some things that didn't work, and their presence is still causing you problems. Just because *you* aren't thinking of something at the moment, doesn't mean it doesn't still have an effect. Know what you have, and keep it clean.

Anyway, would this work for you?:
1704990179201.png

1704990185958.png

There are lots of ways to do the same thing, and this one relies on the video itself to be the desired length. If you want to cut it short, then you can play with the return condition to do that too.

2. And will it work offline?
I'm not really sure what you mean by that, but all of what the plugin does is local to that machine and that instance of OBS. Nothing here requires internet directly.
 

Smart Net

New Member
Looking forward to find PAUSE Button or function for Advanced Scene Switcher

1) this is important when programming time START/STOP function
2) no chance of automation if you already use STOP button (need manualy use START button)
3) PAUSE is for prevent actions but not functionality of all MACROS include macro which might control start/stop of Advanced Scene Switcher

finaly hotkey for PAUSE like TOGGLE would be great.

... any idea supporters? thanks
 

Attachments

  • CaptureX.PNG
    CaptureX.PNG
    8.7 KB · Views: 14

kofibulize

New Member
Hi I'm looking for help setting up scene switching based on what is on the screen. Basically I have three scenes based on if I'm player 1, player 2, or for everything else.

I'm using the video macro with exact pattern matching to switch to either the player 1 or player 2 scenes and those work fine. I have it looking for my in game player name so if it is on player 1 side it switches to player 1 scene and vice versa.

I can't for the life of me figure out which combination of settings to have it switch back to my "menus" scene after the matches end.

Attached are screenshots of my settings with the in game visuals for comparison.

Thanks and I appreciate any help.

This is for the player 1 switch which works
p1 scene.png


This is for the player 2 switch which works
p2 scene.png


This was my attempt to return to menu macro which does not work. My logic was that the source does not show my player name on both player 1 and player 2 sides it would switch to the menus scene.
menus scene.png


Here is an in match screenshot for player 1 side
in match.png
 

Warmuptill

Active Member
First of all - sorry about the delayed responses!

Is there a computational limitation when it comes to checking if media is playing?

I run a RIPPER of a PC.... 4090 gfx 14900 cpu

normally everything runs smooth as butter but i tried something interesting today...
i wanted to see if i could simplify how i handle hiding videos after playback
so instead of playing a video (waiting in streamdeck) then hiding a video

i used Adv SS and ran two macros

one for if media "any media source on (scene with 20 medias) state is playing do this
and one for if media "any media source on (scene with 20 medias) state is playing do this

they both work flawlessly...but im noticing OBS starts to hang a little every now and then now, and one of my macros that enables a media on scene change....now comes in 5 seconds later

i tried a few things like choosing run macro in parallel to other macros but same outcome.
I even raised the priority thread level to highest and still

I figured maybe checking the state of 20 videos is too much even though i dont see a rise in cpu usage or gpu usage
So i tried to prepend the conditions with a condition that first checks for scene item visibility matching a pattern...and left it on all

my thought process was ...maybe checking scene visibility will happen first...then if true...it will move to the "and" media playing
but got the same outcome again...perplexing

is this not a good idea?

(EDIT: I got creative and did a OCR condition for screen brightness on the scene containing all the videos.... which seems to work way better....if a video is playing the screen is bright....if not...its dark....one check to rule them all lol)
Glad to hear that you figured out a workaround! :)
Checking the media states of 20 source is a rather computationally "cheap" operation compared to performing OCR using the Video condition.
So I assume something else must have caused the observed delay.
If you still want to investigate the issue, can you please share an OBS log showing the delay with vebose logging enabled?

I'm trying to run a macro that's proving difficult. I do not know if it is because I don't understand or maybe the plugin might use another feature.

My problem is thus: I have a scroll text and on a colour source and grouped them together. I want the macro to run such that when I activate the group, the colour source slides up and the scrolling text starts 1 second after. And when I deactivate the group, the scrolling text disappears 1 second before the colour source deactivates.

Any workaround with this will be highly appreciated
Unfortunately I don't think this will be possible.
The reason for this is that if you hide the group toggling the visibility of the group elements won't have any effect.
They will remain hidden regardless.

You could however instead try to set up a hotkey to achieve the same effect, if tying the functionality to the group visibility is not a strict requirement.

For example something like this could be used to set up a macro to first show the color source, wait one second, and then show the text source. (The same could be done to hide them)

1705087243863.png


Looking forward to find PAUSE Button or function for Advanced Scene Switcher

1) this is important when programming time START/STOP function
2) no chance of automation if you already use STOP button (need manualy use START button)
3) PAUSE is for prevent actions but not functionality of all MACROS include macro which might control start/stop of Advanced Scene Switcher

finaly hotkey for PAUSE like TOGGLE would be great.

... any idea supporters? thanks
The option to pause individual macros via hotkey is already available it is just not enabled by default.
You can enable it like this:
PauseHotkey.gif

Is this what you had in mind?

Hi I'm looking for help setting up scene switching based on what is on the screen. Basically I have three scenes based on if I'm player 1, player 2, or for everything else.

I'm using the video macro with exact pattern matching to switch to either the player 1 or player 2 scenes and those work fine. I have it looking for my in game player name so if it is on player 1 side it switches to player 1 scene and vice versa.

I can't for the life of me figure out which combination of settings to have it switch back to my "menus" scene after the matches end.

Attached are screenshots of my settings with the in game visuals for comparison.

Thanks and I appreciate any help.

This is for the player 1 switch which works
View attachment 100812

This is for the player 2 switch which works
View attachment 100813

This was my attempt to return to menu macro which does not work. My logic was that the source does not show my player name on both player 1 and player 2 sides it would switch to the menus scene.
View attachment 100814

Here is an in match screenshot for player 1 side
View attachment 100816
I would suggest to use a macro like this to handle the "menu" case:

1705088198801.png


The condition type "Macro" is used here to check if the condition of "p2switch" are *not* true and the conditions of "p1switch" are also *not* true.
Hope that helps! :)
 

kofibulize

New Member
First of all - sorry about the delayed responses!


Glad to hear that you figured out a workaround! :)
Checking the media states of 20 source is a rather computationally "cheap" operation compared to performing OCR using the Video condition.
So I assume something else must have caused the observed delay.
If you still want to investigate the issue, can you please share an OBS log showing the delay with vebose logging enabled?


Unfortunately I don't think this will be possible.
The reason for this is that if you hide the group toggling the visibility of the group elements won't have any effect.
They will remain hidden regardless.

You could however instead try to set up a hotkey to achieve the same effect, if tying the functionality to the group visibility is not a strict requirement.

For example something like this could be used to set up a macro to first show the color source, wait one second, and then show the text source. (The same could be done to hide them)

View attachment 100850


The option to pause individual macros via hotkey is already available it is just not enabled by default.
You can enable it like this:
View attachment 100851
Is this what you had in mind?


I would suggest to use a macro like this to handle the "menu" case:

View attachment 100852

The condition type "Macro" is used here to check if the condition of "p2switch" are *not* true and the conditions of "p1switch" are also *not* true.
Hope that helps! :)
Hi Warmuptill,

Yes this appears to be working! Much appreciated!
 

bradleyp

New Member
Hello,
I'm trying to get OBS to behave like Xbox Game Capture or Nvidia Instant Replay, where it only records the last n seconds of whatever the current active window or game is. My idea is that I want to "set it and forget it" without having to touch OBS to update the source if I switch games or windows.

Using Adv Scene Switcher, I have a macro that, theoretically, should update my "Game Capture" source's window to the currently active window. I would like to think that I have everything setup correctly in the macro, but there's a good chance I'm misunderstanding or missing something.

I originally tried using vanilla OBS to do this using a Python script which also failed. Everything worked until it came to actually changing the source's settings and nothing seemed to change.
If you think like a programmer and want to see my script, I'll add it here:
Python:
import obspython as obs
# pip install psutil pywin32
import win32gui
import win32process
import psutil

source_name = "Game Capture"
prev_window = ""

def create_title(pid_name, window_title):
    # will format string as: '[application.exe]: window title string'
    return f'[{pid_name}]: {str(window_title)}'

def get_active_window():
    fg_window = win32gui.GetForegroundWindow()
    fg_window_name = win32gui.GetWindowText(fg_window)
    fg_pid = win32process.GetWindowThreadProcessId(fg_window)
    fg_pid_name = psutil.Process(fg_pid[-1]).name()
    title = create_title(fg_pid_name, fg_window_name)
    return title

def change_source_settings(window_title):
    source = obs.obs_get_source_by_name(source_name)
   
    settings = obs.obs_data_create()
    obs.obs_data_set_string(settings, "window", window_title)
    obs.obs_source_update(source, settings)
    # cleanup
    obs.obs_data_release(settings)
    obs.obs_source_release(source)

def window_changed(window, prev_window):
    if window != prev_window:
        prev_window = window
        return True
    return False

def main():
    # get active Windows window
    active_window = get_active_window()
   
    # if the window changed, update source settings
    if window_changed(active_window, prev_window):
        change_source_settings(active_window)

def script_description():
    return "Python script to update Window Capture based on active window"

obs.timer_add(main, 1000)

Otherwise, here is my macro:
1705165755445.png


I only have 1 scene with 1 source. Using the Macro visual settings, the macro fires off as intended every time I change the active window on my computer. It just doesn't seem to actually update the source.

Any ideas?

edit:
sorry if I'm using incorrect wording anywhere in here, I'm new to OBS and plugins. Feel free to correct me wherever
 

Warmuptill

Active Member
Hello,
I'm trying to get OBS to behave like Xbox Game Capture or Nvidia Instant Replay, where it only records the last n seconds of whatever the current active window or game is. My idea is that I want to "set it and forget it" without having to touch OBS to update the source if I switch games or windows.

Using Adv Scene Switcher, I have a macro that, theoretically, should update my "Game Capture" source's window to the currently active window. I would like to think that I have everything setup correctly in the macro, but there's a good chance I'm misunderstanding or missing something.

I originally tried using vanilla OBS to do this using a Python script which also failed. Everything worked until it came to actually changing the source's settings and nothing seemed to change.
If you think like a programmer and want to see my script, I'll add it here:
Python:
import obspython as obs
# pip install psutil pywin32
import win32gui
import win32process
import psutil

source_name = "Game Capture"
prev_window = ""

def create_title(pid_name, window_title):
    # will format string as: '[application.exe]: window title string'
    return f'[{pid_name}]: {str(window_title)}'

def get_active_window():
    fg_window = win32gui.GetForegroundWindow()
    fg_window_name = win32gui.GetWindowText(fg_window)
    fg_pid = win32process.GetWindowThreadProcessId(fg_window)
    fg_pid_name = psutil.Process(fg_pid[-1]).name()
    title = create_title(fg_pid_name, fg_window_name)
    return title

def change_source_settings(window_title):
    source = obs.obs_get_source_by_name(source_name)
 
    settings = obs.obs_data_create()
    obs.obs_data_set_string(settings, "window", window_title)
    obs.obs_source_update(source, settings)
    # cleanup
    obs.obs_data_release(settings)
    obs.obs_source_release(source)

def window_changed(window, prev_window):
    if window != prev_window:
        prev_window = window
        return True
    return False

def main():
    # get active Windows window
    active_window = get_active_window()
 
    # if the window changed, update source settings
    if window_changed(active_window, prev_window):
        change_source_settings(active_window)

def script_description():
    return "Python script to update Window Capture based on active window"

obs.timer_add(main, 1000)

Otherwise, here is my macro:
View attachment 100864

I only have 1 scene with 1 source. Using the Macro visual settings, the macro fires off as intended every time I change the active window on my computer. It just doesn't seem to actually update the source.

Any ideas?

edit:
sorry if I'm using incorrect wording anywhere in here, I'm new to OBS and plugins. Feel free to correct me wherever
What is causing issues for you is that you are trying to set the "Window" setting to the string that is being displayed to you in the Window Capture source's properties menu, instead of the actually required "backend" value.

The backend value does not only consist of the title of the window and the process name but also the window class.
So for example this "[powershell.exe]: Window PowerShell" value in the UI ...

1705172451440.png


... is represented by the string "Windows PowerShell:ConsoleWindowClass:powershell.exe" in the backend.

You can test this clicking the "Get current settings" button:

1705172563229.png


So you will have adapt your python script to also get the window class name and adjust the format.

The advanced scene switcher does not currently have the option to retrieve the window class in the official release.
I started a build which exposes the window class as well so you could use a setup like this to automatically change the settings of the window capture source:
Should be done in a few minutes.
You will have to be logged into GitHub to be able to download it.
(Please back up your settings before trying it just in case)

1705174779687.png


If you want to import the example you can use this code to do so:
Code:
AAATMnic7Vhbb9s2FP4rBLGHrb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Ajg78Bg2eOTq9I46U/N5Ar9UjjI43/I42TQDxn+/rb8Mxe4JSlp7tZfQWTv9t1/5s00/judnr73h2Z5lnij4+8/7/yfhx4P2yJ/w1Ir2Wt0icoH+RPlNZnvy2BhGVMWrfwraH9crAL1cLVhML1i1Xe3JXv2npBTSEzT8xugOgaL6X9AJ/iP7CSiJrw4PZorB5MaoNf3Nz40cRXzyzelgNwt/I+HdmlcrRwt3car/z27nJrRS3Ret+FHtxJNLkPbiH4htTcxAPP4iiePENf7nhw8/rXIdq/of/keNu51OFkNHk7mgxPkmF+erL+ZXNC3uPmb0mfhzM=

I can't guarantee that this will work for all windows, but I hope it helped in some way and cleared things up! :)

Pinging @shocknoble as they were also interested in setting this up.
 

Warmuptill

Active Member
The new twitch integration is amazing! Is there a way to get twitch speciffic identifiers like username of latest follower/subscriber/raider etc. (like special identifiers in the MixItUp Bot https://wiki.mixitupapp.com/en/special-identifiers) and store them as variables/save them to a txt file?
That should be doable by using a macro similar to this:
1705341242421.png

Let me know if you have any questions / something does not work!
 
just curious, not asking for a feature, but is there a way to go to a previous source instead scene?

Specifically with the commercial thing in wiki, I use this lua script so a bunch of sources that are grouped,
only one source can be active in the group at a time, so it would be more in line with the rest of my
setup if that source was in the group too. Instead of having this random scene floating around just for
commercials. heh.

I can easily change TO the source, I just dont know how to make adv-ss know what the previous source was
to get back to.

Hope this made sense.
 

Destroy666

Member
Just to make sure, there's no way to receive more fields than `message` with WebSocket, right? And you have to use regexes or the new JSON extraction functionality (in nested JSON) to extract data?

just curious, not asking for a feature, but is there a way to go to a previous source instead scene?

WDYM by "go to source"? That's not really an available action. Sources = elements in scenes that you can't switch into. You can enable/disable them or change their settings. From your description I assume you're using Scene Item VIsibility actions and that supports both indexes and variables if you click on cog icon:
1705414413648.png
. Both of which can be automated to go in both directions, e.g. by decreasing index stored in a variable. If you're not using that and Source Enable/Disable instead, you should switch.
 
Top