NISUS Archives

September 2010

NISUS@LISTSERV.DARTMOUTH.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Reply To:
Date:
Sun, 26 Sep 2010 20:59:13 +0900
Content-Type:
text/plain
Parts/Attachments:
text/plain (36 lines)
On Sep 26, 2010, at 1:49 PM, Philip Spaelti wrote:

> It may even be possible to write a macro that would do Save-Save as pdf and override the replace file dialog in one go.

Of course you can. The macro below can be shortened to just two lines if you are not particular about file name and location.

The generated pdf will be opened by the default application for pdf. If the macro does not work, set $useOpenURL to false. Once I noticed Open URL command misbehaving with a special character. But I cannot reproduce it now, at least with Preview.app. Perhaps the culprit was something else.


Kino

--

$useOpenURL = true

$doc = Document.active
if $doc == undefined
	exit  # no open document
end

$pdfPath = File.temporaryPathWithName 'xxx'
$pdfPath = $pdfPath.filePathByRemovingLastComponent  # DARWIN_USER_TEMP_DIR
$pdfPath = $pdfPath.filePathByAppendingComponent $doc.displayName
$pdfPath = $pdfPath.filePathByChangingExtension 'pdf'
Save As PDF $pdfPath

if $useOpenURL == true
	$pdfPath = 'file://' & $pdfPath
	Open URL $pdfPath
else
	Set Exported Perl Variables 'pdfPath'
	begin Perl
		`open "$pdfPath"`;
	end
end

ATOM RSS1 RSS2