Addon.Save

Description

Saves the add-on in an .xsiaddon file.

C# Syntax

Addon.Save( String in_bstrFilename );

Scripting Syntax

Addon.Save( in_bstrFilename );

Parameters

Parameter Type Description
in_bstrFilename String The .xsiaddon file that contains the add-on. After you save an add-on, all items are deselected, which means that you can start packaging another add-on without interfering with the previous selection.

Examples

VBScript Example

'
' 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