home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / sources / acorn / 56 next >
Encoding:
Text File  |  1992-12-17  |  10.2 KB  |  388 lines

  1. Path: sparky!uunet!comp.vuw.ac.nz!waikato.ac.nz!aukuni.ac.nz!cs18.cs.aukuni.ac.nz!jwil1
  2. Newsgroups: comp.sources.acorn
  3. Subject: Source [ReadNews script]: More scripts for !ReadNews
  4. Message-ID: <1992Dec17.014008.7278@cs.aukuni.ac.nz>
  5. From: jwil1@cs.aukuni.ac.nz (TMOTA)
  6. Date: Thu, 17 Dec 1992 01:40:08 GMT
  7. Sender: jwil1@cs.aukuni.ac.nz (TMOTA)
  8. Organization: Computer Science Dept. University of Auckland
  9. Approved: cba@acorn.co.nz
  10. Lines: 376
  11.  
  12.  
  13. This posting contains a set of extra scripts for use with the
  14. ReadNews newsreader application which was posted a short while (?)
  15. back... If you don't have/use ReadNews, then these scripts are
  16. probably of little use to you.
  17.  
  18. Julian Wright (the author) says:
  19.  
  20. In order to get to grips with the script language ReadNews
  21. provides, I present some scripts I use regularly with it. Their
  22. function is quite varied, and sometimes not specifically related
  23. to reading news... it's just that I have found the script
  24. interpretor provides a reasonably functional WIMP front-end to
  25. a number of command line utilities in my library directory.
  26.  
  27. Each script is separated by a "..== CUT HERE ==.." line. Scripts
  28. should be saved as RNScript or Text files and *must* be
  29. trimmed so that the #Script command is the first line of each
  30. file. It is by this line that ReadNews can tell that the file
  31. is a script and not a posting.
  32.  
  33.  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  34. * These scripts are Copyright Julian Wright 1992, and FREEWARE.     *
  35. * You may distribute them by whatever means you like, so long as    *
  36. * you do not charge for them. They may not be used, in whole or in  *
  37. * part, in or with any commercial product without my express        *
  38. * written consent. Under no circumstances will I accept any         *
  39. * responsibility for any damage these scripts do. This copyright    *
  40. * message must be distributed with the scripts. If you modify       *
  41. * them in any way and wish to distribute the modified scripts,      *
  42. * you must include a comment or note to the effect that they have   *
  43. * been modified. So there!                                          *
  44.  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  45.  
  46. ======================= CUT HERE =======================
  47. #Script Newsgroup Cleanup
  48. #
  49. # ----------------------------------------------------------
  50. # I run this script regularly, after new news/mail has been
  51. # incorped. It goes through various newsgroups, weeding out
  52. # regular postings and saving them to various directories
  53. # under the $.Docs directory on my hard drive.
  54. #
  55. # The code demonstrated here could be used to produce a
  56. # KILL file, simply by not Loading/Saving recognised
  57. #  articles but instead simply deleting them.
  58. #
  59. # Although throughout this script I have referred to subject
  60. # lines in full, there is no reason not to have used
  61. # something like:
  62. # #if "%hdr_subject%" RIGHT 11 = "ARM3 vs 486"
  63. # to refer to a whole group of articles which I may feel
  64. # need 'attention'... :-) Type 'help eval' at the
  65. # supervisor prompt for fuller details.
  66. #
  67. # This script Squashes many of the articles it has saved. If
  68. # you do not have RISC OS 3 (and therefore the Squash
  69. # application), you can comment out the offending lines, or
  70. # replace them with your favourite compression utility.
  71. # eg. compress
  72. # ----------------------------------------------------------
  73. #
  74. # The following line causes ReadNews to quit as soon as it
  75. # has processed this script *IF* it wasn't already running
  76. # when the script was *Filer_Run or double-clicked on.
  77. #AutoQuit
  78. #
  79. #os Set Docs$Dir adfs::IDEDisc4.$.Docs
  80. #
  81. #setgroup Email.julian
  82. #if %art_count%>0
  83. #setart first
  84. #endif
  85. #
  86. #while (%art_pos%>-1) AND (%art_count%>0)
  87. #os seteval delete 0
  88. #
  89. #if "%hdr_subject%"="Damned File Listing"
  90. #loadart
  91. #art_save <Docs$Dir>.NZArchive.FullIndex
  92. #task Squash "<Docs$Dir>.NZArchive.FullIndex"
  93. #os seteval delete 1
  94. #endif
  95. #
  96. #if "%hdr_subject%"="Changes effected this upload."
  97. #loadart
  98. #art_save <Docs$Dir>.NZArchive.Changes
  99. # #task Squash "<Docs$Dir>.NZArchive.Changes"
  100. #os seteval delete 1
  101. #endif
  102. #
  103. #if delete
  104. #art_delete
  105. #else
  106. #setart next
  107. #endif
  108. #
  109. #endwhile
  110. #
  111. #setgroup comp.sys.acorn
  112. #if %art_count%>0
  113. #setart first
  114. #endif
  115. #
  116. #while (%art_pos%>-1) AND (%art_count%>0)
  117. #os seteval delete 0
  118. #
  119. #if "%hdr_subject%"="Acorn ftp and mail-server archives (fortnightly posting)"
  120. #loadart
  121. #art_save <Docs$Dir>.Services.FTPList
  122. #task Squash "<Docs$Dir>.Services.FTPList"
  123. #os seteval delete 1
  124. #endif
  125. #
  126. #if "%hdr_subject%"="Comp.Sys.Acorn FAQ List Posting (Automatic)"
  127. #loadart
  128. #art_save <Docs$Dir>.faqs.csafaq
  129. #task Squash "<Docs$Dir>.faqs.csafaq"
  130. #os seteval delete 1
  131. #endif
  132. #
  133. #if delete
  134. #art_delete
  135. #else
  136. #setart next
  137. #endif
  138. #
  139. #endwhile
  140. #
  141. #setgroup comp.sys.acorn.announce
  142. #if %art_count%>0
  143. #setart first
  144. #endif
  145. #
  146. #while (%art_pos%>-1) AND (%art_count%>0)
  147. #os seteval delete 0
  148. #
  149. #if "%hdr_subject%"="Additions and/or replacements on the Newcastle Info Server"
  150. #loadart
  151. #art_save <Docs$Dir>.Services.NCupdate
  152. # #task Squash "<Docs$Dir>.Services.NCupdate"
  153. #os seteval delete 1
  154. #endif
  155. #
  156. #if delete
  157. #art_delete
  158. #else
  159. #setart next
  160. #endif
  161. #
  162. #endwhile
  163. #
  164. #setgroup nz.archives
  165. #if %art_count%>0
  166. #setart first
  167. #endif
  168. #
  169. #while (%art_pos%>-1) AND (%art_count%>0)
  170. #os seteval delete 0
  171. #
  172. #if "%hdr_subject%"="VUW Computer Science Archive Info"
  173. #loadart
  174. #art_save <Docs$Dir>.Services.VUWInfo
  175. #task Squash "<Docs$Dir>.Services.VUWInfo"
  176. #os seteval delete 1
  177. #endif
  178. #
  179. #if "%hdr_subject%"="VUW Computer Science Archive Sample"
  180. #loadart
  181. #art_save <Docs$Dir>.Services.VUWSample
  182. #task Squash "<Docs$Dir>.Services.VUWSample"
  183. #os seteval delete 1
  184. #endif
  185. #
  186. #if "%hdr_subject%"="Recent additions to VUW Computer Science Archive"
  187. #loadart
  188. #art_save <Docs$Dir>.Services.VUWRecent
  189. # #task Squash "<Docs$Dir>.Services.VUWRecent"
  190. #os seteval delete 1
  191. #endif
  192. #
  193. #if delete
  194. #art_delete
  195. #else
  196. #setart next
  197. #endif
  198. #
  199. #endwhile
  200. #
  201. #setgroup none
  202. ======================= CUT HERE =======================
  203. #Script Squash/Unsquash file(s)
  204. #
  205. # This script provides a front end to the squash utility
  206. # provided with RISC OS 3. Unsquashed files will be
  207. # squashed, and vice versa.
  208. #
  209. #Arg Filenames:
  210. #Args
  211. #
  212. #if "%0%"=""
  213. #error You must specify at least one file to squash/unsquash!
  214. #endif
  215. #
  216. #repeat
  217. #task Squash %0%
  218. #Shift
  219. #until "%0%"=""
  220. ======================= CUT HERE =======================
  221. #Script List New Modules from ftphost
  222. #
  223. # This script must be run when you are currently viewing
  224. # a list of files recently uploaded to one of my local
  225. # FTP sites. It searches through the listing for mention
  226. # of uploads to the NoiseTracker module directory and
  227. # sends what it finds to the currently loaded text editor.
  228. #
  229. # BTW Each entry in the list is expected to occupy three
  230. # lines - filename, original pathname, and comments.
  231. #
  232. #Width 16
  233. #Menu List type:Verbose\3,Without comments\2,Just names\1
  234. #
  235. #Output Edit
  236. #os seteval lines %0%
  237. #os seteval startline 1
  238. #
  239. #if "%article%"=""
  240. #error You must have a current article loaded!
  241. #endif
  242. #
  243. #repeat
  244. #art_search /Music/NoiseTracker -start <startline> -c
  245. #if "%found%"<>""
  246. #include %art_file% -start %found% -lines <lines>
  247. #os seteval startline %found%+2
  248. #endif
  249. #until "%found%"=""
  250. ======================= CUT HERE =======================
  251. #Script Archive files (v0.03)
  252. #
  253. # This script provides an easy to use frontend for three popular
  254. # CLI archiving utilities (ARC, LHarc, and Tar) which you must have
  255. # installed in your current Library directory. In all cases it will
  256. # cause a new archive to be created and the specified files to be
  257. # added to it.
  258. #
  259. #Menu Archiver:arc,lharc,tar|compress\tar
  260. #Arg Send to:
  261. #Width 10
  262. #Arg Archive name:
  263. #Width 40,80
  264. #Arg Filenames:
  265. #Args
  266. #
  267. # First, some range checking...
  268. #
  269. #if "%2%"=""
  270. #error You must specify an archive name to create!
  271. #endif
  272. #if "%3%"=""
  273. #error You must specify at least one file to archive!
  274. #endif
  275. #
  276. # Now initialise variables
  277. #
  278. #os Dir <ReadNews$TempDir>
  279. #os set Alias$Archiving %0% m %2%
  280. #if "<tar$scrap>"=""
  281. #os set tar$scrap <ReadNews$TempDir>.TarScrap
  282. #endif
  283. #
  284. # If we are tarring, create a blank tarchive now...
  285. #
  286. #if "%0%"="tar"
  287. #task tar cf %2% null:
  288. #endif
  289. #
  290. # Copy all files into temp directory
  291. #   - If tarring, archive them and delete them as well
  292. #     as Tar has no MOVE option.
  293. #
  294. #repeat
  295. #os set leaf ""
  296. #os set branch "%3%"
  297. #while (branch RIGHT 1 <> ".") AND LEN branch > 0
  298. #os seteval leaf (branch RIGHT 1)+leaf
  299. #os seteval branch (branch LEFT (LEN branch - 1))
  300. #endwhile
  301. #task copy %3% <leaf> ~cq~v
  302. #if "%0%"="tar"
  303. #os set Alias$Archiving tar rf %2% <leaf>
  304. #task Archiving
  305. #os remove <leaf>
  306. #else
  307. #os set Alias$Archiving <Alias$Archiving> <leaf>
  308. #endif
  309. #Shift 3
  310. #until "%3%"=""
  311. #
  312. # Archive them all if we are not tarring
  313. #
  314. #if "%0%"<>"tar"
  315. #task Archiving
  316. #endif
  317. #os unset Alias$Archiving
  318. #
  319. # Process archive name to make it uniform
  320. #  - ARC leaves filename unchanged
  321. #  - LHarc adds "_lzh" to end and truncates to 10 chars
  322. #  - Tar needs compressing, which truncates name to 8 chars and
  323. #    appends "-Z"
  324. #
  325. #os set leaf "%2%"
  326. #
  327. # LHarc code
  328. #
  329. #if "%0%"="lharc"
  330. #os seteval leaf (leaf + "_lzh") LEFT 10
  331. #endif
  332. #
  333. # Set the type of the file to Archive (strange!)
  334. #
  335. #os SetType <leaf> DDC
  336. #
  337. # Tar code
  338. #
  339. #if "%0%"="tar"
  340. #os seteval newleaf leaf LEFT 8
  341. #os rename <leaf> <newleaf>
  342. #os set leaf <newleaf>
  343. #os set Alias$Compressing compress <newleaf>
  344. #task Compressing
  345. #os unset Alias$Compressing
  346. #os seteval leaf (newleaf + "-Z") LEFT 10
  347. #os SetType <leaf> FFD
  348. #endif
  349. #
  350. # If an email address was not given, open the temp directory.
  351. # Otherwise UUencode and email the file, deleting it afterwards.
  352. #
  353. #if "%1%"=""
  354. #os Filer_OpenDir <ReadNews$TempDir>
  355. #else
  356. #Output post
  357. To: %1%
  358. Subject: uuencoded %0% archive within
  359.  
  360. The following is a uuencoded archive, created with %0%.
  361. Trim out everything before the first 'cut here' line and feed
  362. to a uudecoder/archive utility (eg Spark).
  363.  
  364. Original archive name: %2%
  365.  
  366. BEGIN---------- Cut Here ----------
  367. #os set Alias$UUencoding uue <leaf>
  368. #task UUencoding
  369. #os Unset Alias$UUencoding
  370. #os remove <leaf>
  371. #os seteval leaf leaf LEFT 6
  372. #include <leaf>_uue
  373. #os remove <leaf>_uue
  374. END------------ Cut Here ----------
  375. #endif
  376. #
  377. # Leave everything the way we found it!
  378. #
  379. #os unset leaf
  380. #os Unset newleaf
  381. #os unset branch
  382. #os Back
  383. ======================= CUT HERE =======================
  384. -- 
  385. _________________  "I'd like to answer this question in two ways:
  386.   /____ _ _/_ __       First in my normal voice, and then
  387.  // / //_//_ /_/       in a silly, high-pitched whine." (Monty Python)
  388.