XSIApplication.CreateAddon

説明

プラグインのパッケージ化に使用する、新しいアドオンパッケージオブジェクトを作成します。たとえば、SPDL ファイル、プリセット、レイアウト、ツールバー、カスタムコマンド、デバイス、ライブラリファイルなどをパッケージ化することができます。

アドオンパッケージに含めることのできる項目の種類については、「siAddonItemType」を参照してください。

注:多くの場合は PackageAddon を呼び出してアドオンを作成するほうが簡単です。

C#構文

Addon XSIApplication.CreateAddon();

スクリプト構文

oReturn = XSIApplication.CreateAddon();

戻り値

Addon

Python の例

#

# 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