Anytime Help Center

Contact Us

If you still have questions or prefer to get help directly from an agent, please submit a request.
We’ll get back to you as soon as possible.

Please fill out the contact form below and we will reply as soon as possible.

  • Support
  • Guest
  • Log In
English (US)
US English (US)
DE German
CN Chinese
MX Spanish (Mexico)
Chinese (Simplified)
  • AKG
    Microphones Wireless Integrated Systems Automatic Mixers Headphones Discontinued Products (AKG) General AKG Inquiries Certifications (AKG)
  • AMX
    Networked A/V Distribution (AVoIP) Traditional A/V Distribution Video Signal Processing Architectural Connectivity User Interfaces Control Processing Power (AMX) Programming (AMX) Software (AMX) Discontinued Products (AMX) General AMX Inquiries Certifications (AMX)
  • BSS
    Soundweb™ Omni Soundweb™ London Soundweb™ Contrio™ Software (BSS) Discontinued Products (BSS) General BSS Inquiries Certifications (BSS)
  • Crown
    CDi DriveCore Series CDi Series Commercial Series ComTech Series DCi DriveCore Series I-Tech HD Series XLC series XLi Series XLS DriveCore 2 Series XTi 2 Series Discontinued Products (Crown) Software (Crown) General Crown Inquiries Certifications (Crown)
  • dbx
    CX Series 500 Series DriveRack Personal Monitor Control ZonePRO Zone Controllers FeedBack Suppression Microphone Preamps Dynamics Processors Crossovers Equalizers Software (dbx) Discontinued Products (dbx) General dbx Inquiries Certifications (dbx)
  • Flux::
    Immersive Processing Analysis Subscriptions General FLUX: Inquiries
  • JBL
    Cinema Sound Installed Live Portable Tour Sound Recording & Broadcast Software (JBL) Discontinued Products (JBL) Video Manual Series (JBL) General JBL Inquiries Certifications (JBL)
  • Lexicon
    Plugins Effects Processors Cinema Discontinued Products (Lexicon) Video Manual Series (Lexicon) General Lexicon Inquiries Certifications (Lexicon)
  • Martin
    Atomic ELP ERA Exterior MAC P3 VC VDO Tools Discontinued Products (Martin) General Martin Inquiries Certifications (Martin)
  • Soundcraft
    Digital Analog Connected Analog Only Discontinued Products (Soundcraft) Video Manual Series (Soundcraft) General Soundcraft Inquiries Certifications (Soundcraft)
  • General HARMAN Inquiries
    Dante
+ More
  • Home
  • AMX
  • Software (AMX)
  • MUSE Automator & Extension for VS Code

Using Arrays to Create Multiple Watches

Technical Support Guide

Written by Will Fraser

Updated at February 19th, 2026

Table of Contents

Brand: Models: Overview: Example Code: Important!

Brand:

  • AMX

Models:

  • MUSE

Overview:

​The below code utilizes arrays to create multiple sets of watch events without having to create a separate watch for each button.


Example Code: 

Important!

It is important to remember that creating a watch for something that does not exist in the Descriptor file will cause an exception in the program that will cause the loop to fail and possibly stop the script.  Make sure that every step in the array creates a watch for devices, ports, buttons, etc. that exist.

 

from mojo import context

context.log.info('Sample Python program')


#Gather the context for your devices
dvVaria = context.devices.get("AMX-11241")

#Group ports and buttons numbers that you would create watches for
ports = [1]
transportButtons = [1,3,4]
menuButtons = [5,18,22]

#Function takes in button presses from the transportButtons array of button numbers
def processTransportButtons(event):
    print(f"Event info: {event.__dict__}")
    #Other event processing goes here

#Function processes button events from the menuButtons array
def processMenuButtons(event):
    print(f"Event info: {event.__dict__}")
    #Other event processing goes here

#The next two for loops create a watch for each button in the transportButtons and menuButtons arrays
#The watches are created for each panel and each port, in total, each 4 line loop creates 12 watches
for panel in dvTPs:
    for portnumber in ports:
        for channel in transportButtons:
            panel.port[portnumber].button[channel].watch(processTransportButtons)

for panel in dvTPs:
    for portnumber in ports:
        for channel in menuButtons:
            panel.port[portnumber].button[channel].watch(processMenuButtons)            

# leave this as the last line in the Python script
context.run(globals())

Related Videos

framework blueprint

Was this article helpful?

Yes
No
Give feedback about this article

Table of Contents

Brand: Models: Overview: Example Code: Important!

Related Articles

  • Visual Studio Code Notifications
  • Enable Automator (Node-RED) in MUSE
  • Hex String to IP device in Muse Automator
  • Muse Automator Toggle Example
  • Muse Automator: send strings to TCP device example

Related Articles

  • Visual Studio Code Notifications
  • Enable Automator (Node-RED) in MUSE
  • Hex String to IP device in Muse Automator
  • Muse Automator Toggle Example
  • Muse Automator: send strings to TCP device example
Copyright © HARMAN Professional. All rights reserved. Privacy Policy | Terms of Use
Expand