## ScripterNG API Reference

ScripterNG.aboutScripterNG() | PROCEDURE

Like qApp.aboutQt() The quickest way to see if calling ScripterNG works.

ScripterNG.activeDocument.activeItem | PROPERTY

- Currently active page item

ScripterNG.activeDocument.activePage.items | PROPERTY

- List of Item objects of active page

ScripterNG.activeDocument.activePage.newEllipse(x, y, width, height) | FUNCTION
returns Item object

- x is a double
- y is a double
- width is a double
- height is a double

ScripterNG.activeDocument.activePage.newImage(x, y, width, height) | FUNCTION
returns Item object

- x is a double
- y is a double
- width is a double
- height is a double

ScripterNG.activeDocument.activePage.newLine(x, y, width, height) | FUNCTION
returns Item object

- x is a double
- y is a double
- width is a double
- height is a double

ScripterNG.activeDocument.activePage.newRectangle(x, y, width, height) | FUNCTION
returns Item object

- x is a double
- y is a double
- width is a double
- height is a double

ScripterNG.activeDocument.activePage.newText(x, y, width, height) | FUNCTION
returns Item object

- x is a double
- y is a double
- width is a double
- height is a double

ScripterNG.activeDocument.activePage.placeEPS(filename x, y) | PROCEDURE

- filename is string
- x is double
- y is double
- import vector graphics at given position on active page

ScripterNG.activeDocument.activePage.placeODG(filename x, y) | PROCEDURE

- filename is string
- x is double
- y is double
- import vector graphics at given position on active page

ScripterNG.activeDocument.activePage.placeSVG(filename x, y) | PROCEDURE

- filename is string
- x is double
- y is double
- import vector graphics at given position on active page

ScripterNG.activeDocument.activePage.placeSXD(filename x, y) | PROCEDURE

- filename is string
- x is double
- y is double
- import vector graphics at given position on active page

ScripterNG.activeDocument.activePage.position | PROPERTY

- location of active page as int value (read-only)

ScripterNG.activeDocument.activePage.position | PROPERTY

- int value of active page number >= 1

ScripterNG.activeDocument.activePage.remove() | PROCEDURE

Removes the active page from the active document.

ScripterNG.activeDocument.activePage.selection | PROPERTY

- List of selected Item objects on active page of active document

ScripterNG.activeDocument.available | PROPERTY

- bool value if a document is active

ScripterNG.activeDocument.check | FUNCTION
returns True if found else False and raises error

ScripterNG.activeDocument.close() | PROCEDURE

closes the active document without asking save

ScripterNG.activeDocument.dimensions | PROPERTY

- Dimensions object of active page

ScripterNG.activeDocument.dimensions.height | PROPERTY

- height of active document in points as double (read-only, for now)

ScripterNG.activeDocument.dimensions.width | PROPERTY

- width of active document in points as double (read-only, for now)

ScripterNG.activeDocument.items | PROPERTY

- List of all Item objects of active document

ScripterNG.activeDocument.margins | PROPERTY

- Margins object of active document

ScripterNG.activeDocument.margins.set(lr, tpr, btr, rr) | PROCEDURE

- args are double

Use this method if you want to change more than one margin at a time

ScripterNG.activeDocument.margins.top | PROPERTY

- top-margin of active document as double

ScripterNG.activeDocument.margins.top | PROPERTY

- left-margin of active document as double

ScripterNG.activeDocument.margins.top | PROPERTY

- right-margin of active document as double

ScripterNG.activeDocument.margins.top | PROPERTY

- top-margin of active document as double

ScripterNG.activeDocument.modified | PROPERTY

- boolean flag if document is modified

If a document is modified you will be asked to save it on close or quit.

ScripterNG.activeDocument.pageCount() | FUNCTION
returns number of pages in active document as int

- ScripterNG.activeDocument.activePage
- Property
- Page object of active page in active Document

ScripterNG.activeDocument.selection | PROPERTY

- List of selected Item objects on active document

ScripterNG.activeWindow | PROPERTY
returns a Window object if a window is open

ScripterNG.activeWindow.redraw | PROPERTY

- boolean flag

This can be used to switch of redrawing for complex operations to safe time and reduce flicker. Don't forget to activate redrawing later. After that you can redraw the complete view with ->ScripterNG.activeWindow.update()

ScripterNG.activeWindow.scroll(x, y) | PROCEDURE

- x is an int
- y is an int

scrolls the visible view to (x, y)

ScripterNG.activeWindow.update() | PROCEDURE

forces a complete redraw of the view

ScripterNG.activeWindow.zoom | PROPERTY

- The zoom factor is a double > 0.0

-100.0 is special value to see the whole page.

ScripterNG.dialogs.alert(message) | PROCEDURE

- message is a string

inspired by alert in Javascript

ScripterNG.dialogs.bookmarks | PROPERTY

- QDialog object - details in doc/reference_dialogs.html

ScripterNG.dialogs.documentChecker | PROPERTY

- QDialog object - details in doc/reference_dialogs.html

ScripterNG.dialogs.layers | PROPERTY

- QDialog object - details in doc/reference_dialogs.html

ScripterNG.dialogs.mainWindow | PROPERTY

- QDialog object - details in doc/reference_dialogs.html

ScripterNG.dialogs.nodes | PROPERTY

- QDialog object - details in doc/reference_dialogs.html ScripterNG.dialogs.outline Property QDialog object - details in doc/reference_dialogs.html

ScripterNG.dialogs.pages | PROPERTY

- QDialog object - details in doc/reference_dialogs.html

ScripterNG.dialogs.properties | PROPERTY

- QDialog object - details in doc/reference_dialogs.html

ScripterNG.dialogs.scrapbook | PROPERTY

- QDialog object - details in doc/reference_dialogs.html

ScripterNG.fromVariant(variant) | FUNCTION
returns instance of QObject-subclass

- variant is a QVariant

This is a helper method for PyQt Because PyQt cannot cast a variant to a QObject or QWidget I hope that will change some time.

ScripterNG.newDocument(topMargin, bottomMargin, leftMargin, rightMargin, pageWIdth, pageHeight, orientation, firstPageNr, pagesTypes, facingPages, firstPageOrger, numPages) | FUNCTION
returns new a new active Document object

- topMargin is double
- bottomMargin is double
- leftMargin is double
- rightMargin is double
- pageWidth is double
- pageHeight is double
- orientation is int
- firstPageNr is int
- unit is int
- pagesType is int
- facingPages is int
- firstPageOrder is int
- numPages is int

ScripterNG.openDocument(filename) | FUNCTION
returns a Document object if a document is open

- filename is a string
- ScripterNG.activeDocument
- Property

ScripterNG.preferences.contains(context, key) | PROCEDURE

- context is a string of a plug-in context, e.g. "scripterng"
- key is a string

Use this to check if a preference is currently set.

ScripterNG.preferences.getBool(context, key) | FUNCTION
returns value of key as bool or False if key not found

- context is string
- key is string

Use ->ScripterNG.preferences.contains(context, key) if you don't know if the key exists.

ScripterNG.preferences.getDouble(context, key) | FUNCTION
returns value of key as double of -1 if key not found

- context is string
- key is string

ScripterNG.preferences.getInt(context, key) | FUNCTION
returns value of key as int or -1 if key not found

- context is string
- key is string

ScripterNG.preferences.getString(context, key) | FUNCTION
returns value of key as string or "" if key not found

- context is a string
- key is a string

ScripterNG.preferences.setBool(context, key, value) | PROCEDURE

- context ist string
- key is string
- value is bool

ScripterNG.preferences.setDouble(context, key, value) | PROCEDURE

- context is string
- key is string
- value is double

ScripterNG.preferences.setInt(context, key, value) | PROCEDURE

- context is string
- key is string
- value is int

ScripterNG.preferences.setString(context, key, value) | PROCEDURE

- context is string
- key is string
- value is string