Why is Konfabulator "Pretty?"
Ken Ray
kray at sonsothunder.com
Wed Dec 7 14:06:17 EST 2005
On 12/7/05 12:52 PM, "Chipp Walters" <chipp at chipp.com> wrote:
>>>> Web browser control.
>>>
>>> You can launch a web browser with a URL. Not sure what other control you
>>> mean.
>
> Ken Ray just offered up a great script for this in the MetaCard forum.
> Perhaps he'll share it here? Also revGoURL will launch a browser and the
> page.
Sure - although Bill meant an embedded web control like altBrowser, but this
code can be used with most URL types, including AIM:
on stsGoURL pURL
put char 1 to offset(":",pURL) of pURL into tProtocol
if (char 1 to 6 of pURL = "file:/") and (char 7 of pURL <> "/") then
-- convert to local path with three ///
replace "file:/" with "file:///" in pURL
else
put "file:,http:,mailto:,gopher:,aim:" into tProtocols
if tProtocol is not among the items of tProtocols then
-- assume web
put "http://" & pURL into pURL
put false into tIsIM
end if
end if
switch (the platform)
case "MacOS"
if isOSX() then
get shell("open" && q(pURL))
else
do ("open location" && q(pURL)) as AppleScript
end if
break
case "Win32"
put (word 1 of the systemVersion is "NT") into tIsNT
if $COMSPEC <> "" then
set the shellCommand to $COMSPEC
else
if tIsNT then
set the shellCommand to "cmd.exe"
else
set the shellCommand to "command.com"
end if
end if
switch tProtocol
case "mailto:"
put queryRegistry("HKEY_CLASSES_ROOT\mailto\shell\open\command\") into
tMailApp
-- replace placeholders for all Win versions (%1 for non-XP modern, %l
for old, %ProgramFiles% for XP)
replace q("%1") with pURL in tMailApp
replace "%1" with pURL in tMailApp
replace q("%l") with pURL in tMailApp
replace "%l" with pURL in tMailApp
replace "%ProgramFiles%" with $PROGRAMFILES in tMailApp
open process tMailApp for neither
break
case "aim:"
-- Example:
-- aim:goim?screenname=binentertainment&message=This+is+a+test
put
queryRegistry("HKEY_LOCAL_MACHINE\Software\classes\aim\shell\open\command\")
into tAIMApp
replace q("%1") with pURL in tAIMApp
replace "%1" with pURL in tAIMApp
open process tAIMApp for neither
break
default
put word 1 of
queryRegistry("HKEY_LOCAL_MACHINE\Software\classes\http\shell\open\command\"
) into tBrowserPath
if tIsNT then
set the hideconsolewindows to false
open process (tBrowserPath && q(pURL)) for neither
else
get shell(tBrowserPath && q(pURL))
end if
break
end switch
end switch
end stsGoURL
function isOSX
set the itemDel to "."
return (item 1 of the systemVersion >=10)
end isOSX
More information about the use-livecode
mailing list