Groucho’s macro wrote:Any open document will be closed first.
Your macro seems to close all open documents for the
sole purpose of preventing them from being saved as PDF together with those which are going to be opened. So do I think but I may be wrong.
Perhaps it makes you happy, very happy, very very happy to see the
Document Manager window with no document window,
perhaps. Chacun son goût. Anyway, in such a situation, if you use
Choose Files command instead of
Open… (menu command) to select files, you don’t need closing any document, for newly opened ones are identified by their file paths (
$path[s]) and then by a Document object (
$doc) returned by
Document.open $path.
Code: Select all
$paths = Choose Files '', 'Make PDF'
if $paths == undefined
exit # Cancelled by the user
end
foreach $path in $paths
$doc = Document.open $path
$pdfPath = $path.filePathByChangingExtension 'pdf'
Document.setActive $doc # make sure that $doc is the frontmost
Save As PDF $pdfPath
$doc.close true # true [= discard changes] is very unlikely to be useful here, though
end