home *** CD-ROM | disk | FTP | other *** search
/ MacAddict 6 / MacAddict_006_1997_02.iso / media / tools.Dxr / 00017_BrowserClass.ls < prev    next >
Encoding:
Text File  |  1996-11-22  |  1.2 KB  |  50 lines

  1. property browserpath, filepath, htmltext, fieldname
  2. global gBrowser
  3.  
  4. on new me, srcfield
  5.   set browserpath to "MacAddict:Essentials:MSIE:Internet Explorer 2.1"
  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.   load(me, fieldname)
  28.   assign(me, "#url", url)
  29.   output(me)
  30.   open(filepath, browserpath)
  31. end
  32.  
  33. on output me
  34.   set file to new(xtra("FileIO"))
  35.   createFile(file, filepath)
  36.   if error(file, status(file)) = "File already exists" then
  37.     openFile(file, filepath, 2)
  38.     delete(file)
  39.     put error(file, status(file))
  40.     createFile(file, filepath)
  41.     put error(file, status(file))
  42.   end if
  43.   openFile(file, filepath, 2)
  44.   put error(file, status(file))
  45.   writeString(file, htmltext)
  46.   put error(file, status(file))
  47.   closeFile(file)
  48.   put error(file, status(file))
  49. end
  50.