Activescripting Examples; Jscript - MACROMEDIA COLDFUSION STUDIO 4.5-USING COLDFUSION STUDIO Use Manual

For windows 95/98/nt4/2000
Table of Contents

Advertisement

240

ActiveScripting examples

JScript

<html>
<head>
<title>JScript Example</title>
</head>
<body>
<pre>
//
//=====================================================================
//
//=====================================================================
//
//
//
//=====================================================================
function Main() {
ActiveScripting example (JScript)
Displays a table containing the filenames of all open documents,
whether or not each document has been modified, and whether each
document is read-only.
var newline = '\n';
var br = '<br>';
var tab = '\t';
// create app reference.
// available from within HomeSite and Studio - to create the app
object from an
// external script, use
CreateObject('AllaireClientApp.TAllaireClientApp')
var app = Application;
// save the index of the current document so it can be returned to
var nCurrentIdx = app.DocumentIndex;
// start the table
var sTable = '<b><font color=Blue>Names of all open'
+ ' documents:</font></b>'
+ br + newline + br + newline
+ '<table border=1 width=460>'
+ newline + '<tr>'
+ '<td><b>Document</b></td>'
+ '<td><b>Modified</b></td>'
+ '<td><b>Read-Only</b></td>'
+ '</tr>' + newline;
// loop through all open documents (note that DocumentCount is
1-based,
// whereas DocumentCache() is 0-based)
for (idx = 0; idx < app.DocumentCount; idx++) {
// get document name (uses function example)
fname = GetDisplayName(app.DocumentCache(idx).Filename);
sTable = sTable + tab + '<tr><td>' + fname;
sTable = sTable + '</td><td>';
note that the Application object is only

Advertisement

Table of Contents
loading

This manual is also suitable for:

Coldfusion studio 4.5

Table of Contents