File Preparation
When developing a script-based extension, create a development folder in any location and prepare the following files:
- Required Files
- Manifest file (manifest.json) ... Extension definition
- Script file ... Entry point C# script file or Python script file
- Locale file (locale.{lang}.json) ... Definition for each localization language (only required for multilingual support)
For example, when developing a script-based extension named helloworld, the basic file structure would be as follows:
- C#
- Python
helloworld/
manifest.json
main.cs
locale.en.json (for multilingual support)
locale.ja.json (for multilingual support)
resources/
button.png
helloworld/
manifest.json
main.py
locale.en.json (for multilingual support)
locale.ja.json (for multilingual support)
resources/
button.png
Manifest File
-
Every Next Design extension requires one file named
manifest.json. This is called the manifest. -
This manifest contains the following definitions:
-
Extension Overview
-
Entry Point File Name
-
Lifecycle
-
Extension Points for UI, Events, and Commands
-
Use UTF-8 character encoding for the manifest.
-
The ribbon icon image specified in the manifest should be provided as a PNG file.
- C#
- Python
{
"name": "HelloWorld",
"main": "main.cs",
"lifecycle": "application",
"extensionPoints": {
...
}
}
{
"name": "HelloWorld",
"main": "main.py",
"lifecycle": "application",
"extensionPoints": {
...
}
}
For more information on manifests, see the Manifest Reference.
Script File
-
Implement the handlers called from the extension points defined in the manifest in the script file.
-
The file containing the handlers called from the extension points is called the Entry Point.
-
Only one entry point can be specified in the manifest. All handlers must be implemented in that single entry point.
- C#
- Python
//Public function for command handler
public void SayHello(ICommandContext context, ICommandParams parameters)
{
App.Window.UI.ShowInformationDialog("Hello !", "Hello World");
}
def say_hello(context, commandParams):
context.App.Window.UI.ShowInformationDialog("Hello !", "Hello World")
For details on handlers, see Implementing Handlers with Scripts below.
Preparing Locale Files (Optional)
-
If you want to make the extension multilingual, define a locale file named
locale.{lang}.jsonfor each localization language. -
For more information on multilingual support, see Multilingual Support.