XSIApplication.CreateAddon
 
 
 

XSIApplication.CreateAddon

Description

Creates a new add-on package object to be used to package plug-ins. For example, you can package SPDL files, presets, layouts, toolbars, custom commands, devices, library files, etc.

For more information on the kinds of items that can be part of and add-on package, see siAddonItemType.

Note: In many cases it can be easier to create an add-on by calling PackageAddon.

C# Syntax

Addon XSIApplication.CreateAddon();

Scripting Syntax

oReturn = XSIApplication.CreateAddon();

Return Value

Addon

Examples

Python Example

#
# This example demonstrates how to install an add-on package.
#
import os                                                       # for directory handling
from win32com.client import constants as c
# **********************************
# This function just provide the means to remove the details of 
# creating the HTML page. 
def makeHTMLPage() :
        # Build the filename & path
        sUserPath = Application.InstallationPath( c.siUserPath )
        sHelpFileName = XSIUtils.BuildPath( sUserPath, "Data", "HelpMe.html" )
        # Create a standard hello world script file
        fHWFile = open( sHelpFileName, "w" )
        fHWFile.write( "<html>\n" )
        fHWFile.write( "<head>\n" )
        fHWFile.write( "\t<title>Help Page for Testing Add-ons</title>\n" )
        fHWFile.write( "</head>" )
        fHWFile.write( "<body>\n" )
        fHWFile.write( "\n<p>Help! I'm trapped inside this HTML code!</p>\n" )
        fHWFile.write( "</body>\n" )
        fHWFile.write( "</html>" )
        fHWFile.close()
        # Return the name of the new html page
        return sHelpFileName
# **********************************
# Get the first available workgroup as the add-on destination 
sPath = Application.InstallationPath( c.siWorkgroupPath )
if not sPath :
        # If the workgroup doesn't already exist, then add it
        tmppath = XSIUtils.BuildPath( Application.InstallationPath(c.siUserPath), "TempWorkgrp" )
        if ( not os.access(tmppath, os.F_OK) ) :
                os.mkdir( tmppath )
        Application.AddWorkgroup( tmppath )
        sPath = Application.InstallationPath( c.siWorkgroupPath )
sHTMLName = makeHTMLPage()
# Create the add-on package object
oAddOn = Application.CreateAddon()
# Add the HTML page to the add-on package
oAddOn.AddOtherItem( sHTMLName )
# Save the package in the Addons directory
sPath = XSIUtils.BuildPath( sPath, "Addons" )
XSIUtils.EnsureFolderExists( sPath )
sAddOnFileName = XSIUtils.BuildPath( sPath, "myHelpPkg.xsiaddon" )
oAddOn.Save( sAddOnFileName )
Application.LogMessage( "Created add-on file: " + sAddOnFileName )
# Install the add-on package containing the HTML page
Application.InstallAddOn( sAddOnFileName, c.siWorkgroupAddonPath )
# Comment out the following line if you want to see the add-on file 
# (you will have to uninstall the add-on manually):
Application.UnInstallAddon( sAddOnFileName )
#INFO : &lt;YourWorkgrpPath&gt;\Addons\myHelpPkg.xsiaddon