&comment ******************************************************************* &comment *** DOWNLOAD script: downloads an item from the current Desk *** &comment *** area to the PC. Initially supports only text files and *** &comment *** Reflection. Syntax: *** &comment *** DOWNLOAD hpdesk-item *** &comment *** where "hpdesk-item" can be an item number, a subject inside *** &comment *** quotation marks, or IT (it uses the REFNUM directive to *** &comment *** interpret the item). The user must have file save ability *** &comment *** in the current group for this to work as a temporary file *** &comment *** is used for the download. *** &comment *** *** &comment *** Author: Jeff Kell jeff_kell/admin@hpdesk.utc.edu *** &comment *** Administrative Computing Services, 117 Hunter Hall *** &comment *** University of Tennessee at Chattanooga *** &comment *** Chattanooga, TN 37403 (615)-744-4551 *** &comment *** *** &comment *** 05/06/93: Initial release. *** &comment ******************************************************************* &comment Check to see at least a parameter is present &forward showhelp > &comment See if we have a valid HPDesk item &save deskitem $getitem &save deskitemno > &forward 4 >> &print The specified desk item is invalid. &exit &comment Save the item type &save dtype > &comment Is it a message? &forward openit -100> &comment Is it a folder? &forward openit -101> &comment Is it a package? &forward openit -102> &comment Is it a reply? &forward openit -300> &comment It should be a valid item then... go get it. &forward getit $openit &print You cannot download an entire >, OPENing instead... open &save deskitem &back getitem $getit &comment Clear out a user-specific temp file &forward 2 )>> :purge zz &Print Preparing to download ... copy to (zz) &comment Setup escape sequence to execute a Reflection RECEIVE command %&comment "&save refgo &oCRECEIVE {} FROM ZZ DELETE" works &save refgo &oCRECEIVE {} FROM ZZ &comment Check to see if it is a PC-file, in which case make it BINARY &forward 2 1269>> &save refgo BINARY &save refgo &comment Send escape sequence as a prompt for a read. Note that we will *not* &comment get the F/S return code as expected -- we get the host startup string &save result > "F"> &forward oops > "F"> &comment A few checks to be sure someone's not trying any foolishness &forward oops > &forward oops > "RUN">> &save progname >> &save x ";"> &forward 3 0> &save x 1> &save progname 1 > &forward 3 "PCLINK.PUB.SYS"> &forward 2 "PCLINK2.PUB.SYS"> &forward oops :xeq &comment And *NOW* we read the return code of the download &save result &forward oops > "F"> :purge zz &exit $oops &print *** Download FAILED *** :purge zz &exit $showhelp &print DOWNLOAD will download an item in the current area to your PC. You will &print be given a file dialog box to specify the filename and it's location. &print &print Syntax: DOWNLOAD hpdesk-item &print &print The "hpdesk-item" can be the number of an item in the current area, or &print the subject of an item in the current area, similar to COPY parameters.