Javascript in Max 03 - the Max Object
The Max object can be accessed as a property of a jsthis object (for more on jsthis properties, click here ). It is intended to provide control over the application environment.
Contents
- 1 Max Properties
- 1.1 apppath (String, get)
- 1.2 frontpatcher (Patcher, get)
- 1.3 isplugin (Number, get)
- 1.4 isruntime (Number, get)
- 1.5 loadbangdisabled (Number, get)
- 1.6 os (String, get)
- 1.7 osversion (String, get)
- 1.8 time (Number, get)
- 1.9 version (String, get)
- 1.10 cmdkeydown (Number, get)
- 1.11 ctrlkeydown (Number, get)
- 1.12 optionkeydown (Number, get)
- 1.13 shiftkeydown (Number, get)
- 2 Max Methods
Max Properties[edit]
apppath (String, get)[edit]
The pathname of the Max application
frontpatcher (Patcher, get)[edit]
The Patcher object of the frontmost patcher window, or a nil value if no patcher window is visible. You can traverse the list of open patcher windows with the next property of a Wind object.
isplugin (Number, get)[edit]
1 if the js object is within a plug-in; note that this would be 1 if the js object was within a plug-in loaded into the vst~ object in Max.
isruntime (Number, get)[edit]
1 if the currently executing Max application environment does not allow editing, 0 if it does.
loadbangdisabled (Number, get)[edit]
1 if the user has disabled loadbang for the currently loading patch. If your object implements a loadbang method, it can test this property and choose to do nothing if it is true.
os (String, get)[edit]
The name of the platform (e.g., “windows” or “macintosh”)
osversion (String, get)[edit]
The current OS version number.
time (Number, get)[edit]
The current scheduler time in milliseconds - will be a floating-point value.
version (String, get)[edit]
The version of the Max application, in the following form: "451"
Max Modifier Key Properties
cmdkeydown (Number, get)[edit]
1 if the command (Macintosh) or control (Windows) key is currently held down
ctrlkeydown (Number, get)[edit]
1 if the control key is currently held down
optionkeydown (Number, get)[edit]
1 if the option (Macintosh) or alt (Windows) key is currently held down
shiftkeydown (Number, get)[edit]
1 if the shift key is currently held down
Max Methods[edit]
The Max object can be accessed as a property of a jsthis object (see jsthis Properties above). Any message you can send to the max object using the semicolon notation in a message box can be invoked within Javascript using Javascript syntax. For example, the following in a message box:
- max preempt 1
This can be expressed in Javascript as:
max.preempt(1);
For a list of current messages that can be sent to the Max object, refer to the Messages to Max topic.