URLs

Shari gogypsy at bellsouth.net
Sun Mar 17 10:34:01 EST 2002


This is the final result of a universal handler for URLs.  Has not 
been tested on OSX or Windows yet, and won't be till I release the 
program to my beta testers.  I know that I could use Applescript even 
for non-OSX Macs, but truthfully, I prefer not to use Applescript at 
all in any of my scripts unless there's absolutely no other way 
(ditto for XCMD's).  The reason being I'd rather my program not rely 
on the user having this program or that to run mine, as not everyone 
has even the common programs.  Let's just say I keep tech support in 
mind during creation, the more potential tech support issues I can 
solve before it enters the world, the less headaches for me later :-)

Improvement suggestions are welcome.  And if anybody knows a way to 
avoid using Applescript (without reverting to XCMDs), that would be 
most welcome!


# in the object or card script
# the url itself has the style of "link"
on mouseUp
   global tUrl
   if the clickText contains ".com" or the clickText contains ".net" then
     put the clickText into tUrl
     goUrl
   end if
end mouseUp

# in the stack script
on goURL
   global tURL
   if tURL contains "@" then put "mailto:" before tURL
   if (the platform) is "MacOS" then
     get the systemversion
     set the itemdel to "."
     if item 1 of it >= 10 then # OS X
       put "open location" && quote & tURL & quote into s
       do s as AppleScript
     else # MacOS
       send tUrl to program "Finder" with "GURLGURL"
     end if
   else if (the platform) is "Win32" then
     local intApp
     local EXE_off
     put 
queryRegistry("hkey_local_machine\software\classes\http\shell\open\command\") 
into intApp
     if char 1 of intApp is quote then clear char 1 of intApp  # strip 
leading quote
     put offset("EXE",intApp) into EXE_off
     put char 1 to (EXE_off+2) of intApp into intApp
     launch tURL with intApp
   end if
end goURL
-- 
--Shareware Games for the Mac--
http://www.gypsyware.com



More information about the metacard mailing list