ActiveScripting Examples
279
‘ is this document modified?
if app.DocumentCache(idx).Modified then sTable = "Yes"
sTable = "</td><td>"
‘ is this document read-only?
if app.DocumentCache(idx).ReadOnly then sTable = "Yes"
‘ close row
sTable = "</td></tr>" + newline
next
sTable = n "</table>"
‘ add a new document (False = don’t create from default template -
blank)
app.NewDocument(False)
‘ insert the table (note that the ActiveDocument will be the new
document
‘ created above)
app.ActiveDocument.InsertText sTable, False
‘ switch to browse mode
app.CurrentView = 2
‘ wait for user to re-enter edit mode
while app.CurrentView <> 1
‘ Wait is a home-grown routine to make up for the loss of
‘ DoEvents in VBScript. It will pause for a given number of
‘ milliseconds without locking the interface
app.Wait(100)
wend
‘ return to the original document
app.DocumentIndex = nCurrentIdx
MsgBox "Script Completed."
‘ free the references
set app = nothing
End Sub
‘ function example
function GetDisplayName(fname)
if fname = "" then
GetDisplayName = "(untitled)"
else
GetDisplayName = fname
end if
end function
</pre>
</body>
</html>
Содержание ColdFusion Server 5
Страница 18: ...xviii About This Book...
Страница 26: ...8 Chapter 1 Setting Up the Product...
Страница 42: ...24 Chapter 2 Configuring Browsers and Servers...
Страница 60: ...42 Chapter 3 Exploring the Workspace...
Страница 100: ...82 Chapter 6 Editing Pages...
Страница 126: ...108 Chapter 7 Using Web Development Languages...
Страница 212: ...194 Chapter 13 Customizing the Development Environment...
Страница 320: ...302 Glossary...