Difference between revisions of "Startup Commands"

From The Foundry MODO SDK wiki
Jump to: navigation, search
(Config File Format)
(Config File Format)
Line 5: Line 5:
 
To add startup commands, you first add a root-level '''<StartupCommands>''' atom tag to your config.  This contains any number of '''<Command>''' list tags, which in turn represent the individual commands themselves. These commands will be executed in the order they are listed. Startup commands are executed at the very end of the startup process, just before the input loop starts.
 
To add startup commands, you first add a root-level '''<StartupCommands>''' atom tag to your config.  This contains any number of '''<Command>''' list tags, which in turn represent the individual commands themselves. These commands will be executed in the order they are listed. Startup commands are executed at the very end of the startup process, just before the input loop starts.
 
This example creates a simple hello on startup through the [[Dialog Commands|dialog.???]] series of commands.
 
This example creates a simple hello on startup through the [[Dialog Commands|dialog.???]] series of commands.
<syntaxhighlight lang="xml">
+
 
 
  <nowiki><atom type="StartupCommands">
 
  <nowiki><atom type="StartupCommands">
 
     <list type="Command">dialog.setup info</list>
 
     <list type="Command">dialog.setup info</list>
Line 11: Line 11:
 
     <list type="Command">dialog.open</list>
 
     <list type="Command">dialog.open</list>
 
  </atom></nowiki>
 
  </atom></nowiki>
</syntaxhighlight lang="xml">
+
 
  
 
== Scripts as Startup Commands ==
 
== Scripts as Startup Commands ==

Revision as of 02:43, 29 February 2012

On startup, modo can run any commands you like, including scripts, which can perform any operation you like. The list of startup commands is stored in the config, although none are defined by default.

Config File Format

To add startup commands, you first add a root-level <StartupCommands> atom tag to your config. This contains any number of <Command> list tags, which in turn represent the individual commands themselves. These commands will be executed in the order they are listed. Startup commands are executed at the very end of the startup process, just before the input loop starts. This example creates a simple hello on startup through the dialog.??? series of commands.

<atom type="StartupCommands">
     <list type="Command">dialog.setup info</list>
     <list type="Command">dialog.msg "Hello!"</list>
     <list type="Command">dialog.open</list>
 </atom>


Scripts as Startup Commands

Any command can be executed as a startup command, including scripts. Startup commands are intentionally executed before license checking occurs. This allows you to perform stand-alone operations before the user gets control. If you want your script to run without user interaction, you'll want to be sure to prefix commands with one or two exclamation point to suppress any dialogs they might open.

The following execute the Perl script MyScript.pl.

<atom type="StartupCommands">
    <list type="Command">@MyScript.pl</list>
</atom>

If run without a license, modo will open the license dialog will open after the startup commands finish executing. You can issue app.quit as a startup command to quit before the license dialog appears.

<atom type="StartupCommands">
    <list type="Command">@MyScript.pl</list>
    <list type="Command">app.quit</list>
</atom>

Rendering with Startup Commands

See the Network Rendering article for information about using startup commands for fire-and-forget rendering.

See Also