[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: OS X question about Apple's Preview

From: Arjan Bos
Subject: Re: OS X question about Apple's Preview
Date: Thu, 7 Dec 2006 22:32:39 +0100

On 7 dec 2006, at 21:33, Trevor Bača wrote:


Not a direct Lily question, but useful nonetheless:

Any OS X folks know how to tell Apple's Preview application -- from
the commandline -- to close foo.pdf (but leave other pdfs open, ie,
without actually killing the Preview process)?

The most obvious way would be to use Applescript, unfortunately, Applescript isn't supported by But has the solution: < previewscript/index.php>

Here they turn on Applescript from the command line with:
defaults write /Applications/ NSAppleScriptEnabled -bool YES

And then you can close a window with:

tell application "Preview"
    close window 1
end tell

I have not yet used it, but presumably, every OS update that also updates will override this setting back to the default.

Some quick experimenting results in:

tell application "Preview"
        repeat with i from 1 to number of windows
                set current_window to item i of windows
                set current_name to name of the document of the current_window
                if current_name is "AdemVanEeuwigheid.pdf" then
                        close window i
                        exit repeat
                end if
        end repeat
end tell

Where AdemVanEeuwigheid.pdf is a pdf of a lilypond score.

Perhaps you can make this into a folder action that executes on the directory where your pdfs are created in?


They both savoured the strange warm glow of being much more ignorant than ordinary people, who were only ignorant of ordinary things.

-- Discworld scientists at work  (Terry Pratchett, Equal Rites)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]