home *** CD-ROM | disk | FTP | other *** search
Text File | 1991-07-29 | 2.5 KB | 80 lines | [TEXT/ttxt] |
- # NewClose - replacement "Close" script supporting file backup and remember
-
- Set NFile "{#}" # get number of command line arguments
- If ({NFile} == 0)
- # no command line arguments - act on active window
- Set LeafName "`ParseFileName -l "{Active}"`" # get the file's leafname
- Close "{Active}" ∑∑ Dev:Null
- If ({Status} == 0)
- # the Close was successful
- Set RemFiles "`Begin; Files -f "{Backup}{LeafName}".[0-9]+; End ≥ Dev:Null`"
- If ("{RemFiles}" != "")
- # Remember Files exist
- Set Exit 0
- Confirm "Delete the old Remember files?"
- If ({Status} == 0)
- # Delete all the old "Remember" backup files
- For i in "{RemFiles}"
- Delete {i}
- End # For i
- End # If {Status}
- End # If RemFiles
- End # If {Status}
- Else
- Loop
- Break If ({NFile} <= 0) # exit if all arguments have been processed
- If ("{1}" == "-a")
- # Close all windows option
- For i in "`Windows -q`"
- Set LeafName "`ParseFileName -l "{i}"`" # get the file's leafname
- Close "{i}" ∑∑ Dev:Null
- If ({Status} == 0)
- # the Close was successful
- Set RemFiles "`Begin; Files -f "{Backup}{LeafName}".[0-9]+; End ≥ Dev:Null`"
- If ("{RemFiles}" != "")
- # Remember Files exist
- Set Exit 0
- Confirm "Delete the old Remember files?"
- If ({Status} == 0)
- # Delete all the old "Remember" backup files
- For j in "{RemFiles}"
- Delete {j}
- End # For j
- End # If {Status}
- End # If RemFiles
- End # If {Status}
- End # For i
- Else
- If (("{1}" == "-C") || ("{1}" == "-n") || ("{1}" == "-y"))
- Set CloseOption "{1}"
- Set NShift 2
- Set LeafName "`ParseFileName -l "{2}"`" # get the file's leafname
- Close "{1}" "{2}" ∑∑ Dev:Null
- Else
- Set CloseOption ""
- Set NShift 1
- Set LeafName "`ParseFileName -l "{1}"`" # get the file's leafname
- Close "{1}" ∑∑ Dev:Null
- End # If {1}
- If ({Status} == 0)
- # the Close was successful
- Set RemFiles "`Begin; Files -f "{Backup}{LeafName}".[0-9]+; End ≥ Dev:Null`"
- If ("{RemFiles}" != "")
- # Remember Files exist
- Set Exit 0
- Confirm "Delete the old Remember files?"
- If ({Status} == 0)
- # Delete all the old "Remember" backup files
- For i in "{RemFiles}"
- Delete {i}
- End # For i
- End # If {Status}
- End # If RemFiles
- End # If {Status}
- Shift {NShift}
- Evaluate NFile -= {NShift} # update the argument counter
- End # If {1}
- End # Loop
- End # If {NFile}
-
- # end of NewClose