Messages (frame → iframe)
runcommand
Run a command in Kudo:
var message = {
messageName: "runcommand",
commandString: "_YourCommand",
resultMessage: "nameOfPostedResultMessage", //optional
messageId: "messageId" //optional
}
window.postMessage(message, '*');
You can also pass parameters to your command like this:
commandString: "_YourCommand Param1 Param2"
or
commandString: "_YourCommand\nParam1\nParam2"
resultMessage: if specified, message is posted to iframe parent when command execution is done
messageId: if specified, it is passed to resultMessage
Note: Only whitelisted commands are allowed to be run from client side by runcommand message. To whitelist a command, add it to Default Files\OEM Commands\commands.xml
<?xml version="1.0" encoding="UTF-8"?>
<commands>
<OEM name="graebert">
<command name="_XEREPLACEOPEN" />
<command name="_DOATTACHMENT"/>
<command name=" _YourCommand"/>
</OEM>
</commands>
runlisp
Execute the passed Lisp expression:
var message = {
messageName: "runlisp",
lispExpression: "lispExpression",
resultMessage: "nameOfPostedResultMessage", //optional
messageId: "messageId" //optional
}
window.postMessage(message, '*');
resultMessage: if specified, message is posted to iframe parent when lisp execution is done
messageId: if specified, it is passed to resultMessage
eventRegister
eventDeRegister
Register/Deregister for receiving different types of additional events. Available event types are:
commandEvent
lispEvent
sysVarEvent
drawingEvent
viewChangedEvent
selectionEvent
drawingModifiedEvent
See https://graebert.atlassian.net/wiki/x/QAFdRg for details about events.
Register for event:
var message = {
messageName: "eventRegister",
eventName: "commandEvent" //one of the above event types
}
window.postMessage(message, '*');
Deregister for event:
var message = {
messageName: "eventDeRegister",
eventName: "commandEvent" //one of the above event types
}
window.postMessage(message, '*');
setvariable
Change a variable value
drawingdescription
Trigger creation of drawing description