home *** CD-ROM | disk | FTP | other *** search
/ MacAddict 24 / MacAddict_024_1998_08.iso / Media / Software.dxr / LingoLib_10_browserClass.ls < prev    next >
Encoding:
Text File  |  1998-06-04  |  1.9 KB  |  80 lines

  1. property browserpath, filepath, htmltext, FieldName
  2. global gBrowser
  3.  
  4. on new me, srcfield
  5.   set browserpath to field "browserSelect"
  6.   set filepath to getOSDirectory() & "\imagine.html"
  7.   set FieldName to srcfield
  8.   set gBrowser to me
  9.   return me
  10. end
  11.  
  12. on load me, myfieldname
  13.   set htmltext to the text of member myfieldname
  14.   assign(me, "#date", the long date)
  15.   assign(me, "#time", the long time)
  16. end
  17.  
  18. on assign me, searchstr, replacestr
  19.   set pos to offset(searchstr, htmltext)
  20.   repeat while pos > 0
  21.     put replacestr into char pos to pos + length(searchstr) - 1 of htmltext
  22.     set pos to offset(searchstr, htmltext)
  23.   end repeat
  24. end
  25.  
  26. on launchURL me, url
  27.   loadBrowser()
  28.   load(me, FieldName)
  29.   assign(me, "#url", url)
  30.   output(me)
  31.   open(filepath, browserpath)
  32. end
  33.  
  34. on output me
  35.   set file to new(xtra("FileIO"))
  36.   createFile(file, filepath)
  37.   if error(file, status(file)) = "File already exists" then
  38.     openFile(file, filepath, 2)
  39.     delete(file)
  40.     put error(file, status(file))
  41.     createFile(file, filepath)
  42.     put error(file, status(file))
  43.   end if
  44.   openFile(file, filepath, 2)
  45.   put error(file, status(file))
  46.   writeString(file, htmltext)
  47.   put error(file, status(file))
  48.   closeFile(file)
  49.   put error(file, status(file))
  50.   openFile(file, filepath, 2)
  51.   setFinderInfo(file, "TEXT ttxt")
  52.   closeFile(file)
  53. end
  54.  
  55. on NoBrowserU
  56.   alert("You must select a Web Browser to link to this information. Please select one now.")
  57.   openconfigwindow()
  58. end
  59.  
  60. on LaunchIt
  61.   puppetSound(2, 0)
  62.   puppetSound(2, "LaunchingWeb")
  63.   delay(400)
  64.   set weburl to field "url"
  65.   launchURL(the text of field "browserloc", weburl)
  66. end
  67.  
  68. on loadBrowser
  69.   global myfile
  70.   set myfile to new(xtra("fileio"))
  71.   set finalPath to field "OSPath"
  72.   openFile(myfile, finalPath & "Browser.txt", 1)
  73.   set TheWeb to readLine(myfile)
  74.   put TheWeb into field "browserLoc"
  75.   closeFile(myfile)
  76.   set myfile to 0
  77.   browserName(the text of field "browserloc")
  78.   browserName(#enabled, 1)
  79. end
  80.