home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Windoware
/
WINDOWARE_1_6.iso
/
winutil
/
wspcr20
/
wsdelete.wbt
< prev
next >
Wrap
Text File
|
1991-09-27
|
3KB
|
89 lines
; --- WSDELETE.WBT is the file needed to delete ALL or selected spaces.
; WorkSpacer 2.0 ⌐ 1991 - WiGuys Software
; --- if there is nothing in the library, exit
Call ( "wsglobal.wbt", "" )
deleted = 0
If FileSize ( spacelib ) == 0 Then GoTo Nada
DialogBox ( wsver, "wsdelete.wbd" )
If del == 2 Then GoTo DelAll
; --- for single workspace deletions, get the workspace name from the list
:Start
grpname = TextBox ( "%wsver% Delete", spacelib )
If StrICmp ( grpname, nul ) == 0 Then GoTo Start
q = AskYesNo ( wsver, "OK to delete the WorkSpace : %tf% %grpname% ?" )
IF q == @NO Then GoTo Start
; --- rename the "old" library, and set it up to read from, with a "new"
; library file to write the data being retained to
FileRename ( spacelib, spacebak )
fHandle1 = FileOpen ( spacebak, "READ" )
fHandle2 = FileOpen ( spacelib, "WRITE" )
; --- read each line of the "old" library - if it is not the workspace to be
; deleted, write the name to the "new" file
:ReadNext
count = 1
line = FileRead ( fHandle1 )
If StrICmp ( line, grpname ) == 0 Then GoTo ReadNext
If line == "*EOF*" Then GoTo CloseFile
FileWrite ( fHandle2, line )
; --- Read the information from the INI file, and write it to a "temp" INI
; for those workspaces not to be deleted
:IniLines
key1 = "App%count%"
key2 = "Status%count%"
key3 = "Load%count%"
key4 = "Pos%count%"
key5 = "Win%count%"
filename = IniReadPvt ( line, key1, nul, "wspacer.ini" )
If StrICmp ( filename, nul ) == 0 Then GoTo ReadNext
IniWritePvt (line, key1, filename, "wspacer2.ini" )
status = IniReadPvt ( line, key2, "Normal", "wspacer.ini" )
IniWritePvt ( line, key2, status, "wspacer2.ini" )
loadname = IniReadPvt ( line, key3, nul, "wspacer.ini" )
IniWritePvt ( line, key3, loadname, "wspacer2.ini" )
currpos = IniReadPvt ( line, key4, nul, "wspacer.ini" )
IniWritePvt ( line, key4, currpos, "wspacer2.ini" )
currwind = IniReadPvt ( line, key5, nul, "wspacer.ini" )
IniWritePvt ( line, key5, currwind, "wspacer2.ini" )
count = count + 1
GoTo IniLines
; --- close all open files, and clean up any "old" files left behind, then
; check to see if the user wants to delete additional workspaces
:CloseFile
FileClose ( fHandle1 )
FileClose ( fHandle2 )
FileDelete ( spacebak )
FileDelete ( spaceini )
If FileSize ( spacelib ) == 0 Then GoTo Fini
FileRename ( inibak, spaceini )
deleted = deleted + 1
q = AskYesNo ( wsver, "%grpname% has been deleted. %tf% Delete another WorkSpace?" )
If q == @YES Then GoTo Start
Message ( wsver, "%deleted% WorkSpace(s) have been deleted." )
Return
:Nada
Message ( wsver, " There are no WorkSpaces to delete." )
Return
:DelAll
q = AskYesNo ( wsver, "Delete ALL WorkSpace records ?" )
If q == @NO Then Return
FileDelete ( spacelib )
FileDelete ( spaceini )
:Fini
Message ( wsver, "All workspaces have been deleted!" )
Return