home *** CD-ROM | disk | FTP | other *** search
/ MacAddict 24 / MacAddict_024_1998_08.iso / Media / Tools.dxr / 00017_BrowserClass.ls < prev    next >
Encoding:
Text File  |  1998-06-03  |  1.2 KB  |  51 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.   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. end
  51.