Re: Detecting Default PDF reader/writer
Re: Detecting Default PDF reader/writer
- Subject: Re: Detecting Default PDF reader/writer
- From: Ben Waldie <email@hidden>
- Date: Fri, 23 May 2003 12:56:24 -0400
Courtney,
On Friday, May 23, 2003, at 10:40 AM, Courtney Moore wrote:
I did not find anything in the preferences that related to the PDF
viewing.
I also did take a look at the link you sent me be I still do not know
how to
script the detecting or even modifying your default PDF viewer. Do
you
have any advice?
I haven't researched the contents of this preference file, but I'll try
to explain this as I currently understand it. I'm sure you could find
additional information about the contents of this preference file
somewhere on Apple's web site. Or, perhaps someone else on this list
can offer a more detailed and accurate explanation.
I don't believe this is as simple as looking for one preference, and
then changing its value. However, I do believe that this file is
what's telling the OS which application to launch for PDF files.
Okay, here goes... Looking at this file, it appears to contain XML
code that specifies to the OS, which application should be used to open
certain types of PDF files. Since there are multiple types of PDF
files in OS X, there may be multiple variations of this code contained
within this preference file. In other words, certain types of PDF
files may be opened in Preview by default, while others may be opened
in Acrobat by default. I assume that if no variations of this code are
present, then all PDF files would simply open in Preview as the default
viewer.
For example:
<key>C:CARO;E:pdf</key>
<array>
<dict>
<key>LSBundleIdentifier</key>
<string>com.apple.preview</string>
<key>LSBundleLocator</key>
<data>
AAAAAACiAAMAAQAAup04/gAASCsAAAAAAAAE5gAAS8sA
ALqA59MAAAAAASD//gAAAAAAAAAA/////wABAAQAAATm
AA4AGAALAFAAcgBlAHYAaQBlAHcALgBhAHAAcAAPABoA
DABNAGEAYwBpAG4AdABvAHMAaAAgAEgARAASABhBcHBs
aWNhdGlvbnMvUHJldmlldy5hcHAAEwABLwD//wAA
</data>
<key>LSBundleRoleMask</key>
<integer>-1</integer>
<key>LSBundleSignature</key>
<string>prvw</string>
<key>LSBundleVersion</key>
<integer>13172991</integer>
</dict>
</array>
In the above XML code, the key "C:CARO;E:pdf " at the top appears to
specify that PDF files with a creator type of "CARO" and an extension
of ".pdf" would pertain to this code. This key could have also
contained a file type, which could have been designated as "T:PDF ".
As I said before, for the various types of PDF files, there would be
different variations of this code. I'm assuming that the
"LSBundleIdentifier", "LSBundleLocator", and other elements here
actually tell the OS which application to open this particular type of
PDF file with. For example, if I change the default application for
this type of PDF manually to Adobe Acrobat Reader, you'll see that most
of these values change to the following...
<key>C:CARO;E:pdf</key>
<array>
<dict>
<key>LSBundleIdentifier</key>
<string>com.adobe.acrobat.reader</string>
<key>LSBundleLocator</key>
<data>
AAAAAAC4AAMAAQAAup04/gAASCsAAAAAAAAE5gAAhFkA
ALloA3MAAAAAASD//gAAAAAAAAAA/////wABAAQAAATm
AA4AJgASAEEAYwByAG8AYgBhAHQAIABSAGUAYQBkAGUA
cgAgADUALgAwAA8AGgAMAE0AYQBjAGkAbgB0AG8AcwBo
ACAASABEABIAH0FwcGxpY2F0aW9ucy9BY3JvYmF0IFJl
YWRlciA1LjAAABMAAS8A//8AAA==
</data>
<key>LSBundleRoleMask</key>
<integer>-1</integer>
<key>LSBundleSignature</key>
<string>CARO</string>
<key>LSBundleVersion</key>
<integer>329215</integer>
</dict>
</array>
I don't know what the "data" element contains. However, I assume it
probably contains some kind of a system reference to the application
that will open the file. Though, I may be mistaken.
So, in order to determine which application is the default PDF viewer,
you'll probably need to write a script to search this file and analyze
each chunk of XML code. The script will need to look for XML data
corresponding to each type of PDF file you may encounter. For example,
to determine if a certain chunk of XML data corresponds to a certain
type of PDF file, you may want to look for keys containing values such
as "C:CARO", "E:pdf", etc. Then, your script will have to extract and
examine the values of the XML elements following each of these keys, to
actually determine which application will be used for the current type
of PDF. In order to change the default PDF viewer, your script would
probably need to modify these values.
As I said, I haven't had the time to really research the contents of
this preference file. Perhaps someone else can offer some additional
input, has already written code to do this, or knows of a different way
of determining/changing the default PDF viewer.
Hope this helps.
- Ben
Benjamin S. Waldie
Automated Workflows, LLC
=============================================
AppleScript and Workflow Automation
Consulting - <
http://www.automatedworkflows.com>
AppleScript Info - <
http://www.applescriptguru.com>
AppleScript Training - <
http://www.applescripttraining.com>
=============================================
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.