Launching a Local HTML File |
|
Here we go:
on mouseUp
answer file "Pick a file to launch:"
if it <> "" then
launchHTML it
end if
end mouseUp
on launchHTML pPath
if the systemVersion >= 10 then
StripTC pPath
end if
if char 1 of pPath = "/" then delete char 1 of pPath -- For OS 9
send "file:///" & pPath to program "Finder" with "GURLGURL"
end launchHTML
on StripTC pPath
put pPath into tDestPath
set the itemDel to "/"
put last item of pPath into tOrigName
-- First, copy the target file to a dummy file; this removes the T/C
put "temp.html" into last item of tDestPath
get shell("cp" && q(pPath) && q(tDestPath))
if it <> "" then
answer "Error:" & it
exit to top
end if
-- Then, copy it back over the original
put tOrigName into last item of pPath
get shell("mv" && q(tDestPath) && q(pPath))
if it <> "" then
answer "Error:" & it
exit to top
end if
end StripTC
function q pWhat
return quote & pWhat & quote
end q
Posted 8/9/2003 by Ken Ray to the MetaCard List (See the complete post/thread)