Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Return PDF default reader




On 30 Mar 2007, at 15:55, Laine Lee wrote:

On 1/15/07 5:55 PM, "kai" <email@hidden> wrote:

set defaultApp to word -1 of (do shell script "defaults read
com.apple.LaunchServices LSHandlers | grep -A 2 'LSHandlerContentType
= \"com.adobe.pdf\";' | grep 'LSHandlerRoleAll = \"'")

The output of "defaults read com.apple.LaunchServices LSHandlers" doesn't
contain "com.adobe.pdf" omm (10.4.9 intel), so a non-zero status (error) is
returned by the command. So neither of these approaches works. Is there any
other value to test against?

I guess you could try to parse the contents of a lsregister dump, Laine. However, you'll probably still need to trap cases where the default application has never been changed - perhaps with something like this (watch for line wraps):


--------------------

on default_pdf_app()
tell application "Finder" to try
name of application file id (text from word 3 to -1 of paragraph -1 of (do shell script "/System/Library/Frameworks/ ApplicationServices.framework/Versions/A/Frameworks/ LaunchServices.framework/Versions/A/Support/lsregister -dump | grep - A 2 'content type: com.adobe.pdf'"))
on error
name of application file id "com.apple.Preview"
end try
end default_pdf_app


default_pdf_app()

--------------------

---
kai


_______________________________________________ Do not post admin requests to the list. They will be ignored. AppleScript-Users mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/applescript-users/email@hidden Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden
References: 
 >Re: Return PDF default reader (From: Laine Lee <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.