home *** CD-ROM | disk | FTP | other *** search
- $VER: Cache.www 1.4 (28.9.95) 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)
- -requestfile for saving HTML documents (part of OS2/OS3 ?)
- -getstring for saving local documents (see below)
- -Pentium processor & 16MB ram for full 32bit multitasking, or an Amiga
-
- Installation / Usage:
- 1. Copy the Cache.www Arexx script to rexx: or somewhere else, as
- long as it's in your path.
-
- 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 below).
- It initially only contains some empty directory's (Images & HTMLs)
- and some empty files (ImageList & HTMLlist) and a file (NrOfImage)
- which contains only one number (0), also there is a Cache.html
- document which will be updated with all HTML documents you save.
- The images and HTMLs that are saved will be saved in the appropriate
- directory and will be noted in the appropriate ..list file.
- As the images will be saved with only a number as filename the file
- NrOfImage will always contain the last number used. Never change it!
-
- 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 must not contain spaces or quotes " and must end
- with a / or : character. You must put ' 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.
-
- 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'"
- RexxMacro<n+1> Same as above & save this page |"address command 'Run >Nil: Rx Cache.www Save'"
- RexxMacro<n+2> Reload cached page from the WWW|"address command 'Run >Nil: Rx Cache.www Load'"
- RexxMacro<n+3> Remove page & images from cache|"address command 'Run >Nil: Rx Cache.www Remove'"
-
- 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).
- 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!
-
- 6.When you want to do the same as 5 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/HTMLs directory 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 a requester will ask you to give a filename, only filenames
- in the cache/HTMLs directory are accepted, which don't exist already.
- -When saving a document for the first time, ALL HTML documents already in the
- cachedir/HTMLs directory 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 cachedir/HTMLs.
- -When saving a HTML document all links in the document are checked for existence
- on your harddisk, links to documents already in the cachedir/HTMLs directory
- 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 in the cachedir/HTMLs directory
- (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 (you need getstring for this). If you don't change the URL
- given, the URL saved for that document will not be of much use and all relative
- links in the document will be absolute(ly) useless, as noted above.
- You can see this, as AMosaic tries to load all images in the document.
- 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 in cachedir/HTMLs. Now you must save that one to check
- for images already in cachedir/Images or links to documents already in
- cachedir/HTMLs 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 delete all images, HTML documents, reset ImageList, NrOfImage,
- HTMLlist and Cache.html with the following command:
- `rx Cache.www Image All HTML All' (this will always create all neccessary
- files in cachedir, but NOT the necessary directorys).
- You can delete a specific image with `rx Cache.www Image <image>' with
- <image> the number of the image or the complete URL of the original
- image. ImageList will be updated.
- You can delete a specific HTML document with `rx Cache.www HTML <html>'
- with <html> the local filename (without the path) or the complete URL
- of the original document. HTMLlist and Cache.html will be updated.
- You can also use `rx Cache.www Remove` or the equivalent menu-item to
- delete the current HTML document and all its images, that is to say, the
- ones that are visible (ie. loaded) at the moment (so use Flush Image Cache
- from the AMosaic menu first, if you only want to delete the document).
-
- Notes:
- When deleting images or HTML documents from the cache directory, all HTML
- documents in cachedir/HTMLs 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).
- In my experience forms-support in AMosaic 2.0beta is very 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: stephan@stephan.et.tudelft.nl
-
-