-
Notifications
You must be signed in to change notification settings - Fork 18
config.xml File Import Extension
fabian-flassig edited this page Nov 21, 2025
·
20 revisions
A Function extension supplies a button in the PYTHA user interface. The user can invoke the function by pressing that button.
Declaration of a function extension in the config.xml:
<extension type="file-import">
<entry-point>import</entry-point>
<id>extension-id</id>
<caption>Text of the Button</caption>
<file-filter>*.txt</file-filter>
<help-file>help.html</help-file>
</extension>The following information can be supplied:
-
entry-point- (Mandatory) Name of the lua function that is invoked when the user invokes the import. Note that the name can be chosen freely.import, above, is just an example. -
caption- (Mandatory) The text that is displayed in the Import menu. This text is translatable in the .xlif file. -
id- The extension ID of the import extension. -
file-filter- The file type (or file types) that the extension will handle. The extension must be written with a leading asterisk, e.g. as*.txtfor a file with the extension "txt". -
help-file- The name of a help file (should be .html or .pdf or .txt). This file is opened when the user right-clicks on the button and invokes help. This name of the file is translatable in the .xlif file if separate help files are supplied for different languages.
When the user invokes the import and has selected a file, the entry-point is invoked with the corresponding file handle as its argument
function import(file)| Parameter | Type | Description |
|---|---|---|
file |
file_handle |
Handle of the file that the user has selected for import |
See the file parsing functions, e.g. parse_csv(), parse_xml_to_tree() etc. for options how to access the file contents.
You can automatically call the import extension from the command line via /Plugin "plugin_guid/extension_id" "file_path".
Minimum PYTHA Version: V26
config.xml, Edit Extension, Attribute Extension, Anatomy of a Lua Api Plugin, Localization and Translation