home *** CD-ROM | disk | FTP | other *** search
/ Amiga Tools 5 / Amiga Tools 5.iso / internet-tools / wwwcache2.1 / cache.doc next >
Encoding:
Text File  |  1996-01-15  |  13.2 KB  |  246 lines

  1.   $VER: Cache.www 2.1 (15.1.96) Stephan Lichtendahl
  2.  
  3.   Freeware
  4.  
  5. Purpose:
  6. Saves inlined images to harddisk to prevent them from being
  7. downloaded every time you want to see them. Then they can
  8. be loaded every time from harddisk instead, which is a bit
  9. faster :-)
  10. Also, HTML documents can be saved in a way that all remote
  11. links remain remote and links to documents, which are already
  12. on your harddisk, will automatically be replaced with local
  13. ones. A convenient hotlist as HTML document will be created.
  14.  
  15. Requirements:
  16. -AMosaic (tested with NoNet 1.2 and AmiTCP 1.3beta & 2.0pre-release versions)
  17. -probably OS3.x for inlined images to work
  18. -Arexx running
  19. -rexxsupport.library (tested with version 34.9)
  20. -rexxdossupport.library (tested with version 2.1, 2.3 & 2.4)
  21. -getstring for resaving local documents or
  22.  rexxreqtools.library for reqtools-version (on request)
  23.  
  24. Installation / Usage:
  25. 1. Copy the Cache.www Arexx script to rexx: or somewhere else, as
  26.  long as it's in your path.
  27.  If you have been using previous versions of the script, you must
  28.  execute the ConvCache.rexx script which will update all documents,
  29.  ImageList, HTMLlist, Cache.html, create the directory tree and
  30.  move all files in it. The Env(Arc):Mosaic/.mosaic-hotlist-default
  31.  will be updated as well. It can take quiet some time...
  32.  Make sure you change the cachedir occurence at the top of the
  33.  ConvCache.rexx script (see 3) to match your old cache directory.
  34.  The directory tree will be created in that directory, so you
  35.  must use the same definition in the Cache.www script.
  36.  When you expect any problems, make a backup of the ImageList and
  37.  HTMLlist files first, because the ConvCache.rexx script can't cope
  38.  with the new format files.
  39.  After that, you don't need the ConvCache.rexx script any more.
  40.  
  41. 2. Copy the Cache directory to any place you want, but note that you
  42.  can't ever move it to another place, unless you use assigns in the
  43.  definition of the cachedir (see 3).
  44.  It initially only contains some empty files (ImageList & HTMLlist),
  45.  and there is a Cache.html document which will be updated with all HTML
  46.  documents you save or remove. The images and HTMLs that are saved will
  47.  be noted in the appropriate ...list files, so those files are very
  48.  important!
  49.  When adding or removing a document a DoHTMLlist is created, which is
  50.  used for the Update feature (see 9).
  51.  
  52.  When using the script a directory tree will be created closely
  53.  resembling the path of the URL of the images and documents you save.
  54.  So, for example, document http://www.omnipresence.com/amosaic/2.0/
  55.  will be saved as cachedir/www.omnipresence.com/amosaic/2.0/.html
  56.  Note in this case .html is added automatically, because a filename
  57.  is missing.
  58.  
  59. 3. Edit the Cache.www script with a text editor, make sure you only
  60.  change the following line (at the top):
  61.  
  62.  cachedir='AmiTCP:Cache/'
  63.  
  64.  This is the definition of the cache directory, you MUST change this
  65.  if you didn't put the cache directory in AmiTCP:
  66.  Note it is a good idea to use an assign in the definition to prevent
  67.  problems later on when the path of the cache directory changes.
  68.  The definition can't contain spaces or " and must end with a / or :
  69.  character. There must also be a : in it and ' characters around it.
  70.  
  71.  Important: when using version 2.1 of rexxdossupport.library, change
  72.  both occurences of rexxdossupport.library a few lines below to
  73.  RexxDosSupport.library. This is also true for the ConvCache.rexx script.
  74.  
  75. 4.If you want to run the Cache.www script from AMosaic, which is a very
  76.  good idea, add the following entrys to your env(arc):mosaic/prefs :
  77.  
  78.  RexxMacro<n>   Get/put images from/in cache   |"address command 'Run >Nil: Rx Cache.www' address()"
  79.  RexxMacro<n+1> Same as above & save this page |"address command 'Run >Nil: Rx Cache.www Save' address()"
  80.  RexxMacro<n+2> Reload cached page from the WWW|"address command 'Run >Nil: Rx Cache.www Load' address()"
  81.  RexxMacro<n+3> Remove page & images from cache|"address command 'Run >Nil: Rx Cache.www Remove' address()"
  82.  
  83.  with <n>,<n+1>,etc the numbers of the arexx macro. For some strange reason
  84.  it is necessary to `Run' this arexx script instead of directly through
  85.  arexx, otherwise AMosaic hangs. Rx must be in the path (i recommend you
  86.  make Rx resident if you use arexx scripts alot).
  87.  The address() function tells the script what Arexx port to use, so you can use
  88.  multiple AMosaic windows. Without it, `AMOSAIC.1' is assumed to be the Arexx port.
  89.  
  90.  Of course DelayImageLoads must be True, otherwise the script will not be
  91.  of much help. You can turn it off again in AMosaic when reading cached
  92.  documents with the options menu.
  93.  Note, that when using AmosaicPrefs long lines can be chopped off, in that
  94.  case use a normal text editor to edit the prefs file. Also the checkbox
  95.  gadget for DelayImageLoads doesn't work as expected: the checkmark is there
  96.  also when DelayImageLoads is false, just check it again by clicking on it.
  97.  
  98. 5.Run the script every time you want something to happen with the current
  99.  HTML document you are viewing in AMosaic.
  100.  -with inlined images which have not been loaded and aren't on your harddisk
  101.   nothing will happen (download them yourself)
  102.  -inlined images which are on your harddisk will be loaded and will be displayed
  103.  -inlined images which have been downloaded will be saved on harddisk
  104.  
  105.  Normally you would first execute the script to load all images already on your
  106.  harddisk, then manually download the rest of the images you want (or choose
  107.  `Load images in current' from AMosaic's `Options' menu) and then run the script
  108.  again to save the ones you downloaded.
  109.  When you are viewing a remote document and there are images for it on harddisk
  110.  you will automatically view a copy of it (...localhost/T:temphtml... in the URL)
  111.  in which the images are loaded. But all links will still be remote ones!
  112.  At the bottom of the document you will see `This is a temporal page created by
  113.  WWWCache 2.1 © S.Lichtendahl': click on it to email me.
  114.  
  115. 6.When you want to do the same as 6 but also save the document then choose that
  116.  menu item from the rexx macros. There are a number of differences between this
  117.  feature and the normal save document as HTML feature of AMosaic:
  118.  -All links in the document will still be remote ones (links are normally relative
  119.   to the current document, so they would be relative to your harddisk).
  120.  
  121.  -If you are viewing a local document from the cache directory tree it will
  122.   automatically be saved under the same name. Handy when more inline images have
  123.   been cached, as those image links will then also be saved as local.
  124.   You can reload the original page from the WWW with the Load option (rx Cache.www
  125.   Load) and then maybe save it again with the Save option (rx Cache.www Save).
  126.  
  127.  -If you are viewing a remote document, it's existence in the HTMLlist will be
  128.   checked, and if available the document will be saved under the same name (as
  129.   above). Otherwise the document is saved with the same path as the URL,
  130.   creating extra directorys if necessary.
  131.  -When saving a document for the first time, ALL HTML documents already in the
  132.   directory tree on harddisk will be checked for the URL of the current document
  133.   and replaced with a local URL pointing to the document on harddisk.
  134.   Also, the document title will be added to cachedir/Cache.html with a link to
  135.   the document you saved, so you can simply use that HTML page as a hotlist
  136.   to jump to all your HTML documents in the directory tree.
  137.  -When saving a HTML document all links in the document are checked for existence
  138.   on your harddisk, links to cached documents already in the directory tree
  139.   will be replaced with local ones. (So you see it works both ways).
  140.  
  141.  -You cannot save a document with ...localhost/T:temphtml... in the URL, which is
  142.   a copy of the current document created by Cache.www, you will automatically
  143.   move back to the original document. Same case with the Load option.
  144.  
  145.  -When you try to save a local document not saved with the Cache.www script
  146.   (eg. the HTML documents you had already on your harddisk, or the ones which
  147.   were saved with the Save Document as HTML feature from AMosaic) you will be
  148.   prompted for a URL (the script suggests a reasonable remote URL).
  149.   When using a local URL the links in it will not be of much use, you can see
  150.   this as AMosaic tries the load the inlined images.
  151.   If you enter the original URL for that document, however, all relative links
  152.   will be saved as remote ones with that URL in it, and you will be viewing
  153.   the new document from harddisk. Now you must save that one to check
  154.   for images or links to documents already in then directory tree on harddisk
  155.   and let the script replace the URL's as appropriate.
  156.   You could use this feature to "enhance" you old documents.
  157.  
  158. 7.You can view the saved document with the `Open Local' menu-item from AMosaic,
  159.  as you would normally do, or `Open Local' the cachedir/Cache.html and click on
  160.  the document you want. Then use the `Load images in current' menu-item to
  161.  load all available images, if you had updated the document after those images
  162.  became available, otherwise just execute the Cache.www script (you could
  163.  always execute the CacheImages script to view all available images, local
  164.  images will be loaded automatically, cached images in a copy of the document).
  165.  
  166. 8. You can use `rx Cache.www Remove' or the equivalent menu-item to
  167.  delete the current HTML document and/or its images:
  168.  To delete a few inline images, make sure only the ones you want to delete
  169.  are visible (ie. loaded) at the moment.
  170.  To delete the HTML document, make sure no images are loaded, that can be
  171.  deleted (ie. only images that aren't cached are visible).
  172.  If all inline images are loaded and can be deleted, the HTML document will
  173.  be deleted as well (in other cases, just use Remove twice).
  174.  When the HTML document is deleted, it will be reloaded from the WWW as
  175.  with the Load option (because the Load option only works with cached
  176.  documents).
  177.  
  178. 9. This is how the new `update .mosaic-hotlist-default' feature works:
  179.  Use `rx Cache.www Update' followed by the name of your AMosaic program
  180.  (with path if necessary). When the script finishes, AMosaic will be
  181.  started.  What update does, is that it will use the DoHTMLlist to make
  182.  all necessary changes in  env(arc):mosaic/.mosaic-hotlist-default.
  183.  For all removed documents, the links will be replaced with the original
  184.  remote ones.
  185.  For new documents, an already existing remote link will be replaced with
  186.  a local one or a new entry will be made in the root of your hotlist.
  187.  You can distinguish a link to a cached document from a remote link by
  188.  the © character in front of the title in the hotlist.
  189.  
  190.  Now you can use AMosaic's hotlist menu (or if you don't have 2.0beta,
  191.  you can use the AMhotlist program) to organize your hotlist better,
  192.  first thing will probably be to get all those links out of the root.
  193.  If you use the update feature every time to start AMosaic, you will make
  194.  sure any changes in cached documents (removed/added) you made the last
  195.  time will be reflected in the hotlist, and any changes you will make
  196.  now will be seen the next time you update & start AMosaic.
  197.  
  198.  Now why didn't i make my script update the hotlist every time you add or
  199.  remove a cached document?  Because it wouldn't work.
  200.  AMosaic 2.0beta and AMhotlist load env:mosaic/.mosaic-hotlist-default
  201.  only on startup, so they don't know what changes the script will make
  202.  to it, and when they write env(arc):mosaic/.mosaic-hotlist-default,
  203.  they will write the original file with only the changes they made to it.
  204.  (The same problem you will have when you use AMhotlist and the hotlist
  205.  menu of AMosaic 2.0beta, and change something in one of the programs).
  206.  
  207. Notes:
  208.  When making use of the update feature, don't delete the Cache.html document,
  209.  it is still needed (and updated) by the script.
  210.  
  211.  When deleting images or HTML documents from the cache directory, all HTML
  212.  documents in the directory tree will be checked for the local URL of the image
  213.  or HTML document you delete and replaced with the original remote one.
  214.  This is the exact opposite of saving a HTML document (see above),  but NOT
  215.  of saving an image:
  216.  When saving an image no checks are made, so local documents can still have
  217.  the remote URL of that image. This is not much of a problem, however,
  218.  because when you run the script when viewing a document (local or remote)
  219.  automatically you will be viewing a copy (if necessary of course) in which
  220.  the local images will be loaded. The document links in it, will not
  221.  automatically be replaced with local ones for the HTML documents on your
  222.  harddisk (that would make browsing the WWW for updated documents impossible),
  223.  but when saving a HTML document all its links to HTML documents or images
  224.  already on your harddisk will be replaced by local ones and you will be
  225.  viewing the saved document.
  226.  
  227.  Overwriting an image is only possible when you choose to download it before
  228.  you let the script load it from harddisk.
  229.  
  230.  Forms will also work with saved documents (provided that you have AMosaic 2.0).
  231.  Forms-support in AMosaic 2.0beta works best with MUI 3.1 (less buggy).
  232.  
  233.  All HTML documents, ImageList & HTMLlist cannot exceed 64Kbyte in file size
  234.  each. This is mainly because of the AMosaic <> Arexx interface, but should
  235.  be not much of a problem, i hope.
  236.  
  237.  
  238. Bugs,comments,suggestions,questions:
  239.  
  240. Stephan Lichtendahl - Netherlands
  241.  
  242. Amiga 1200/030/33MHz/MMU/FPU/6MB/385MB/OS3.0 & CD32
  243.  
  244. Email: s.e.m.lichtendahl@et.tudelft.nl
  245.  
  246.