home *** CD-ROM | disk | FTP | other *** search
/ MacAddict 10 / MacAddict_010_1997_06.iso / media / Demos.Dxr / 00013_BrowserClass.ls < prev    next >
Encoding:
Text File  |  1997-03-26  |  1.1 KB  |  47 lines

  1. property browserpath, filepath, htmltext, fieldName
  2. global gBrowser, browserpath, filepath
  3.  
  4. on new me, srcfield
  5.   set browserpath to field "BrowserLoc"
  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.   set browserpath to field "BrowserLoc"
  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.     createFile(file, filepath)
  41.   end if
  42.   openFile(file, filepath, 2)
  43.   setFinderInfo(file, "TEXT ttxt")
  44.   writeString(file, htmltext)
  45.   closeFile(file)
  46. end
  47.