home *** CD-ROM | disk | FTP | other *** search
- $VER: Cache.www 2.1 (15.1.96) Stephan Lichtendahl
-
- Freeware
-
- Purpose:
- Saves inlined images to harddisk to prevent them from being
- downloaded every time you want to see them. Then they can
- be loaded every time from harddisk instead, which is a bit
- faster :-)
- Also, HTML documents can be saved in a way that all remote
- links remain remote and links to documents, which are already
- on your harddisk, will automatically be replaced with local
- ones. A convenient hotlist as HTML document will be created.
-
- Requirements:
- -AMosaic (tested with NoNet 1.2 and AmiTCP 1.3beta & 2.0pre-release versions)
- -probably OS3.x for inlined images to work
- -Arexx running
- -rexxsupport.library (tested with version 34.9)
- -rexxdossupport.library (tested with version 2.1, 2.3 & 2.4)
- -getstring for resaving local documents or
- rexxreqtools.library for reqtools-version (on request)
-
- Installation / Usage:
- 1. Copy the Cache.www Arexx script to rexx: or somewhere else, as
- long as it's in your path.
- If you have been using previous versions of the script, you must
- execute the ConvCache.rexx script which will update all documents,
- ImageList, HTMLlist, Cache.html, create the directory tree and
- move all files in it. The Env(Arc):Mosaic/.mosaic-hotlist-default
- will be updated as well. It can take quiet some time...
- Make sure you change the cachedir occurence at the top of the
- ConvCache.rexx script (see 3) to match your old cache directory.
- The directory tree will be created in that directory, so you
- must use the same definition in the Cache.www script.
- When you expect any problems, make a backup of the ImageList and
- HTMLlist files first, because the ConvCache.rexx script can't cope
- with the new format files.
- After that, you don't need the ConvCache.rexx script any more.
-
- 2. Copy the Cache directory to any place you want, but note that you
- can't ever move it to another place, unless you use assigns in the
- definition of the cachedir (see 3).
- It initially only contains some empty files (ImageList & HTMLlist),
- and there is a Cache.html document which will be updated with all HTML
- documents you save or remove. The images and HTMLs that are saved will
- be noted in the appropriate ...list files, so those files are very
- important!
- When adding or removing a document a DoHTMLlist is created, which is
- used for the Update feature (see 9).
-
- When using the script a directory tree will be created closely
- resembling the path of the URL of the images and documents you save.
- So, for example, document http://www.omnipresence.com/amosaic/2.0/
- will be saved as cachedir/www.omnipresence.com/amosaic/2.0/.html
- Note in this case .html is added automatically, because a filename
- is missing.
-
- 3. Edit the Cache.www script with a text editor, make sure you only
- change the following line (at the top):
-
- cachedir='AmiTCP:Cache/'
-
- This is the definition of the cache directory, you MUST change this
- if you didn't put the cache directory in AmiTCP:
- Note it is a good idea to use an assign in the definition to prevent
- problems later on when the path of the cache directory changes.
- The definition can't contain spaces or " and must end with a / or :
- character. There must also be a : in it and ' characters around it.
-
- Important: when using version 2.1 of rexxdossupport.library, change
- both occurences of rexxdossupport.library a few lines below to
- RexxDosSupport.library. This is also true for the ConvCache.rexx script.
-
- 4.If you want to run the Cache.www script from AMosaic, which is a very
- good idea, add the following entrys to your env(arc):mosaic/prefs :
-
- RexxMacro<n> Get/put images from/in cache |"address command 'Run >Nil: Rx Cache.www' address()"
- RexxMacro<n+1> Same as above & save this page |"address command 'Run >Nil: Rx Cache.www Save' address()"
- RexxMacro<n+2> Reload cached page from the WWW|"address command 'Run >Nil: Rx Cache.www Load' address()"
- RexxMacro<n+3> Remove page & images from cache|"address command 'Run >Nil: Rx Cache.www Remove' address()"
-
- with <n>,<n+1>,etc the numbers of the arexx macro. For some strange reason
- it is necessary to `Run' this arexx script instead of directly through
- arexx, otherwise AMosaic hangs. Rx must be in the path (i recommend you
- make Rx resident if you use arexx scripts alot).
- The address() function tells the script what Arexx port to use, so you can use
- multiple AMosaic windows. Without it, `AMOSAIC.1' is assumed to be the Arexx port.
-
- Of course DelayImageLoads must be True, otherwise the script will not be
- of much help. You can turn it off again in AMosaic when reading cached
- documents with the options menu.
- Note, that when using AmosaicPrefs long lines can be chopped off, in that
- case use a normal text editor to edit the prefs file. Also the checkbox
- gadget for DelayImageLoads doesn't work as expected: the checkmark is there
- also when DelayImageLoads is false, just check it again by clicking on it.
-
- 5.Run the script every time you want something to happen with the current
- HTML document you are viewing in AMosaic.
- -with inlined images which have not been loaded and aren't on your harddisk
- nothing will happen (download them yourself)
- -inlined images which are on your harddisk will be loaded and will be displayed
- -inlined images which have been downloaded will be saved on harddisk
-
- Normally you would first execute the script to load all images already on your
- harddisk, then manually download the rest of the images you want (or choose
- `Load images in current' from AMosaic's `Options' menu) and then run the script
- again to save the ones you downloaded.
- When you are viewing a remote document and there are images for it on harddisk
- you will automatically view a copy of it (...localhost/T:temphtml... in the URL)
- in which the images are loaded. But all links will still be remote ones!
- At the bottom of the document you will see `This is a temporal page created by
- WWWCache 2.1 © S.Lichtendahl': click on it to email me.
-
- 6.When you want to do the same as 6 but also save the document then choose that
- menu item from the rexx macros. There are a number of differences between this
- feature and the normal save document as HTML feature of AMosaic:
- -All links in the document will still be remote ones (links are normally relative
- to the current document, so they would be relative to your harddisk).
-
- -If you are viewing a local document from the cache directory tree it will
- automatically be saved under the same name. Handy when more inline images have
- been cached, as those image links will then also be saved as local.
- You can reload the original page from the WWW with the Load option (rx Cache.www
- Load) and then maybe save it again with the Save option (rx Cache.www Save).
-
- -If you are viewing a remote document, it's existence in the HTMLlist will be
- checked, and if available the document will be saved under the same name (as
- above). Otherwise the document is saved with the same path as the URL,
- creating extra directorys if necessary.
- -When saving a document for the first time, ALL HTML documents already in the
- directory tree on harddisk will be checked for the URL of the current document
- and replaced with a local URL pointing to the document on harddisk.
- Also, the document title will be added to cachedir/Cache.html with a link to
- the document you saved, so you can simply use that HTML page as a hotlist
- to jump to all your HTML documents in the directory tree.
- -When saving a HTML document all links in the document are checked for existence
- on your harddisk, links to cached documents already in the directory tree
- will be replaced with local ones. (So you see it works both ways).
-
- -You cannot save a document with ...localhost/T:temphtml... in the URL, which is
- a copy of the current document created by Cache.www, you will automatically
- move back to the original document. Same case with the Load option.
-
- -When you try to save a local document not saved with the Cache.www script
- (eg. the HTML documents you had already on your harddisk, or the ones which
- were saved with the Save Document as HTML feature from AMosaic) you will be
- prompted for a URL (the script suggests a reasonable remote URL).
- When using a local URL the links in it will not be of much use, you can see
- this as AMosaic tries the load the inlined images.
- If you enter the original URL for that document, however, all relative links
- will be saved as remote ones with that URL in it, and you will be viewing
- the new document from harddisk. Now you must save that one to check
- for images or links to documents already in then directory tree on harddisk
- and let the script replace the URL's as appropriate.
- You could use this feature to "enhance" you old documents.
-
- 7.You can view the saved document with the `Open Local' menu-item from AMosaic,
- as you would normally do, or `Open Local' the cachedir/Cache.html and click on
- the document you want. Then use the `Load images in current' menu-item to
- load all available images, if you had updated the document after those images
- became available, otherwise just execute the Cache.www script (you could
- always execute the CacheImages script to view all available images, local
- images will be loaded automatically, cached images in a copy of the document).
-
- 8. You can use `rx Cache.www Remove' or the equivalent menu-item to
- delete the current HTML document and/or its images:
- To delete a few inline images, make sure only the ones you want to delete
- are visible (ie. loaded) at the moment.
- To delete the HTML document, make sure no images are loaded, that can be
- deleted (ie. only images that aren't cached are visible).
- If all inline images are loaded and can be deleted, the HTML document will
- be deleted as well (in other cases, just use Remove twice).
- When the HTML document is deleted, it will be reloaded from the WWW as
- with the Load option (because the Load option only works with cached
- documents).
-
- 9. This is how the new `update .mosaic-hotlist-default' feature works:
- Use `rx Cache.www Update' followed by the name of your AMosaic program
- (with path if necessary). When the script finishes, AMosaic will be
- started. What update does, is that it will use the DoHTMLlist to make
- all necessary changes in env(arc):mosaic/.mosaic-hotlist-default.
- For all removed documents, the links will be replaced with the original
- remote ones.
- For new documents, an already existing remote link will be replaced with
- a local one or a new entry will be made in the root of your hotlist.
- You can distinguish a link to a cached document from a remote link by
- the © character in front of the title in the hotlist.
-
- Now you can use AMosaic's hotlist menu (or if you don't have 2.0beta,
- you can use the AMhotlist program) to organize your hotlist better,
- first thing will probably be to get all those links out of the root.
- If you use the update feature every time to start AMosaic, you will make
- sure any changes in cached documents (removed/added) you made the last
- time will be reflected in the hotlist, and any changes you will make
- now will be seen the next time you update & start AMosaic.
-
- Now why didn't i make my script update the hotlist every time you add or
- remove a cached document? Because it wouldn't work.
- AMosaic 2.0beta and AMhotlist load env:mosaic/.mosaic-hotlist-default
- only on startup, so they don't know what changes the script will make
- to it, and when they write env(arc):mosaic/.mosaic-hotlist-default,
- they will write the original file with only the changes they made to it.
- (The same problem you will have when you use AMhotlist and the hotlist
- menu of AMosaic 2.0beta, and change something in one of the programs).
-
- Notes:
- When making use of the update feature, don't delete the Cache.html document,
- it is still needed (and updated) by the script.
-
- When deleting images or HTML documents from the cache directory, all HTML
- documents in the directory tree will be checked for the local URL of the image
- or HTML document you delete and replaced with the original remote one.
- This is the exact opposite of saving a HTML document (see above), but NOT
- of saving an image:
- When saving an image no checks are made, so local documents can still have
- the remote URL of that image. This is not much of a problem, however,
- because when you run the script when viewing a document (local or remote)
- automatically you will be viewing a copy (if necessary of course) in which
- the local images will be loaded. The document links in it, will not
- automatically be replaced with local ones for the HTML documents on your
- harddisk (that would make browsing the WWW for updated documents impossible),
- but when saving a HTML document all its links to HTML documents or images
- already on your harddisk will be replaced by local ones and you will be
- viewing the saved document.
-
- Overwriting an image is only possible when you choose to download it before
- you let the script load it from harddisk.
-
- Forms will also work with saved documents (provided that you have AMosaic 2.0).
- Forms-support in AMosaic 2.0beta works best with MUI 3.1 (less buggy).
-
- All HTML documents, ImageList & HTMLlist cannot exceed 64Kbyte in file size
- each. This is mainly because of the AMosaic <> Arexx interface, but should
- be not much of a problem, i hope.
-
-
- Bugs,comments,suggestions,questions:
-
- Stephan Lichtendahl - Netherlands
-
- Amiga 1200/030/33MHz/MMU/FPU/6MB/385MB/OS3.0 & CD32
-
- Email: s.e.m.lichtendahl@et.tudelft.nl
-
-