home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Windoware
/
WINDOWARE_1_6.iso
/
winutil
/
wspcr20
/
wsmake.wbt
< prev
next >
Wrap
Text File
|
1991-09-27
|
6KB
|
179 lines
; --- WSMAKE.WBT - an NDW Batch Builder file that creates WorkSpaces.
; WorkSpacer 2.0 ⌐ 1991 - WiGuys Software
Call ( "wsglobal.wbt", "" )
msg = StrCat ( "To create a WorkSpace :", tf, "1) Load and position all applications" )
msg = StrCat ( msg, lf, "2) Then run WorkSpacer.", tf, "Proceed with WorkSpacer?" )
q = AskYesNo ( wsver, msg )
If q == @NO Then Exit
; --- Check to see it the user wants to create a new workspace or replace an
; existing one
If FileSize ( spacelib ) == 0 Then GoTo SpaceName
grpname = TextBox ("%wsver% WorkSpace Listing", spacelib )
If StrICmp ( grpname, nul ) == 0 Then GoTo SpaceName
:AskReplace
replace = AskYesNo ( wsver, "%grpname% exists. %tf% Replace it?" )
If replace == @YES Then GoTo WindName
; --- If a new workspace is wanted, get the name and double check to
; ensure that it isn't a duplicate name
:SpaceName
grpname = AskLine ( wsver, "WorkSpace name? (Maximum - 30 characters)", "" )
If StrLen ( grpname) == 0 || StrLen ( grpname ) > 30 Then GoTo SpaceName
If FileSize ( spacelib ) == 0 Then GoTo WindName
fHandle = FileOpen ( spacelib, "READ" )
:TestLoop
line = FileRead ( fHandle )
If line == "*EOF*" Then GoTo WindName
If !StrICmp ( line, grpname ) == 0 Then GoTo TestLoop
FileClose ( fHandle )
GoTo AskReplace
; --- Select the window for the application, and get all of the appropriate
; data for that window. Then check to see if the current window will
; "cover" existing ones. If so, ask if that's OK.
:WindName
Status = "Normal"
currwind = ItemSelect ( "%wsver% Window Selection", allwin, hortab )
If StrICmp ( currwind, nul ) == 0 Then GoTo WindName
currpos = WinPosition ( currwind )
If count == 1 Then GoTo Continue
tcount = 1
ParseData ( StrReplace ( currpos, ",", " " ) )
axulc = Param1
ayulc = Param2
axbrc = Param3
aybrc = Param4
:DupePos
tkey = "Pos%tcount%"
tline = IniReadPvt (grpname, tkey, nul, "wspacer.ini")
ParseData ( StrReplace ( tline, ",", " " ) )
If axulc < (Param1 + pix) && ayulc < (Param2 + pix) && axbrc > (Param3- pix) && aybrc > (Param4 - pix) Then GoTo Covers
:GoAhead
tcount = tcount + 1
If !tcount == count Then GoTo DupePos
; --- Since the window title in the final workspace may not match the
; current one, parse the title so that we can get just the basic
; window name, without any file information ( - (untitled), etc)
:Continue
tindex = 0
sindex = 0
:DelimIndex
tindex = StrScan ( currwind, " ", tindex + 1, @FWDSCAN )
If tindex == 0 Then GoTo NextStep
sindex = tindex - 1
tsub = StrSub ( currwind, tindex +1, 1 )
If !StrICmp ( tsub, "(" ) == 0 && !StrICmp ( tsub, "-" ) == 0 Then GoTo DelimIndex
If tindex > 0 Then currwind = StrSub ( currwind, 1, sindex )
; --- Using browse-type dialog boxes, get the application executable, and any
; options (iconized, files to load, etc.)
:NextStep
loadname = nul
filename = nul
wbdfile = "wsfile1.wbd"
filevar = "Application"
:GetFile
icon = 0
load = 1
DirChange ( "c:\" )
If StrICmp ( filevar, "Application" ) == 0 Then gFile = "*.exe"
:FileLoop
DialogBox ( "%wsver% %filevar% File Information", wbdfile )
If StrICmp ( gFile, nul ) == 0 Then GoTo FileLoop
dir = DirGet ()
checkfile = StrCat ( dir, gFile )
PathTrue = FileLocate ( checkfile )
If StrICmp ( PathTrue, nul ) == 0 Then GoTo FileLoop
If icon == 1 Then Status = "Icon"
If StrICmp ( filevar, "Application" ) == 0 Then filename = checkfile
If StrICmp ( filevar, "Load" ) == 0 Then loadname = checkfile
If Load != 2 Then GoTo NoMoreFiles
filevar = "Load"
wbdfile = "wsfile2.wbd"
GoTo GetFile
; --- If this is the first app in the space, add the workspace name to the
; library. If not, go ahead and write the app data to the ini file
:NoMoreFiles
If load == 3 Then loadname = "?"
If count != 1 || replace == @YES Then GoTo WriteIni
FileRename ( spacelib, spacebak )
fHandle1 = FileOpen ( spacebak, "READ" )
fHandle2 = FileOpen ( spacelib, "WRITE" )
newline = grpname
:GroupLoop
line = FileRead ( fHandle1 )
If line == "*EOF*" Then GoTo EndGroup
If StrICmp ( newline, line ) == 1 Then GoTo WriteLine
nextline = line
line = newline
newline = nextline
:WriteLine
FileWrite ( fHandle2, line )
GoTo GroupLoop
:EndGroup
FileClose ( fHandle1 )
FileWrite ( fHandle2, newline )
FileClose ( fHandle2 )
FileDelete ( spacebak )
:WriteIni
key1 = "App%count%"
key2 = "Status%count%"
key3 = "Load%count%"
key4 = "Pos%count%"
key5 = "Win%count%"
IniWritePvt ( grpname, key1, filename, "wspacer.ini" )
IniWritePvt ( grpname, key2, status, "wspacer.ini" )
IniWritePvt ( grpname, key3, loadname, "wspacer.ini" )
IniWritePvt ( grpname, key4, currpos, "wspacer.ini" )
IniWritePvt ( grpname, key5, currwind, "wspacer.ini" )
q = AskYesNo ( wsver, "Add another application?" )
If q == @NO Then GoTo EndWBT
count = count + 1
GoTo WindName
; --- when finished everything, if the space is new, exit. If it is a
; replacement of an existing space, make sure that any old data
; remaining does not get read into the new space.
:EndWBT
If replace == @NO Then GoTo Done
ncount = count + 1
key1 = "App%ncount%"
line = IniReadPvt ( grpname, key1, nul, "wspacer.ini" )
If StrICmp ( line, nul ) == 0 Then GoTo Done
IniWritePvt ( grpname, key1, nul, "wspacer.ini" )
:Done
Message ( wsver, "Your workspace (%count% applications) has been created")
Return
:Covers
q = AskYesNo ( wsver, "This window hides one already in the WorkSpace! %tf% Is that OK?" )
If q == @YES Then GoTo GoAhead
q = AskYesNo ( wsver, " Choose another application?")
If q == @YES Then GoTo WindName
count = count - 1
GoTo EndWBT