Samstag, 9. August 2008

Script Descriptor Files

These files describe a script. Its extension is .scs and you can write them easily by hand. Here are the possible options and their defaults:

name =
title =
description =
icon =
menu = ScripterNG
shortcut = # A valid QKeySequence as a string, see Qt4-docs
filename = # name of script file
subroutine = # additional entry point?
author =
contact =
homepage =
version =
copyright = # GPL2
scribus_version =
redraw = True
mode = interactive # allowed: batch, interactive, extension
language = python # allowed: python, qtscript
separator_before = False # in menu
separator_after = False # in menu
background_mode = False # threaded execution only for non-gui scripts

More options are already planned and will come with a later release. Feedback on needed features is always welcome.

If you put a script descriptor file inside the scripterng/autoload or ~/.scribus/scripterng/autoload folder it will be loaded at startup, added to the menu bar, etc.
Every entry you see in the ScriperNG menu is already a separate script in autoload.

You can also put the script descriptor inside a source file at the top in double comments. Python files have to be called .spy and look like this:

# -*- coding: utf-8 -*-
## name = about
## title = About ScripterNG
## shortcut = Esc,a
# ScripterNG is a builtin and does not need to be imported
ScripterNG.aboutScripterNG()


With QtScript (extension is .sqts) the same is possible:

/// name = aboutqts
/// title = About ScripterNG from QtScript
ScripterNG.aboutScripter();

Support for .zip-packaged scripts is on the TODO.

Keine Kommentare: