nrkno / sofie-emberplus-connection

Ember+ Connection: A Part of the Sofie TV Studio Automation System
https://github.com/nrkno/Sofie-TV-automation/
MIT License
20 stars 15 forks source link

list all instance of a parameter #19

Closed dewiweb closed 1 year ago

dewiweb commented 2 years ago

Hello, Do you know if there's a solution to list all instance of a parameter?: I want to extract all user defined names of input channels of our MC²36 with one(or more) command. Regards

dewiweb commented 1 year ago
      async function getUserLabels() {

        root = await (await eGet.getDirectory(eGet.tree)).response

        let inputsUserLabels = [];
        let auxesUserLabels = [];
        let mastersUserLabels = [];
        let sumsUserLabels = [];
        let gpcsUserLabels = [];
        await mainFunctions.sleep(2000);
        for (i = 0x01; i < 0x0C1; i++) {
          try {
            //          await mainFunctions.sleep(2000);
            let req = await eGet.getElementByPath("_2._1._" + i.toString(16))
            inputsUserLabels.push(req.contents.description)
          } catch (e) {
            // exit the loop
            break;
          }
        };

        for (i = 0x01; i < 0x0C1; i++) {
          try {
            let req = await eGet.getElementByPath("_2._5._" + i.toString(16))
            auxesUserLabels.push(req.contents.description)
          } catch (e) {
            // exit the loop
            break;
          }
        };
        for (i = 0x01; i < 0x0C1; i++) {
          try {
            let req = await eGet.getElementByPath("_2._4._" + i.toString(16))
            sumsUserLabels.push(req.contents.description)
          } catch (e) {
            // exit the loop
            break;
          }
        };
        win.webContents.send('sumsUserLabels', sumsUserLabels);
        for (i = 0x01; i < 0x0C1; i++) {
          try {
            let req = await eGet.getElementByPath("_2._6._" + i.toString(16))
            mastersUserLabels.push(req.contents.description)
          } catch (e) {
            // exit the loop
            break;
          }
        };
        for (i = 0x01; i < 0x0C1; i++) {
          try {
            let req = await eGet.getElementByPath("_2._7._" + i.toString(16))
            gpcsUserLabels.push(req.contents.description)
          } catch (e) {
            // exit the loop
            break;
          }
        };
      };
      getUserLabels()