import GUI
var driveChooseWin : int := Window.Open ("graphics:850;300,nobuttonbar,position:center;truemiddle,title:Choose the Drive")
var stream : int
var files:array 1..5000 of string
var continue : int := 0
Window.SetActive (driveChooseWin)
GUI.SetBackgroundColour (black)
locate (1, 1)
Text.Colour (white)
Text.ColourBack (black)
put "Choose the drive and Folders. Select one only"
put "(one chance to select), "
put "or else an unresolved error will"
put "occur."
Text.Colour (black)
Text.ColourBack (white)
proc setContinue
continue := 1
end setContinue
var fileToOpen : string
var drive : string
var listing : int
var dirToOpen : string := ""
proc driveChooser (x : int)
if x = 1 then
if stream not= 0 then
Dir.Close (stream)
drive := "A:/"
stream := Dir.Open (drive)
put stream
else
drive := "A:/"
stream := Dir.Open (drive)
put stream
end if
elsif x = 2 then
if stream not= 0 then
Dir.Close (stream)
drive := "C:/"
stream := Dir.Open (drive)
else
drive := "C:/"
stream := Dir.Open (drive)
end if
elsif x = 3 then
if stream not= 0 then
Dir.Close (stream)
drive := "E:/"
stream := Dir.Open (drive)
else
drive := "E:/"
stream := Dir.Open (drive)
end if
elsif x = 4 then
if stream not= 0 then
Dir.Close (stream)
drive := "H:/"
stream := Dir.Open (drive)
else
drive := "H:/"
stream := Dir.Open (drive)
end if
elsif x = 5 then
if stream not= 0 then
Dir.Close (stream)
drive := "F:/"
stream := Dir.Open (drive)
else
drive := "F:/"
stream := Dir.Open (drive)
end if
end if
continue := 0
end driveChooser
var dirs : array 1 .. 5000 of string
var fileToSaveTo : string
proc dummy (x : int)
fileToOpen := files (x)
fileToSaveTo := dirToOpen + "/" + files (x)
end dummy
var boxChoice : int := 1
proc dummyDir (x : int)
if dirs (x) = "" then
dirs (x) := "."
else
dirToOpen := drive + dirs (x)
end if
end dummyDir
proc dummyDir2
continue := 1
Window.Hide (driveChooseWin)
end dummyDir2
var size, attribute, fileTime : int
var fileName : string
var offsetx : int := 0
var Continue : int
proc Continues
var i : int := 1
for t : 1 .. 5000
dirs (t) := intstr (t)
end for
i := 1
var Continue3 := GUI.CreateButton (180, 10, 0, "Choose Directory", Continues)
var Continue4 := GUI.CreateButton (350, 10, 0, "Choose Directory", Continues)
var Continue5 := GUI.CreateButton (520, 10, 0, "Choose Directory", Continues)
GUI.Hide (Continue3)
GUI.Hide (Continue4)
GUI.Hide (Continue5)
listing := GUI.CreateTextBoxChoice (maxx div 2 div 2 + offsetx, maxy div 2 div 2, maxx div 2 div 2, maxy - 150, 0, 0, dummyDir)
if boxChoice = 1 then
GUI.Hide (Continue)
GUI.Show (Continue3)
elsif boxChoice = 2 then
GUI.Hide (Continue3)
GUI.Show (Continue4)
elsif boxChoice = 3 then
GUI.Hide (Continue4)
GUI.Show (Continue5)
elsif boxChoice = 4 then
GUI.Hide (Continue5)
end if
loop
Dir.GetLong (stream, fileName, size, attribute, fileTime)
if (attribute and ootAttrDir) not= 0 then
GUI.AddLine (listing, fileName)
dirs (i) := fileName
i += 1
end if
exit when fileName = ""
end loop
offsetx += 212
boxChoice += 1
end Continues
var driveListing := GUI.CreateTextBoxChoice (50 - 25, maxy div 2 div 2, maxx div 2 div 2 - 25, maxy - 200, 0, 0, driveChooser)
GUI.AddLine (driveListing, "A:\\")
GUI.AddLine (driveListing, "C:\\")
GUI.AddLine (driveListing, "E:\\")
GUI.AddLine (driveListing, "H:\\")
GUI.AddLine (driveListing, "F:\\")
Continue := GUI.CreateButton (10, 10, 0, "Choose Directory", Continues)
var Continue2 := GUI.CreateButton (maxx - 80, 10, 0, "Proceed", dummyDir2)
loop
exit when GUI.ProcessEvent
exit when continue = 1
end loop
|