Previous Topic (ScriptingPostJobScripts) Up (Contents) Next Topic (None)

Plug-in Scripting


Introduction

All of Deadline's plug-ins are completely scripted, which means that it's easy to create your own plug-ins or customize the existing ones (providing you have some experience with the Python scripting language). Because Deadline uses IronPython, not only can you access all of the Python modules, you can import all of the .NET libraries as well, which means the level of customization is nearly endless.

General Plug-in Information

There are two types of plug-ins that can be created for Deadline 3.0:

  • Simple
  • Advanced

To create a new plug-in, you start by creating a folder in the Repository's plug-in folder and give it the name of your plug-in. For the sake of this document, we will call our new plug-in MyPlugin. All relative script and configuration files for this plug-in are to be placed in this plug-in's folder (some are required and some are optional).

The dlinit File - Required

The first file is MyPlugin.dlinit, which is the main configuration file for this plug-in. It is a plain text file that defines a few general key=value plug-in properties, which include:

Key Name Description
About A short description of the plug-in.
ConcurrentTasks If the plug-in supports concurrent tasks (True/False).

It can also define key=value custom settings to be used by the plug-in. A common custom setting is the executable to use to render the job. For this example, our MyPlugin.dlinit file might look like this:

About=My Example Plugin for Deadline
ConcurrentTasks=True

MyPluginRenderExecutable=c:\path\to\my\executable.exe

The py File - Required

The other required file is MyPlugin.py, which is the main plug-in script file. It defines the main DeadlinePlugin class that contains the necessary functions that Deadline uses to render a job. The template for this script file might look like this:

from Deadline.Plugins import *

######################################################################
## This is the function that Deadline calls to get an instance of the
## main DeadlinePlugin class.
######################################################################
def GetDeadlinePlugin():
    return MyPlugin()

######################################################################
## This is the main DeadlinePlugin class for MyPlugin.
######################################################################
class MyPlugin (DeadlinePlugin):

    # TODO: Place code here

The GetDeadlinePlugin() function is important, as it allows Deadline to get an instance of our MyPlugin class (which is extending the abstract DeadlinePlugin class). If this function isn't defined, Deadline will report an error when it tries to render the job. Notice that we're importing the Deadline.Plugins namespace so that we can access the DeadlinePlugin class. In fact, because we're using IronPython, you can import any .NET namespace, like System, System.IO, etc:

from System import *
from System.Diagnostics import *
from System.IO import *

The MyPlugin class will need to override certain functions based on the type of plug-in it is (simple or advanced). One function that all plug-ins should override is the InitializeProcess function. This function defines some general plug-in settings:

    ## Called by Deadline to initialize the process.
    def InitializeProcess( self ):
        # Set the plugin specific settings.
        self.SingleFramesOnly = False
        self.PluginType = PluginType.Simple

The general plug-in properties that can be defined are:

Property Description
SingleFramesOnly If this plug-in can only render one frame at a time (True/False).
PluginType The type of plug-in this is (PluginType.Simple/PluginType.Advanced).

There are many other functions that can be overridden, but most of these are dependent on the type of plug-in we're creating, and will be covered in their respective sections below. Here is the list of functions you can override for both types of plug-in:

Function Description
void InitializeProcess() Required - Defines some plug-in settings and any popup or stdout handlers that we need.
bool IsSingleFramesOnly() Optional - Allows you to override SingleFramesOnly setting in the InitializeProcess() function, using code to determine if the setting should be True or False. If not overridden, the SingleFramesOnly setting is used.
void MonitoredProgramExit( string name ) Optional - Allows you to handle the situation where a Monitored Program exits unexpectedly. If not overridden, the job will simply fail when this happens.
void MonitoredManagedProcessExit( string name ) Optional - Allows you to handle the situation where a Monitored Managed Process exits unexpectedly. If not overridden, the job will simply fail when this happens.

The param File - Optional

The MyPlugin.param is used to declare properties which are used by the Plugin Configuration dialog in the Monitor to dynamically generate a UI for modifying custom settings as they appear in the MyPlugin.dlinit file. After you've created this file, open the Monitor and enter Super User mode. Then select Tools -> Configure Plugins and look for your plug-in in the list on the left.

The file might look something like:

[MyPluginRenderExecutable]
Type=filename
Label=My Plugin Render Executable
Default=c:\path\to\my\executable.exe
Description=The path to the executable file used for rendering.

You'll notice that the property name between the square brackets matches the MyPluginRenderExecutable custom setting we defined in our MyPlugin.dlinit file. This means that this control will change the MyPluginRenderExecutable setting. The available key=value pairs for the properties defined here are:

Key Name Description
Type The type of control (Boolean/Enum/Filename/FilenameSave/Float/Folder/Integer/Label/MultiFilename/String).
Label The control label.
Category The category the control should go under.
Index/CategoryIndex This determines the control's order under its category.
Description A short description of the property the control is for (displayed as a tooltip in the UI).
Required If True, a control will be shown for this property even if it's not defined in the dlinit file (True/False).
IgnoreIfBlank/DisableIfBlank If True, a control will not be shown if this property is not defined in the dinit file (True/False).
Default/DefaultValue The default value to be used if this property is not defined in the dlinit file.

There are also key/value pairs for specific controls:

Key Name Description
Minimum The minimum value for the Integer or Float controls.
Maximum The maximum value for the Integer or Float controls.
Increment The value to increment the Integer or Float controls by.
DecimalPlaces The number of decimal places for the Float controls.
Items/Values The semicolon separated list of items for the Enum control.
Filter The filter string for the Filename, FilenameSave, or MultiFilename controls.

The options File - Optional

The MyPlugin.options file declares properties which are used by the Job Properties dialog in the Monitor to dynamically generate a UI for modifying plug-in specific options as they appear in the plug-in info file that is submitted with the job. After you've created this file, you can right-click on a job in the Monitor that uses this plug-in and select Modify Properties. You should then see a MyPlugin tab page which you can select to view these properties.

Often, these plug-in specific options are used to build up the arguments to be passed to the rendering application. Let's assume that our render executable takes a "-verbose" argument that accepts a boolean parameter, and that the plug in info file submitted with the job contains the following:

Verbose=True

Now we would like to be able to change this value from the Job Properties dialog in the Monitor, so our MyPlugin.options file might look like this:

[Verbose]
Type=boolean
Label=Verbose Logging
Description=If verbose logging is enabled.
Required=true
DisableIfBlank=false
DefaultValue=True

You'll notice that the property name between the square brackets matches the Verbose setting in our plug-in info file. This means that this control will change the Verbose setting. The available key=value pairs for the properties defined here are the same as those defined for the param file above.

The ico File - Optional

Finally, you can add a MyPlugin.ico file, which is an 16x16 icon file for identifying the plug-in. In most cases, this should be the plug-in application's logo. This icon will appear next to the job in the Monitor, and will also identify the plug-in in the Plugin Configuration dialog. After all of your files have been created, your plug-in folder should look something like this:

Simple Plug-ins

A Deadline job goes through three stages:

  • StartJob: A job enters this stage when it is first picked up by a slave.
  • RenderTasks: A job can enter this stage many times (once for each task a slave dequeues while it has the current job loaded).
  • EndJob: A job enters this stage when a slave is unloading the job.

Simple plug-ins only covers the RenderTasks stage, and are pretty straight forward. They are commonly used to render with applications that support simple command line rendering (running a command line executable and waiting for it to complete). For example, After Effects has a command line renderer called aerender.exe, which can be executed by Deadline to render specific frames of an After Effects project file. By default, Deadline always assumes you are creating a simple plug-in, but you can explicitly tell Deadline this by overriding the InitializeProcess() function (as explained above) and adding this line:

self.PluginType = PluginType.Simple

Within the InitializeProcess() function, you can also define settings specific to the simple plug-in, as well as any popup or stdout handlers that we need.

    ## Called by Deadline to initialize the process.
    def InitializeProcess( self ):
        # Set the plugin specific settings.
        self.SingleFramesOnly = False
        self.PluginType = PluginType.Simple
	 
        # Set the process specific settings.
        self.ProcessPriority = ProcessPriorityClass.BelowNormal
        self.UseProcessTree = True
        self.StdoutHandling = True
        self.PopupHandling = True
        
        # Set the stdout handlers.
        self.AddStdoutHandler( "WARNING:.*", self.HandleStdoutWarning ) 
        self.AddStdoutHandler( "ERROR:(.*)", self.HandleStdoutError ) 
	 
        # Set the popup ignorers.
        self.AddPopupIgnorer( "Popup 1" )
        self.AddPopupIgnorer( "Popup 2" )
	 
        # Set the popup handlers.
        self.AddPopupHandler( "Popup 3", "OK" )
        self.AddPopupHandler( "Popup 4", "Do not ask me this again;Continue" )

The plugin properties that can be defined are:

Property Description
ProcessPriority The process priority of the executable that is launched.
UseProcessTree This should almost always be True. If Enabled, Deadline will control any child processes launched by the main executable.
StdoutHandling Needs to be True if using Stdout handlers.
PopupHandling Needs to be True if using Popup handlers.

The AddStdoutHandler() function takes two arguments: a regular expression string, and a pointer to a handler function that is defined in the plug-in class. This handler function will be called when the regular expression string matches a line of stdout from the rendering application. Within these handler functions, the GetRegexMatch() function can be used to get a specific match from the regular expression. You can also use the SuppressThisLine() function to suppress the current line of stdout, or you can use the GetPreviousStdoutLine() function to get the previous line of stdout (if there is any). For the example above, the following functions would have to be defined:

    def HandleStdoutWarning( self ):
        LogWarning( self.GetRegexMatch(0) )
    
    def HandleStdoutError( self ):
        FailRender( "Detected an error: " + self.GetRegexMatch(1) )

The AddPopupIgnorer() function takes one argument: a regular expression string. If a popup is displayed with a title that matches the given regular expression, the popup is simply ignored. Popup ignorers should only be used if the popup doesn't halt the rendering because it is waiting for a button to be pressed. In the case where a button needs to be pressed to continue, popup handlers should be used instead. The AddPopupHandler() function takes two arguments, a regular expression string, and the button(s) to press (multiple buttons can be separated with semicolons).

There are many other functions you can override, but the only required one is RenderExecutable(). As the name indicates, this function should return the full path to the executable to be used for rendering. Continuing our example, this path is specified in the MyPlugin.dlinit file, and we can access it using the global GetConfigEntry() function (all global functions are covered below in the plug-in script function reference):

def RenderExecutable( self ):
    return GetConfigEntry( "MyPluginRenderExecutable" )

Another important (but optional) function to override is the RenderArgument() function. This function should return the arguments you want to pass to the render executable. If this function is not overridden, then no arguments will be passed to the executable. Some of these arguments may be hardcoded, some may be pulled from the job properties (like the data/scene file name, start and end frame), and others may be pulled from the plug-in info file that was submitted with the job using the global GetPluginInfoEntry() function:

def RenderArgument( self ):
    arguments = " -continueOnError -verbose " + GetPluginInfoEntry( "Verbose" )
    arguments += " -start " + str(GetStartFrame()) + " -end " + str(GetEndFrame())
    arguments += " -scene \"" + GetDataFilename() + "\""
    return arguments

The full list of simple plug-in functions you can override is as follows:

Function Description
string RenderExecutable() Required - Returns the full path to the executable to be used for rendering.
string RenderArgument() Optional - Returns the arguments you want to pass to the render executable. If not overridden, then no arguments are passed to the render executable.
string StartupDirectory() Optional - Returns the working folder that the render executable should launch in. If not overridden, then the folder that the executable resides in will be used.
void PreRenderTasks() Optional - Allows you to perform some tasks before the render executable is launched. This can be used to set environment variables, copy over some dependencies, etc. Within this function, you can use the SetUpdateTimeout( int seconds ) function to set a timeout. If no stdout is received from the application within this amount of time, the TimeoutTasks() function is called (see below).
void PostRenderTasks() Optional - Allows you to perform some tasks after the render executable has exited. This can be used to clean up temporary files, perform operations on the rendered output, etc.
void TimeoutTasks() Optional - Allows you to perform some action when an update timeout occurs. This task timeout is set up using the global SetUpdateTimeout() function. If not overridden, the job will simply fail if an update timeout occurs.
void CheckExitCode( int exitCode ) Optional - Allows you to explicitly check the return code of the executable and handle it as necessary. If not overridden, the job will succeed on a return code of 0, and fail on any other return code.

The best place to find examples of simple plug-ins is to look at some of the plug-ins that are shipped with Deadline. These range from the very basic (Blender), to the more complex (MayaCmd).

Advanced Plugins

Advanced plug-ins are a little more complicated, as they control all three job stage mentioned above. They are commonly used to render with applications that support some sort of slave/server mode that Deadline can interact with. Usually, this requires the application to be started during the StartJob phase, fed commands during the RenderTasks stage(s), and finally shut down during the EndJob stage. For example, the 3ds Max plug-in starts up 3dsmax in slave mode and forces it to load our Lightning plug-in. The Lightning plug-in listens for commands from Deadline and executes them as necessary. After rendering is complete, 3ds Max is shut down.

To tell Deadline that you're creating an advanced plug-in, add the following line to the InitializeProcess() function:

self.PluginType = PluginType.Advanced

There are a few other functions you can override, but the only required one is RenderTasks(). This contains the code to be executed for each task that a slave dequeues. This could involve launching applications, communicating with already running applications, or simply running a script to automate a particular task (like backup a group of files).

def RenderTasks( self ):
    
    # Do stuff...

The full list of advanced plug-in functions you can override is as follows:

Function Description
void RenderTasks() Required - Contains the code to be executed for each task that a slave dequeues.
void StartJob() Optional - Contains the code to be executed when a slave first picks up a job for rendering. This can include starting up the application or setting up the environment for rendering. If not overridden, than nothing is done during the StartJob phase.
void EndJob() Optional - Contains the code to be executed when a slave finishes with a job. This can include shutting down the application or cleaning up some temporary files. If not overridden, than nothing is done during the EndJob phase.

As mentioned above, a common use for advanced plug-ins is to start up some sort of server application during the StartJob stage and feed it render commands during the RenderTasks stage(s). The benefit to this is that you only have to deal with the overhead of loading the application for the first task the slave dequeues for the job. This is a big deal if the scene file you're rendering is large, and needs to load a lot of plug-ins and external references. More often than not, this involves launching and monitoring a Managed Process. In your python file, you can create another class that extends the abstract ManagedProcess class. To continue our example, we'll call this class MyPluginProcess:

class MyPluginProcess (ManagedProcess):
    
    # TODO: Place code here

This managed process class will define the render executable, command line arguments, etc for the process we will be monitoring. If this sounds familiar, that's because we do the same thing for a simple plug-in. In fact, the abstract DeadlinePlugin class we talked about near the beginning is just a specialized ManagedProcess class. So you would define your RenderExecutable(), RenderArgument(), etc, functions here like you would for a simple plug-in. After you've created your managed process class, you can create an instance of it in the StartJob() function and use the global StartMonitoredManagedProcess() function to launch the process.

def StartJob( self ):
    # Do some initialization...
    
    myProcess = MyPluginProcess()
    StartMonitoredManagedProcess( "My Process", myProcess )

Then in the EndJob() function, you can use the global ShutdownMonitoredManagedProcess() function to shut down the process:

def EndJob( self ):
    # Do some cleanup...
    
    ShutdownMonitoredManagedProcess( "My Process" )

There are other global managed process functions you can use to control and monitor the process, which are explained in the scripting reference below. Because the advanced plug-ins are much more involved than the simple plug-ins, we suggest you take a look at the following plug-ins that are shipped with Deadline for examples: 3dsmax, Combustion, Fusion, Lightwave, MayaBatch, Modo, Rhino, VNS, and XSIBatch.

Global Function Reference

All these functions can be called from your plug-in python script file.

Job Functions

Function Description
Job GetJob() Returns the current job object.
string GetJobInfoEntry( string Key ) Returns the value for the given Key from the job's plugin info file. Throws an error if the Key does not exist.
int GetSubmitInfoEntryElementCount( string Key ) Returns the number of values in the job's submission info file for the specified Key. This is only valid if the Key stores its values as an array.
string GetSubmitInfoEntryElement( int Index, string Key ) Returns the value from job's submission info file for the specified Key at the specified Index. Causes an error if the Index is out of range, or the Key does not exist. This is only valid if the Key stores its values as an array.

Plugin Configuration Functions

Function Description
string GetPluginInfoEntry( string Key ) Returns the value for the given Key from the plug-in dlinit file. Throws an error if the Key does not exist.
string GetPluginInfoEntryWithDefault( string Key, string Default ) Same as above but with a Default value to be returned if the Key does not exist. Useful for backwards-compatibility, because it will not throw an error if the Key does not exist.
int GetIntegerPluginInfoEntry( string Key ) Returns the value for the given Key from the plug-in dlinit file. Throws an error if the Key does not exist.
int GetIntegerPluginInfoEntryWithDefault( string Key, int Default ) Same as above but with a Default value to be returned if the Key does not exist. Useful for backwards-compatibility, because it will not throw an error if the Key does not exist.
float GetFloatPluginInfoEntry( string Key ) Returns the value for the given Key from the plug-in dlinit file. Throws an error if the Key does not exist.
float GetFloatPluginInfoEntryWithDefault( string Key, float Default ) Same as above but with a Default value to be returned if the Key does not exist. Useful for backwards-compatibility, because it will not throw an error if the Key does not exist.
bool GetBooleanPluginInfoEntry( string Key ) Returns the value for the given Key from the plug-in dlinit file. Throws an error if the Key does not exist.
bool GetBooleanPluginInfoEntryWithDefault( string Key, bool Default ) Same as above but with a Default value to be returned if the Key does not exist. Useful for backwards-compatibility, because it will not throw an error if the Key does not exist.

Plugin Info File Functions

Function Description
string GetConfigEntry( string Key ) Returns the value for the given Key from the job's plug-in info file. Throws an error if the Key does not exist.
string GetConfigEntryWithDefault( string Key, string Default ) Same as above but with a Default value to be returned if the Key does not exist. Useful for backwards-compatibility, because it will not throw an error if the Key does not exist.
int GetIntegerConfigEntry( string Key ) Returns the value for the given Key from the job's plug-in info file. Throws an error if the Key does not exist.
int GetIntegerConfigEntryWithDefault( string Key, int Default ) Same as above but with a Default value to be returned if the Key does not exist. Useful for backwards-compatibility, because it will not throw an error if the Key does not exist.
float GetFloatConfigEntry( string Key ) Returns the value for the given Key from the job's plug-in info file. Throws an error if the Key does not exist.
float GetFloatConfigEntryWithDefault( string Key, float Default ) Same as above but with a Default value to be returned if the Key does not exist. Useful for backwards-compatibility, because it will not throw an error if the Key does not exist.
bool GetBooleanConfigEntry( string Key ) Returns the value for the given Key from the job's plug-in info file. Throws an error if the Key does not exist.
bool GetBooleanConfigEntryWithDefault( string Key, bool Default ) Same as above but with a Default value to be returned if the Key does not exist. Useful for backwards-compatibility, because it will not throw an error if the Key does not exist.

Rendering Information Functions

Function Description
string GetDataFilename() Returns the path of the scene file that was submitted with the job.
string GetPluginInfoFilename() Returns the path of the plugin-info file that was submitted with the job.
string[] GetAuxiliaryFilenames() Returns the list of files that were submitted with the job.
string[] GetPluginDirectory() Returns the local plug-in directory path of the current slave.
string[] GetJobsDataDirectory() Returns the local jobs data directory path of the current slave.
int GetStartFrame() Returns the first frame of the task currently being rendered.
int GetEndFrame() Returns the last frame of the task currently being rendered.
int GetThreadNumber() Returns the number of the thread currently rendering this task.

Logging and Control Funtions

Function Description
void LogInfo( string Message ) Prints an info message to the log.
void LogWarning( string Message ) Prints a warning message to the log.
void SetProgress( float Percentage ) Sets the progress of the render.
void SetStatusMessage( string Message ) Sets the render status message.
void ExitWithSuccess() Exits the render immediately, reporting success.
void FailRender( string Message ) Fails the render, returning the given message as the error.
bool IsCanceled() Returns true if the current render has been canceled.

Managed Process Functions

Function Description
void RunManagedProcess( ManagedProcess process ) Runs a managed process, and returns when the process has exited.
void StartMonitoredManagedProcess( string Name, ManagedProcess process ) Starts a managed process, and tracks it with the given Name as its id. Use FlushMonitoredManagedProcessStdout() to redirect the program's stdout to the slave.
void ShutdownMonitoredManagedProcess( string Name ) Stops the managed process by sending a close message. If that fails, the process is terminated.
void DetachMonitoredManagedProcess( string Name ) This allows the managed process to continue running after the slave has finished the current job.
bool MonitoredManagedProcessIsRunning( string Name ) Returns True if the managed process is still running.
int[] GetMonitoredManagedProcessIDs( string Name ) Gets the list of the parent process and any child process PIDs for the managed process.
void SetMonitoredManagedProcessExitCheckingFlag( string Name, bool Value ) Sets the managed process's exit checking flag to the given Value.
void VerifyMonitoredManagedProcess( string Name ) Throws an error if the given managed process is no longer running.
bool WaitForMonitoredManagedProcessToExit( string Name, int timeoutMilliseconds ) Waits for the managed process to exit, and returns True if it does so in the given amount of time. Specify -1 for no timeout.
void FlushMonitoredManagedProcessStdout( string Name ) Flushes the managed process's stdout buffer to the slave.
string CheckForMonitoredManagedProcessPopups( string Name ) Checks for any popups shown by the managed process. If a popup is found, the dump of the popup is returned, otherwise an empty string is returned.
void WriteStdinToMonitoredManagedProcess( string Name, string Stdin ) Writes the given Stdin string to the given managed process's stdin.
void RedirectStdOutToFileForMonitoredManagedProcess( string Name, string Filename ) Writes the contents of the given Filename to the given managed process's stdin.

Monitored Program Functions

Function Description
void StartMonitoredProgram( string Name, string Executable, string Arguments, string StartupDir ) Starts a program, and tracks it with the given Name as its id. The program's stdout is not redirected to the slave.
void ShutdownMonitoredProgram( string Name ) Stops the program by sending a windows close message. If that fails, the process is terminated.
void DetachMonitoredProgram( string Name ) This allows the program to continue running after the slave has finished the current job.
void SetMonitoredProgramExitCheckingFlag( string Name, bool Value ) Sets the program's exit checking flag to the given Value.
bool MonitoredProgramIsRunning( string Name ) Returns True if the specified managed program is running, False otherwise.
bool WaitForMonitoredProgramToExit( string Name, int TimeoutSeconds ) Waits for the specified managed program to exit. Returns True if the program exited before the specified TimeoutSeconds,, False otherwise.
void VerifyMonitoredProgram() Throws an error if the managed program is no longer running.

General Process Functions

Function Description
bool WaitForProcessToStart( string processName, float TimeoutSeconds ) Returns true if the given process has started before the timeout. Returns false otherwise.
bool KillAllProcesses( string processName ) Kills all processes with the given name. Returns true if successful.
bool KillParentAndChildProcesses( string processName ) Kills all processes with the given name and their child processes. Returns true if successful.
bool IsProcessRunning( string processName ) Returns true if the given executable name is currently running.
int RunProcess( string Executable, string Arguments, string StartupDir, int TimeoutMilliseconds ) Launches a program and waits for the specified TimeoutMilliseconds for it to complete (specify -1 for no timeout). The program's stdout is redirected to the slave. Returns the process' return code (1 is returned for a timeout).

File/Path/Directory Functions

Function Description
string SearchFileList( string SemicolonseparatedList ) Searches through the semicolon-separated list of files, returning the first file which exists, or an empty string otherwise.

An example list could be "c:/file1.exe;c:/file2.exe".
string SearchFileListFor32Bit( string SemicolonseparatedList ) Searches through the semicolon-separated of files, returning the first 32bit file which exists, or an empty string otherwise.

An example list could be "c:/file1.exe;c:/file2.exe".
string SearchFileListFor64Bit( string SemicolonseparatedList ) Searches through the semicolon-separated of files, returning the first 64bit file which exists, or an empty string otherwise.

An example list could be "c:/file1.exe;c:/file2.exe".
string SearchDirectoryList( string SemicolonseparatedList ) Searches through the semicolon-separated of directories, returning the first directory which exists, or an empty string otherwise.

An example list could be "c:/directory1;c:/directory2".
string SearchPath( string filename ) Searches the PATH environment variable to see if the specified filename exists in any of the paths.
void AddToPath( string SemicolonseparatedList ) Adds the specified directory to the PATH environment variable for this session.
bool Is64BitDllOrExe( string filename ) Checks if the given file is a 64 bit executable or library.
string GetExecutableVersion( string filename ) Returns the version of the given executable file.
long GetFileSize( string filename ) Returns the file size of the given file in bytes.
bool FileExists( string filename ) Returns True if the given file exists.
string ToShortPathName( string filename ) Retrieves the short path form of a specified long input path.
string ChangeFilename( string path, string filename ) Changes the filename in the path.
void CreateCommandFile( string FilePath, string Command ) Writes the Command to the given file.
string WaitForCommandFile( string FilePath, int DeleteFile, int TimeoutMilliseconds ) Waits for the specified file to appear, and returns the command that was written to that file. Specify 1 for DeleteFile to delete the command file afterwards. Returns "" if a timeout occurs (specify -1 as the timeout to disable it).
string GetIniFileSetting( string Section, string Key, string DefaultValue, string IniFilename ) Returns the value for the given Key, which is in the given Section of the given IniFilename. If the Key does not exist, the given DefaultValue is returned.
void SetIniFileSetting( string Section, string Key, string Value, string IniFilename ) Sets the Value for the given Key, which is in the given Section of the given IniFilename.
void VerifyFile( string FilePath, int fileSize ) Verifies that a given file exists and has size greater than the given file size. Throws an error otherwise.
void VerifyAndMoveFile( string SrcFilePath, string DestFilePath, int fileSize ) Same as above, but it moves the frame to DestFilePath after it has verified the file.
void VerifyAndMoveDirectory( string SrcFolderPath, string DestFolderPath, bool failIfEmpty, int fileSize ) Same as above, but it moves an entire folder and its contents to DestFolderPath after it has verified the file(s) within the folder.
string CreateTempDirectory( string Tag ) Uses the Tag specified to create a unique output directory in local jobs data folder and returns the path.
void SynchronizeDirectories( string SrcDirPath, string DestDirPath, bool deepCopy ) Ensures that the contents of the DestDirPath directory are the same as the SrcDirPath directory. If deepCopy is True, then all subfolders are synchronized as well.

Miscellaneous Functions

Function Description
void Sleep( int milliseconds ) Sleeps for the given amount of time.
string BlankIfEitherIsBlank( string Str1, string Str2 ) Returns an empty string if either Str1 or Str2 is empty. Otherwise, concatenates them.

OS Functions

Function Description
bool Is64Bit() Returns True if the current application is 64 bit.
bool IsRunningOnWindows() Returns True if the current machine is a Windows machine.
bool IsRunningOnLinux() Returns True if the current machine is a Linux machine.
bool IsRunningOnMac() Returns True if the current machine is a Mac machine.
string GetRegistryKeyValue( string keyName, string valueName, string defaultValue ) Windows Only - Returns the value for the specified registry key. If the key is not found, the default value is returned.
string GetApplicationPath( string filename ) Linux Only - Uses the 'which' applicaton to get the full path to the application file specified.