3. JavaScript command reference: Difference between revisions

From MXWendler Wiki
Jump to navigation Jump to search
Line 127: Line 127:
|<code>mxw.media("camera_name").ptz("ptz_focus_speed", speed_value)</code> || focus at a particular speed (-1= outwards, 1 = inwards)|| <code>mxw.media("USB Cam").ptz("ptz_focus_speed", -0.2)</code>
|<code>mxw.media("camera_name").ptz("ptz_focus_speed", speed_value)</code> || focus at a particular speed (-1= outwards, 1 = inwards)|| <code>mxw.media("USB Cam").ptz("ptz_focus_speed", -0.2)</code>
|-
|-
|<code>mxw.media("camera_name").ptz("ptz_white_balance_auto")</code> || Put the camera in auto white-balance mode || <code>mxw.media("USB Cam").ptz("ptz_white_balance_auto")</code>
|<code>mxw.media("camera_name").ptz("ptz_white_balance_auto")</code> || put the camera in auto white-balance mode || <code>mxw.media("USB Cam").ptz("ptz_white_balance_auto")</code>
|-
|-
|<code>mxw.media("camera_name").ptz("ptz_white_balance_indoor")</code> || Put the camera in indoor white balance || <code> mxw.media("USB Cam").ptz("ptz_white_balance_indoor")</code>
|<code>mxw.media("camera_name").ptz("ptz_white_balance_indoor")</code> || put the camera in indoor white balance || <code> mxw.media("USB Cam").ptz("ptz_white_balance_indoor")</code>
|-
|-
|<code>mxw.media("camera_name").ptz("ptz_white_balance_outdoor")</code> || Put the camera in outdoor white balance || <code> mxw.media("USB Cam").ptz("ptz_white_balance_outdoor")</code>
|<code>mxw.media("camera_name").ptz("ptz_white_balance_outdoor")</code> || put the camera in outdoor white balance || <code> mxw.media("USB Cam").ptz("ptz_white_balance_outdoor")</code>
|-
|-
|<code>mxw.makescreenshot</code> ||use the current brightness to automatically set the current white balance|| <code></code>
|<code>mxw.media("camera_name").ptz("ptz_white_balance_oneshot")</code> ||use the current brightness to automatically set the current white balance|| <code>mxw.media("USB_Cam").ptz("ptz_white_balance_oneshot")</code>
|-
|-
|<code>mxw.makescreenshot</code> || || <code></code>
|<code>mxw.media("camera_name").ptz("ptz_white_balance_manual", red value, blue value)</code> || Set the manual camera white balance using the R, B values, (0.0 = not red/not blue , 1.0 = very red/very blue)|| <code>mxw.media("camera_name").ptz("ptz_white_balance_manual", 0.1, 0.7)</code>
|-
|-
|<code>mxw.makescreenshot</code> || || <code></code>
|<code>mxw.media("camera_name").ptz("ptz_exposure_auto")</code> || put the camera in auto-exposure mode || <code>mxw.media("USB_Cam").ptz("ptz_exposure_auto")</code>
|-
|-
|<code>mxw.makescreenshot</code> || || <code></code>
|<code></code> || manually set the camera exposure iris, exposure_level || <code></code>
|-
|-
|<code>mxw.makescreenshot</code> || || <code></code>
|<code>mxw.makescreenshot</code> || || <code></code>
Line 173: Line 173:




DOK  -> ptz_white_balance_oneshot();


DOK Set the manual camera white balance using the R, B values, red = 0.0(not red) ... 1.0(very red) blue = 0.0(not blue) ... 1.0(very blue)
-> ptz_white_balance_manual(const float red, const float blue);


DOK Put the camera in auto-exposure mode -> ptz_exposure_auto();
 


DOK Manually set the camera exposure iris, exposure_level = 0.0(dark) ... 1.0(light)
DOK Manually set the camera exposure iris, exposure_level = 0.0(dark) ... 1.0(light)

Revision as of 15:56, 13 December 2022

Here are listed the main commands that can be used for scripting with JS.

Legend

The standard used to represent the available values for each command is:


FLOATS are represented with one decimal:

0.0 .. 1.0 → all float values between 0 and 1 included


INTEGERS are represented with numbers or descriptions:

1 .. 5 → all integers between 1 and 5 included ( 1 , 2 , 3 , 4 , 5 )
1 .. (MAX n layers) → all the integers between 1 and the maximum index of layers in MXW (e.g. if 6 layers are being used the values are integers between 1 and 6 included)

When only one number is indicated it means that only one option is given. This is found in addresses of buttons, checkboxes and in the options where "0" or "1" are the only significant values


STRINGS are represented between double quotation marks:

/mxw/set info

When “name” is contained in the available string variable, then the content is to be substituted with the actual name.

E.G. : to select and play a patch called “patch_one” from its name, the address /mxw/set with tokens "play" "name_of_patch" has to be used, resulting in this OSC command:

/mxw/set play patch_one


When OR is found it means that two options can deliver a similar result. One of the two formats has to be used at one time.

Here are listed all the commands that MXW recognizes.

Legend

The standard used to represent the available values for each command is:


FLOATS are represented with one decimal:

0.0 .. 1.0 → all float values between 0 and 1 included


INTEGERS are represented with numbers or descriptions:

1 .. 5 → all integers between 1 and 5 included ( 1 , 2 , 3 , 4 , 5 )
1 .. (MAX n layers) → all the integers between 1 and the maximum index of layers in MXW (e.g. if 6 layers are being used the values are integers between 1 and 6 included)

When only one number is indicated it means that only one option is given. This is found in addresses of buttons, checkboxes and in the options where "0" or "1" are the only significant values


STRINGS are represented between double quotation marks:

/mxw/set info

When “name” is contained in the available string variable, then the content is to be substituted with the actual name.

E.G. : to select and play a patch called “patch_one” from its name, the address /mxw/set with tokens "play" "name_of_patch" has to be used, resulting in this OSC command:

/mxw/set play patch_one


When OR is found it means that two options can deliver a similar result. One of the two formats has to be used at one time.

Set Reference

JS COMMAND DESCRIPTION EXAMPLE
Software Info
mxw.millis returns the amount of milliseconds passed since opening the software print_console("current passed time is" + mxw.millis );
mxw.width returns the current frame width in px print_console("frame width is" + mxw.width );
mxw.height returns the current frame height in px print_console("frame height is" + mxw.height);
mxw.outwidth returns current output width print_console("output height is" + outwidth);
mxw.outheight returns the current output height print_console("output width is" + mxw.outheight);
mxw.framecounter returns the amount of frames rendered since opening the software print_console("total number of frames rendered is" + mxw.framecounter);
I/O
mxw.dmx() returns the DMX value received from the specified universe and channel print_console("DMX value in u. 1, ch. 4 is" + mxw.dmx(1,4));
mxw.midi() returns the MIDI value received from the specified device and channel print_console("MIDI value in dev. 1, ch. 6 is" + mxw.midi(1,6));
mxw.keyboard("ASCII_code") returns if the specified key is pressed or not mxw.keyboard(65)
mxw.pjlink("on", "IP_ADDRESS", "pj_password") sends a pjlink command to the selected projector and turns it on mxw.pjlink("on", "192.168.1.2", "panasonic")
mxw.pjlink("off", "IP_ADDRESS", "pj_password") sends a pjlink command to the selected projector and turns it off mxw.pjlink("off", "192.168.1.2", "panasonic")
mxw.pjlink("avmute_on", "IP_ADDRESS", "pj_password") sends a pjlink command to the selected projector and mutes audio and video mxw.pjlink("avmute_on", "192.168.1.2", "panasonic")
mxw.pjlink("avmute_off", "IP_ADDRESS", "pj_password") sends a pjlink command to the selected projector and unmutes audio and video mxw.pjlink("avmute_off", "192.168.1.2", "panasonic")
mxw.pjlink("vmute_on", "IP_ADDRESS", "pj_password") sends a pjlink command to the selected projector and mutes video mxw.pjlink("vmute_on", "192.168.1.2", "panasonic")
mxw.pjlink("vmute_off", "IP_ADDRESS", "pj_password") sends a pjlink command to the selected projector and unmutes video mxw.pjlink("vmute_off", "192.168.1.2", "panasonic")
mxw.media("camera_name").ptz("ptz_is_supported") control if a NDI Camera supports PTZ mxw.media("USB Cam").ptz("ptz_is_supported")
mxw.media("camera_name").ptz("ptz_zoom", value) control the zoom of a NDI PTZ Camera, values from 0(zoomed in) to 1(zoomed out) mxw.media("USB Cam").ptz("ptz_zoom", 0.5)
mxw.media("camera_name").ptz("ptz_pan_tilt", value_pan, value_tilt) control the pan and tilting of a NDI PTZ Camera (values from -1 to 1) mxw.media("USB Cam").ptz("ptz_pan_tilt", -0.5, 0.2)
mxw.media("camera_name").ptz("ptz_zoom_speed", value) control the zoom speed a NDI PTZ Camera, values from -1(zoom outwards) to 1 (zoom inwards) mxw.media("USB Cam").ptz("ptz_zoom", 0.5)
mxw.media("camera_name").ptz("ptz_pan_tilt_speed", pan_speed, tilt_speed) control the pan and tilt speed a NDI PTZ Camera, values from -1 (move right/down) to 1 (move left/up) mxw.media("USB Cam").ptz("ptz_pan_tilt_speed", -0.3, 0.8)
mxw.media("camera_name").ptz("ptz_store_preset", preset_number) store current position, focus, zoom, values between 0 to 99 mxw.media("USB Cam").ptz("ptz_store_preset", 75)
mxw.media("camera_name").ptz("ptz_recall_preset",preset_number, speed) recalls a previously stored preset (values 0 to 99) and changes to it at a specific speed (values 0 to 1) mxw.media("USB Cam").ptz("ptz_recall_preset", 4, 0.5 )
mxw.media("camera_name").ptz("ptz_auto_focus") activates or deactivates the camera in auto-focus mxw.media("USB Cam").ptz("ptz.autofocus")
mxw.media("camera_name").ptz("ptz_focus", focus_value) focus to absolute value (0= focused to infinity, 1= focus the closest possible) mxw.media("USB Cam").ptz("ptz_focus", 0.5)
mxw.media("camera_name").ptz("ptz_focus_speed", speed_value) focus at a particular speed (-1= outwards, 1 = inwards) mxw.media("USB Cam").ptz("ptz_focus_speed", -0.2)
mxw.media("camera_name").ptz("ptz_white_balance_auto") put the camera in auto white-balance mode mxw.media("USB Cam").ptz("ptz_white_balance_auto")
mxw.media("camera_name").ptz("ptz_white_balance_indoor") put the camera in indoor white balance mxw.media("USB Cam").ptz("ptz_white_balance_indoor")
mxw.media("camera_name").ptz("ptz_white_balance_outdoor") put the camera in outdoor white balance mxw.media("USB Cam").ptz("ptz_white_balance_outdoor")
mxw.media("camera_name").ptz("ptz_white_balance_oneshot") use the current brightness to automatically set the current white balance mxw.media("USB_Cam").ptz("ptz_white_balance_oneshot")
mxw.media("camera_name").ptz("ptz_white_balance_manual", red value, blue value) Set the manual camera white balance using the R, B values, (0.0 = not red/not blue , 1.0 = very red/very blue) mxw.media("camera_name").ptz("ptz_white_balance_manual", 0.1, 0.7)
mxw.media("camera_name").ptz("ptz_exposure_auto") put the camera in auto-exposure mode mxw.media("USB_Cam").ptz("ptz_exposure_auto")
manually set the camera exposure iris, exposure_level
mxw.makescreenshot
mxw.makescreenshot
mxw.makescreenshot
mxw.makescreenshot
mxw.makescreenshot
mxw.makescreenshot
mxw.makescreenshot
mxw.makescreenshot
mxw.makescreenshot
mxw.makescreenshot
mxw.makescreenshot
mxw.makescreenshot
mxw.makescreenshot
mxw.makescreenshot




DOK Manually set the camera exposure iris, exposure_level = 0.0(dark) ... 1.0(light)

-> ptz_exposure_manual(const float exposure_level);

DOK Manually set the camera exposure parameters, iris = 0.0(dark) ... 1.0(light) gain = 0.0(dark) ... 1.0(light) shutter_speed = 0.0(slow) ... 1.0(fast)

-> ptz_exposure_manual_v2(const float iris, const float gain, const float shutter_speed);

DOK mxw.playlist.preload_media() <- preoad used media DOK mxw.playlist.pause() <- pause playback DOK mxw.playlist.play() <- play playback DOK mxw.playlist.go_pause( true/false ) <- toggle DOK mxw.playlist.skiptonext() DOK mxw.playlist.go_next() DOK mxw.playlist.go_prev() DOK mxw.playlist.go_first() DOK mxw.playlist.navigate_index() <- navigate to 10 DOK mxw.playlist.navigate_string() <- navigate to "10"

DOK mxw.preload(1).clear() <- clear media DOK mxw.preload(1).set_media() <- set media with filename string DOK mxw.preload(1).set_name() <- set name with string DOK mxw.preload(1).get_name() <- get name DOK mxw.preload(1).add_preload() <- add layer from this preload DOK mxw.preload(1).trigger_preload() <- trigger layer from this preload DOK mxw.preload(1).get_activated <- is open for edit? DOK mxw.preload(1).set_activated() <- bool: set open for edit DOK mxw.preload(1).get_layer_position() <- layer position DOK mxw.preload(1).get_track_position() <- track position DOK mxw.preload(1).set_layer_position() <- set layer position DOK mxw.preload(1).set_track_position() <- set track position


DOK widget.media deprecated (now mxw.media("name") ) DOK grabber.isvalid DOK animate example (with go to, random, etc) DOK iterate iobases in defined order (io_wii,io_dmx,io_mid,io_timer,io_key,io_tuio) - DOK THIS DOK js doku copied mxw.grabber(?a1?); -> illegal character DOK print_statusline() DOK mxw.makesectionscreenshot("c:/Users/MXWendler/Desktop/b.png", 0,1, 400, 200); DOK mxw.widget("/mxw/playlist/container/1/column/0/row/1").setStringValue("named by script") DOK print_console("PL Item R2C1 strval is " + mxw.widget("/mxw/playlist/container/1/column/0/row/1").getStringValue());