AppleScript

‘’’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.

1
 run command "command"

For example:

1
2
3
 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:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
    #python
    import lx
    import subprocess
    try:
        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')
        lx.eval('dialog.open')
        feedback = lx.eval('dialog.result ?')
        if feedback:
            subprocess.call(['osascript', '-e', 'tell application "finder" to display dialog "Modo is talking to Applescript!"'])
    except:
        lx.out("Cancelled talk to AppleScript")

More Information