Addon.Save

Addon.Save

説明

アドオンを、.xsiaddon ファイルに保存します。

C#構文

Addon.Save( String in_bstrFilename );

スクリプト構文

Addon.Save( in_bstrFilename );

パラメータ

パラメータ タイプ 説明
in_bstrFilename String アドオンを格納する.xsiaddon アドオンファイルアドオンの保存後はすべての項目が選択解除されます。これにより、前回の選択とは無関係に次のアドオンのパッケージ化を開始できます。

VBScript の例

'

' This example shows how to create and save an add-on package.

'

sPath = Application.InstallationPath( siWorkgroupPath )

if sPath = "" then

	' If the workgroup doesn't already exist, then add it

	tmppath = XSIUtils.BuildPath( Application.InstallationPath(siUserPath), "TempWorkgrp" )

	set fso = CreateObject( "Scripting.FileSystemObject" )

	if Not fso.FolderExists(tmppath) then

		fso.CreateFolder tmppath 

	end if

	Application.AddWorkgroup tmppath 

	sPath = Application.InstallationPath( siWorkgroupPath )

end if

sHTMLName = makeHTMLPage()

' Create the add-on package object

set 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, 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 

' **********************************

' This function just provide the means to remove the details of 

' creating the HTML page. 

function makeHTMLPage()

	' Build the filename & path

	sUserPath = Application.InstallationPath( siUserPath )

	sHelpFileName = XSIUtils.BuildPath( sUserPath, "Data", "HelpMe.html" )

	' Create a standard hello world script file

	set fso = CreateObject( "Scripting.FileSystemObject" )

	set fHWFile = fso.CreateTextFile( sHelpFileName )

	fHWFile.WriteLine "<html>"

	fHWFile.WriteLine "<head>"

	fHWFile.WriteLine vbTab & "<title>Help Page for Testing Add-ons</title>"

	fHWFile.WriteLine "</head>"

	fHWFile.WriteLine "<body>"

	fHWFile.WriteLine vbTab & "<p>Help! I'm trapped inside this HTML code!</p>"

	fHWFile.WriteLine "</body>"

	fHWFile.WriteLine "</html>"

	fHWFile.Close

	' Return the name of the new html page

	makeHTMLPage = sHelpFileName

end function