No internet connection
  1. Home
  2. Ideas

Add "Show On Same Device" to SF Deck methods

By Matt Friedman @Matt_Friedman
    2024-04-08 17:56:59.136Z

    I think it'd be great if the "Show Deck on Stream Deck" and "Open Deck (Show on Device)" commands got support for one more option: "Open on Same Device", like we're allowed to do when we have a Deck assigned to another Deck's button.

    Something like this would be fabulous:

    sf.decks.get('foo:bar').showOnStreamDeck({
        device: "openOnSameDevice",
    });
    
    // or //
    
    sf.decks.get('foo:bar').showOnStreamDeck({
        device: "",
        openOnSameDevice: true
    });
    

    For me this would help a lot. I created my first package, and it's really about StreamDeck layouts I made. But sometimes I want to load specific decks at the same time as running a command. But I can't really script this for other users who have unknown devices to me. I'd love to be able to run a script action that does whatever, but also loads one of my pre-made Decks onto the current device. Having this extra argument as an option would make this possible, particularly when making packages for other users in the community to utilize.

    • 8 replies
    1. If the script in question is being run from a deck, you could do:

      sf.decks.get('foo:bar').showOnStreamDeck({
          device: event.deck.device,
      });
      
      1. MMatt Friedman @Matt_Friedman
          2024-04-08 23:04:57.855Z

          That helps a lot! So I can ignore the inspection error that the SF editor highlights on "device" not being the expected property type?

          1. The correct action to use is actually the open action instead, which has proper highlighting:

            sf.decks.get('blabla').open({
                device: event.deck.device,
            });
            
          2. In reply tochrscheuer:
            MMatt Friedman @Matt_Friedman
              2024-04-08 23:21:42.824Z

              Sort of a related follow up.

              If I set up a template script, and one of the properties is AxDeck or AxDeckOrPreset, in the event.props for that one, is it possible to get the local command id of whatever Deck is selected from the AxDeck/AxDeckOrPreset property?

              1. Yes it probably would be, but it's easier to help if you tell us why you think you need that id (as I think you won't need the id).

                1. MMatt Friedman @Matt_Friedman
                    2024-04-09 01:39:38.722Z

                    Well I have a simple script that does the following:

                    1. Run an action (in this case just a simple press keys action)
                    2. Load a specific Deck from my package onto the current device

                    Since I have about a half dozen of these Scripts, all with identical code, the only differences being the keys being pressed and the decks being loaded, I figured I'd turn one script into a template, so I could use presets to define the 2 variables needed - the keys to press and the Deck to load. I thought it'd be super cool to use the AxDeck property in that case so I can select from the decks themselves, assuming it was simple to extract a deck's command ID from the AxDeck property.

                    If not though, I can just as easily have normal individual scripts... I was just looking into a way to condense them into one as a template, just for the sake of code tidiness.

                    1. If the property is called myDeck for example, then it would be of type AxDeck.

                      As such, you don't need its ID. sf.decks.get('...') also gives you a AxDeck.

                      So, if your property is a AxDeck, you could just do:

                      /**@type {AxDeck} */
                      const myDeck = event.props.myDeck;
                      
                      myDeck.open({
                          device: event.deck.device,
                      });
                      
                      1. MMatt Friedman @Matt_Friedman
                          2024-04-09 18:46:55.098Z

                          That seems to work perfect for me. Thanks!!