Re: Return PDF default reader
Re: Return PDF default reader
- Subject: Re: Return PDF default reader
- From: kai <email@hidden>
- Date: Sun, 1 Apr 2007 13:39:06 +0100
On 1 Apr 2007, at 00:43, Matt Deatherage wrote:
On 3/31/07 at 11:15 AM, kai <email@hidden> wrote:
I guess you could try to parse the contents of a lsregister dump
Ooh, I'd hate to do that...
To be perfectly honest, I wasn't too keen on it myself, Matt. ;-)
Then again, I hate to do it *this* way (*two*
"do shell script" statements? Am I still me?), but this does work:
---
set tempFldr to (path to temporary items)
set myPath to (POSIX path of tempFldr) & "temp.pdf"
set myFile to POSIX file myPath
tell application "Finder" to open tempFldr --just to watch
tell application "System Events"
do shell script "touch " & quoted form of myPath
set pdfApp to default application of (info for (myFile))
do shell script "rm " & quoted form of myPath
return pdfApp
end tell
---
I like this idea much better.
As you suggested, there's the possibility of avoiding the use of a
shell altogether (especially if, like me, one isn't too concerned
about explicitly cleaning up the temp folder afterwards). The
approach could even be incorporated in a general-purpose handler -
perhaps something like:
----------------------
on default_application for extn
set f to (path to temporary items as Unicode text) & "temp." & extn
close access (open for access file f)
(info for file f)'s default application
end default_application
default_application for "pdf" (* or any other name extension *)
----------------------
---
kai
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden