Nisus has limited Applescript support, but one of the things you can do in Applescript is tell Nisus to run a macro.
So I'd build a Nisus macro that saves the document as a PDF.
The "Do Menu Macro With Macro" Command is the one you want. So, your service would be something like this (thanks to Kino):
Code: Select all
set myMacro to "
$doc = Document.active
$docPath = $doc.filePath
# The next three line is unnecessary if you are 100% sure you run this macro
# on saved documents only.
if $docPath == @undefined
exit 'The document has never been saved, exiting...'
end
# As this macro will change the content of the surrounding folder,
# you may get an error if you don't “require” the access to it.
# Remove the next two lines if you are running an earlier version of
# Nisus Writer Pro not understanding “File.requireAccessAtPath” command
$folderPath = $docPath.filePathByRemovingLastComponent # Get the folder path
File.requireAccessAtPath $folderPath # For Sandbox access
# Get the path of the pdf file this macro will generate.
# For example, '/Users/you/Documents/sample.pdf'
# for '/Users/you/Documents/sample.rtf'.
$pdfPath = $docPath.filePathByChangingExtension('pdf')
Save As PDF $pdfPath
"
on run {input, parameters}
set theFiles to input
tell application "Nisus Writer Pro"
repeat with aFile in theFiles
open aFile
Do Menu Macro with macro myMacro
close front document
end repeat
end tell
end run
Now, I had to build in Sandboxing code. This code works best with a folder of documents; the first time you run it with a set of files never done before, it'll ask you to grant access to the file or the folder. Give it access to the folder and you'll never have to worry about it again.
I hope this helps!