From: jwil1@cs.aukuni.ac.nz (TMOTA) Date: 17 Dec 92 01:40:08 GMT This file contains a set of extra scripts for use with the ReadNews newsreader application. In order to get to grips with the script language ReadNews provides, I present some scripts I use regularly with it. Their function is quite varied, and sometimes not specifically related to reading news... it's just that I have found the script interpretor provides a reasonably functional WIMP front-end to a number of command line utilities in my library directory. Each script is separated by a "..== CUT HERE ==.." line. Scripts should be saved as RNScript or Text files and *must* be trimmed so that the #Script command is the first line of each file. It is by this line that ReadNews can tell that the file is a script and not a posting. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * These scripts are Copyright Julian Wright 1992, and FREEWARE. * * You may distribute them by whatever means you like, so long as * * you do not charge for them. They may not be used, in whole or in * * part, in or with any commercial product without my express * * written consent. Under no circumstances will I accept any * * responsibility for any damage these scripts do. This copyright * * message must be distributed with the scripts. If you modify * * them in any way and wish to distribute the modified scripts, * * you must include a comment or note to the effect that they have * * been modified. So there! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ======================= CUT HERE ======================= #Script Newsgroup Cleanup # # ---------------------------------------------------------- # I run this script regularly, after new news/mail has been # incorped. It goes through various newsgroups, weeding out # regular postings and saving them to various directories # under the $.Docs directory on my hard drive. # # The code demonstrated here could be used to produce a # KILL file, simply by not Loading/Saving recognised # articles but instead simply deleting them. # # Although throughout this script I have referred to subject # lines in full, there is no reason not to have used # something like: # #if "%hdr_subject%" RIGHT 11 = "ARM3 vs 486" # to refer to a whole group of articles which I may feel # need 'attention'... :-) Type 'help eval' at the # supervisor prompt for fuller details. # # This script Squashes many of the articles it has saved. If # you do not have RISC OS 3 (and therefore the Squash # application), you can comment out the offending lines, or # replace them with your favourite compression utility. # eg. compress # ---------------------------------------------------------- # # The following line causes ReadNews to quit as soon as it # has processed this script *IF* it wasn't already running # when the script was *Filer_Run or double-clicked on. #AutoQuit # #os Set Docs$Dir adfs::IDEDisc4.$.Docs # #setgroup Email.julian #if %art_count%>0 #setart first #endif # #while (%art_pos%>-1) AND (%art_count%>0) #os seteval delete 0 # #if "%hdr_subject%"="Damned File Listing" #loadart #art_save .NZArchive.FullIndex #task Squash ".NZArchive.FullIndex" #os seteval delete 1 #endif # #if "%hdr_subject%"="Changes effected this upload." #loadart #art_save .NZArchive.Changes # #task Squash ".NZArchive.Changes" #os seteval delete 1 #endif # #if delete #art_delete #else #setart next #endif # #endwhile # #setgroup comp.sys.acorn #if %art_count%>0 #setart first #endif # #while (%art_pos%>-1) AND (%art_count%>0) #os seteval delete 0 # #if "%hdr_subject%"="Acorn ftp and mail-server archives (fortnightly posting)" #loadart #art_save .Services.FTPList #task Squash ".Services.FTPList" #os seteval delete 1 #endif # #if "%hdr_subject%"="Comp.Sys.Acorn FAQ List Posting (Automatic)" #loadart #art_save .faqs.csafaq #task Squash ".faqs.csafaq" #os seteval delete 1 #endif # #if delete #art_delete #else #setart next #endif # #endwhile # #setgroup comp.sys.acorn.announce #if %art_count%>0 #setart first #endif # #while (%art_pos%>-1) AND (%art_count%>0) #os seteval delete 0 # #if "%hdr_subject%"="Additions and/or replacements on the Newcastle Info Server" #loadart #art_save .Services.NCupdate # #task Squash ".Services.NCupdate" #os seteval delete 1 #endif # #if delete #art_delete #else #setart next #endif # #endwhile # #setgroup nz.archives #if %art_count%>0 #setart first #endif # #while (%art_pos%>-1) AND (%art_count%>0) #os seteval delete 0 # #if "%hdr_subject%"="VUW Computer Science Archive Info" #loadart #art_save .Services.VUWInfo #task Squash ".Services.VUWInfo" #os seteval delete 1 #endif # #if "%hdr_subject%"="VUW Computer Science Archive Sample" #loadart #art_save .Services.VUWSample #task Squash ".Services.VUWSample" #os seteval delete 1 #endif # #if "%hdr_subject%"="Recent additions to VUW Computer Science Archive" #loadart #art_save .Services.VUWRecent # #task Squash ".Services.VUWRecent" #os seteval delete 1 #endif # #if delete #art_delete #else #setart next #endif # #endwhile # #setgroup none ======================= CUT HERE ======================= #Script Squash/Unsquash file(s) # # This script provides a front end to the squash utility # provided with RISC OS 3. Unsquashed files will be # squashed, and vice versa. # #Arg Filenames: #Args # #if "%0%"="" #error You must specify at least one file to squash/unsquash! #endif # #repeat #task Squash %0% #Shift #until "%0%"="" ======================= CUT HERE ======================= #Script List New Modules from ftphost # # This script must be run when you are currently viewing # a list of files recently uploaded to one of my local # FTP sites. It searches through the listing for mention # of uploads to the NoiseTracker module directory and # sends what it finds to the currently loaded text editor. # # BTW Each entry in the list is expected to occupy three # lines - filename, original pathname, and comments. # #Width 16 #Menu List type:Verbose\3,Without comments\2,Just names\1 # #Output Edit #os seteval lines %0% #os seteval startline 1 # #if "%article%"="" #error You must have a current article loaded! #endif # #repeat #art_search /Music/NoiseTracker -start -c #if "%found%"<>"" #include %art_file% -start %found% -lines #os seteval startline %found%+2 #endif #until "%found%"="" ======================= CUT HERE ======================= #Script Archive files (v0.03) # # This script provides an easy to use frontend for three popular # CLI archiving utilities (ARC, LHarc, and Tar) which you must have # installed in your current Library directory. In all cases it will # cause a new archive to be created and the specified files to be # added to it. # #Menu Archiver:arc,lharc,tar|compress\tar #Arg Send to: #Width 10 #Arg Archive name: #Width 40,80 #Arg Filenames: #Args # # First, some range checking... # #if "%2%"="" #error You must specify an archive name to create! #endif #if "%3%"="" #error You must specify at least one file to archive! #endif # # Now initialise variables # #os Dir #os set Alias$Archiving %0% m %2% #if ""="" #os set tar$scrap .TarScrap #endif # # If we are tarring, create a blank tarchive now... # #if "%0%"="tar" #task tar cf %2% null: #endif # # Copy all files into temp directory # - If tarring, archive them and delete them as well # as Tar has no MOVE option. # #repeat #os set leaf "" #os set branch "%3%" #while (branch RIGHT 1 <> ".") AND LEN branch > 0 #os seteval leaf (branch RIGHT 1)+leaf #os seteval branch (branch LEFT (LEN branch - 1)) #endwhile #task copy %3% ~cq~v #if "%0%"="tar" #os set Alias$Archiving tar rf %2% #task Archiving #os remove #else #os set Alias$Archiving #endif #Shift 3 #until "%3%"="" # # Archive them all if we are not tarring # #if "%0%"<>"tar" #task Archiving #endif #os unset Alias$Archiving # # Process archive name to make it uniform # - ARC leaves filename unchanged # - LHarc adds "_lzh" to end and truncates to 10 chars # - Tar needs compressing, which truncates name to 8 chars and # appends "-Z" # #os set leaf "%2%" # # LHarc code # #if "%0%"="lharc" #os seteval leaf (leaf + "_lzh") LEFT 10 #endif # # Set the type of the file to Archive (strange!) # #os SetType DDC # # Tar code # #if "%0%"="tar" #os seteval newleaf leaf LEFT 8 #os rename #os set leaf #os set Alias$Compressing compress #task Compressing #os unset Alias$Compressing #os seteval leaf (newleaf + "-Z") LEFT 10 #os SetType FFD #endif # # If an email address was not given, open the temp directory. # Otherwise UUencode and email the file, deleting it afterwards. # #if "%1%"="" #os Filer_OpenDir #else #Output post To: %1% Subject: uuencoded %0% archive within The following is a uuencoded archive, created with %0%. Trim out everything before the first 'cut here' line and feed to a uudecoder/archive utility (eg Spark). Original archive name: %2% BEGIN---------- Cut Here ---------- #os set Alias$UUencoding uue #task UUencoding #os Unset Alias$UUencoding #os remove #os seteval leaf leaf LEFT 6 #include _uue #os remove _uue END------------ Cut Here ---------- #endif # # Leave everything the way we found it! # #os unset leaf #os Unset newleaf #os unset branch #os Back ======================= CUT HERE =======================