From The Foundry MODO SDK wiki
Revision as of 18:27, 8 October 2014 by Conorfitz (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

modo 601 SP3 adds minimal support for AppleScript on Mac OS X. This allows modo to receive commands from AppleEvents/AppleScript. The greatest benefit is that it allows other apps to do the same using Cocoa's AppleScript bridge.

This is a minimal implementation of AppleScript, and is only able to executing commands; queries are not supported at this time. This limits its usefulness as a general scripting system per say. It is primarily intended to allow third party applications to issue basic commands to modo.

Commands are executed by issuing run command followed by the command string. Note that since the command is encased in quotes, any internal quotes must be escaped.

run command "command"

For example:

tell application "modo"
  run command "poly.setMaterial \"hello world\" {0.0 1.0 1.0} 0.8 0.2 true false"
end tell

Remember that modo only supports executing commands at this time. This makes it similar to the modo's Windows DDE implementation.

It is also possible talk to applescript from modo.

For example:

   import lx
   import subprocess
       lx.eval('dialog.setup yesNo')
       lx.eval('dialog.title [Talk to Applescript]')
       lx.eval('dialog.msg [Do you want to talk to AppleScript]')
       lx.eval('dialog.result ok')
       feedback = lx.eval('dialog.result ?')
       if feedback:
 ['osascript', '-e', 'tell application "finder" to display dialog "Modo is talking to Applescript!"'])
       lx.out("Cancelled talk to AppleScript")

More Information