Document with which the script was called.

You will find a general example for the use of gDocument here.

Document with which the script was called. Mostly this is the the current front document. Inside document actions, gDocument and the front document can defer. The following table shows the values of gDocument inside document scripts, see also at). With document::is_valid you can check, whether a documents reference is valid.

gDocument retains its value even if the order or number of opened documents changes while the script is executed. If you want to access the changed current front document within such scripts, please use document::get_front.

Action Action ID Description
Before create 41 not defined
After create 42 defined
Before open 43 not defined.
After open 44 defined
Before save 45 Only defined, if document isn't new.
After save 46 defined
Before 'Save Under' 47 Only defined, if document isn't new.
After 'Save Under' 48 defined
Before 'Save a Copy' 49 Only defined, if document isn't new.
After 'Save a Copy' 50 defined
Before revert 51 Only defined, if document isn't new.
After revert 52 Only defined, if document isn't new.
Before closing 53 defined
After closing 54 no more defined

Adapt gDocument to the current front document.

int front_doc_changed ()
{
    ItemRef 		docRef = document::get_front ();
item::define (gDocument, docRef, 1); item::release (docRef);
return 0; }

Since
Version 1.1.7, Januar 2005
See Also
document::current
document::get_front
document::is_valid
item::define
Script Environment

Alphabetic index HTML hierarchy of classes or Java