Code: Select all
$x = Document.active
if $x = "document <untitled>"
Select All
Delete
Close
else
exit
end
It seems that the condition is not understood. What went wrong?
Code: Select all
$x = Document.active
if $x = "document <untitled>"
Select All
Delete
Close
else
exit
end
I don't know but the following seems to work.js wrote:What went wrong?
Code: Select all
$docs = Document.openDocuments
foreach $doc in $docs
$path = $doc.filePath
if $path == undefined # i.e. if it is an unsaved document not having a path
Document.setActive $doc
Menu ':File:Close'
if $doc.hasChanges
Press Button "Don't Save"
end
end
end
First "=" is an assignment, not a comparison. So really that "if" statement will always be true. Also, the capitalization and spacing of the string is not correct. What you meant was:js wrote:Code: Select all
$x = Document.active if $x = "document <untitled>"
Code: Select all
$x = Document.active
if $x == "Document<Untitled>"
Code: Select all
$doc = Document.active
$doc = Cast to String $doc
If $doc == "Document<Untitled>"
Code: Select all
$doc = Document.active
If $doc.filePath == undefined
Code: Select all
$doc = Document.active
If $doc.filePath == undefined
Select All
Delete
Close
End
Code: Select all
$doc = Document.active
If $doc.filePath == undefined
$doc.clearUndoHistory
Close
End
Code: Select all
$doc = Document.active
if $doc != undefined # i.e. unless there is no open document...
$doc.close true
end
Code: Select all
$doc = Document.active
if $doc != undefined # i.e. unless there is no open document...
if $doc.filePath == undefined
$doc.close true
end
end
Code: Select all
$docs = Document.openDocuments
foreach $doc in $docs
if $doc.filePath == undefined
$doc.close true
end
end