Launching a local file in the default browser
Ken Ray
kray at sonsothunder.com
Sat Aug 9 03:57:01 EDT 2003
OK, Richard, I got it... you need to shell() to the "cp" to copy the
file to a temporary filename; doing so will strip the type/creator and
then you can launch it with "open" via appleScript (after converting the
POSIX path to a normal mac path, of course):
on launchit pPath
put pPath into tDestPath
set the itemDel to "/"
put "temp.html" into last item of tDestPath
get shell("cp" && pPath && tDestPath)
put "tell application" && q("Finder") into s
put cr & "set f to" && q(tDestPath) && " as POSIX file" after s
put cr & "set p to f as text" after s
put cr & "open file p" & cr & "end tell" after s
do s as AppleScript
end launchIt
function q pWhat
return quote & pWhat & quote
end q
This should work...
Ken Ray
Sons of Thunder Software
Email: kray at sonsothunder.com
Web Site: http://www.sonsothunder.com/
> -----Original Message-----
> From: metacard-admin at lists.runrev.com
> [mailto:metacard-admin at lists.runrev.com] On Behalf Of Richard Gaskin
> Sent: Saturday, August 09, 2003 2:12 AM
> To: metacard at lists.runrev.com
> Subject: Re: Launching a local file in the default browser
>
>
> Ken Ray wrote:
>
> > Richard, you posted this to the MC list last year under the header :
> >
> > Found it: You have to explicitely tell the Finder, like this:
> >
> > put "tell application ""e&"Finder""e&cr&"open ""e& \
> > tFilePath "e&cr&"end tell" into s do s as AppleScript
> >
> > See:
> > http://lists.runrev.com/pipermail/metacard/2002-January/000569.html
> >
> > But I just checked it and it doesn't work for me.
>
> Same here: it launches the local file, but in the
> application that matches the file's creator code and not the
> default browser. :(
>
> > I'll keep looking...
>
> Thanks. Hopefully one of us will solve this once and for all...
>
> --
> Richard Gaskin
> Fourth World Media Corporation
> Developer of WebMerge: Publish any database on any Web site
> ___________________________________________________________
> Ambassador at FourthWorld.com http://www.FourthWorld.com
> Tel: 323-225-3717 AIM: FourthWorldInc
>
> _______________________________________________
> metacard mailing list
> metacard at lists.runrev.com
> http://lists.runrev.com/mailman/listinfo/metac> ard
>
More information about the metacard
mailing list