Working With Documents; Opening Documents; Open A Document In A Document Window - Adobe GoLive CS2 Programmer's Manual

Hide thumbs Also See for GoLive CS2:
Table of Contents

Advertisement

SDK Programmer's Guide

Working With Documents

You can use the functions and properties of the document object to perform basic document operations
such as creating, opening, and saving the documents displayed in GoLive's document windows.
Every document object's properties provide:
A description of its type:
markup
site
javascript
css
unknown
A title string displayed to the user
A unique JavaScript name
A file object representing the disk file from which it was read
The line break mode (Mac OS, Windows, or UNIX®) it uses
A description of how it is displayed: Layout view, Source view, Outline view, and so on
Access to its undo history
If the document object represents a markup document ( type="markup" ), additional properties provide:
Access to the tree of markup elements GoLive generated when interpreting the document
A reference to the site that contains the document. This reference is always available, even when the
site file is not open. You can use it to navigate among the documents in a site programmatically.
A reference to the Site window if it is open
If the document object represents a web site ( type="site" ), additional properties reference:
The root folder of the site
The home page of the site

Opening documents

An extension can open a document in Layout view, or it can open the document for manipulation without
displaying it in a window. An extension that batch-processes multiple pages, for example, works much
faster if it does not need to update the GoLive UI. However, other extensions, such as custom palette
entries, must interact with document windows and other UI windows.

Open a document in a document window

To open an existing file or document in a document window, use the
method:
var theDoc= app.openDocument("myFolder/myDoc.html");
This method returns the document object for the specified file, or null if it cannot find the file.
To allow your user to select a document file, call the
operating system's standard file browser dialog. If the user selects a file, the function returns the
corresponding
: A markup tree
: A GoLive site document
: A JavaScript document
: A style-sheet document
: All other types of documents
file
Object. To open the document, call the file object's openDocument method:
Adobe GoLive CS2 SDK
fileGetDialog
Editing Documents Programmatically
app
Object's
openDocument
global function. This displays the
97

Advertisement

Table of Contents
loading

Table of Contents