home *** CD-ROM | disk | FTP | other *** search
/ BMUG PD-ROM 1995 Fall / PD-ROM F95.toast / Programming / Programming Utilities / MPW Extras ƒ / Scripts / NewTarget < prev    next >
Encoding:
Text File  |  1991-07-29  |  956 b   |  27 lines  |  [TEXT/ttxt]

  1. # NewTarget - replacement "Target" script supporting file backup and remember
  2.  
  3. If ({#} == 1)
  4.     # correct number of command line arguments
  5.     Target "{1}" ∑∑ Dev:Null                                            # invoke the standard open
  6.     Set TargetStatus {Status}
  7.     If ({TargetStatus} == 0)
  8.         # the Target was successful - perform the Backup and Remember chores
  9.         ReadOnlyStatus "{1}" ∑∑ Dev:Null                                # test if this is a read-only file
  10.         If ({Status} == 0)
  11.             Set LeafName "`ParseFileName -l "{1}"`"                        # get the file's leafname
  12.             Duplicate -y "{1}" "{Backup}" ∑∑ "{Worksheet}" || Beep        # create the backup file
  13.  
  14.             # Delete all the old "Remember" backup files
  15.             For i in `Begin; Files -f "{Backup}{LeafName}".[0-9]+; End ≥ Dev:Null`
  16.                 Delete "{i}"
  17.             End  # For i
  18.         End  # If {Status}
  19.     Else
  20.         # an error occured
  21.         Alert "{0}:∂nUnable to make file {1} the target."
  22.     End  # If {OpenStatus}
  23. Else
  24.     Alert "{0}:∂n{Parameters} is not a valid target window."
  25. End  # If {#}
  26.  
  27. # end of NewTarget