Post by chrissi75 on Jul 21, 2018 11:00:58 GMT
Hey there!
I try to write a file commander. Some things do work fine. But now I have some troubles that I can't solve.
When I select a file in the left listbox (this is the only one that works so far) and I click on "copy", the program is expected to copy the selected file to the drive and directory shown in the right listbox (variable myfolderB$). But for some reason, this does not work.
JustBASIC tells me this error message: - "Runtime error: file not found: copy <followed by the source directory/file and the destination>
Does somebody have a clue what I am doing wrong and know an alternative way to copy a file from one drive/directory to another in JB?
Thanks
Chris
I try to write a file commander. Some things do work fine. But now I have some troubles that I can't solve.
When I select a file in the left listbox (this is the only one that works so far) and I click on "copy", the program is expected to copy the selected file to the drive and directory shown in the right listbox (variable myfolderB$). But for some reason, this does not work.
JustBASIC tells me this error message: - "Runtime error: file not found: copy <followed by the source directory/file and the destination>
Does somebody have a clue what I am doing wrong and know an alternative way to copy a file from one drive/directory to another in JB?
Thanks
Chris
dim infolistA$(1,1)
'dim infolistA$(1,1)
dim infolistB$(1,1)
dim dateienlistA$(1000)
dim dateienlistB$(1000)
dim letter$(25)
global myfolder$
global myfolderB$
myfolder$ = "C:\"
myfolderB$ = DefaultDir$
nomainwin
call GetDrivesA
call GetFilesforListA
call GetFilesforListB
'statictext #main, myfolder$, 5, 5, 250, 30
combobox #main.list, letter$(, [selectionMadeComboA], 5, 5, 200, 20
listbox #main.listA, dateienlistA$(), [selectionMade], 5, 35, 210, 300
statictext #main, myfolderB$, 250, 5, 250, 30
button #main.help, " Help ",[Help], ll, 5, 30
button #main.view, " Info ",[View], ll, 100,30
button #main.edit, " Edit ",[Edit], ll, 195,30
button #main.copy, " Copy ",[Copy], ll, 290,30
button #main.move, " Move ",[Move], ll, 385,30
button #main.newfolder, "New Folder", [newfolder], ll, 5, 0
button #main.delete, " Delete ", [Delete], ll 100,0
button #main.backup, " Backup ", [Backup], ll, 195, 0
button #main.find, " Rename ", [Rename], ll, 290, 0
button #main.quit, " Exit ", [quit], ll, 385, 0
listbox #main.listB, dateienlistB$(), [selectionMadeB], 250, 35, 210, 300
WindowWidth = 500
WindowHeight = 460
open "cdCommander [File Explorer]" for window as #main
print #main, "trapclose [quit]"
wait
[quit]
close #main
end
[selectionMadeComboA]
#main.list "selection? selection$"
'notice selection$ + "\"
myfolder$ = selection$ + "\"
call GetFilesforListA
#main.listA "reload"
'close #main
'end
[selectionMade]
#main.listA "selection? selection$"
descr$=" (file)"
if selection$ = ".." then
m=1
dirlength = len(myfolder$)
while m <> 0
m = instr(myfolder$, "\", m+1)
if m = 0 then exit while
n=m
wend
myfolder$ = left$(myfolder$, n-1)
laenge = len(myfolder$)
if laenge < 3 then
myfolder$ = myfolder$ + "\"
end if
'notice myfolder$
call GetFilesforListA
#main.listA "reload"
' if laenge < 3 then dateienlistA$(0) = ""
'descr$=" (up link)"
else
if left$(selection$, 1) = "[" then
oldfolder$ = myfolder$
myfolder$ = selection$
x=len(myfolder$)
myfolder$ = mid$(myfolder$, 2, x-2)
a = len(oldfolder$)
if a > 3 then
myfolder$ = oldfolder$ + "\" + myfolder$ : REM FEHLERHAFT!!!!
else
myfolder$ = oldfolder$ + myfolder$
end if
notice myfolder$
call GetFilesforListA
#main.listA "reload"
end if
'notice "You've selected ";chr$(34);selection$;chr$(34);descr$
end if
wait
[selectionMadeB]
#main.listB "selection? selection$"
[help]
[Delete]
#main.listA "selection? selection$"
if left$(selection$, 1) = "[" then
quelle$ = "das Verzeichnis " + selection$
else
quelle$ = "die Datei " + selection$
end if
confirm "Wollen Sie " + quelle$ + " löschen?"; answer$
if answer$ = "yes" then
kill myfolder$ + "\" + selection$
end if
call GetFilesforListA
#main.listA "reload"
wait
[Rename]
#main.listA "selection? selection$"
if left$(selection$, 1) = "[" then
quelle$ = "das Verzeichnis " + selection$
else
quelle$ = "die Datei " + selection$
end if
prompt "Bitte geben Sie den neuen Namen ein: "; newName$
confirm "Wollen Sie " + quelle$ + " in " + newName$ + " umbennen?"; answer$
if answer$ = "yes" then
name myfolder$ + "\" + selection$ as myfolder$ + "\" + newName$
end if
call GetFilesforListA
#main.listA "reload"
wait
[Edit]
#main.listA "selection? selection$"
run "NOTEPAD " + chr$(34) + myfolder$ + "\" + selection$
wait
[Copy]
#main.listA "selection? selection$"
run "copy" + " " + myfolder$ + "\" + selection$ + " " + myfolderB$+"\"
wait
sub GetDrivesA
index = 0
while word$(Drives$, index + 1) <> ""
letter$(index) = word$(Drives$, index + 1)
index = index + 1
wend
end sub
sub GetFilesforListA
'myfolder$ = "C:\ClasCC5"
files myfolder$, infolistA$()
totfiles = val(infolistA$(0,0))
totSubDirs = val(infolistA$(0,1))
redim dateienlistA$(totfiles+totSubDirs)
j = 0
dateienlistA$(j) =".." 'up link
'directories, make them visible with []
for i = 1 to totSubDirs
j=j+1
dateienlistA$(j) = "[";infolistA$(totfiles+i,1);"]"
'max = i + 1 '???
next i
'files
for i = 1 to totfiles
j=j+1
dateienlistA$(j) = infolistA$(i,0)
'max = i + 1 '???
next i
end sub
sub GetFilesforListB
files myfolderB$, infolistB$()
totfilesB = val(infolistB$(0,0))
totSubDirsB = val(infolistB$(0,1))
redim dateienlistB$(totfilesB+totSubDirsB)
j=0
dateienlistB$(j) = ".."
for i = 1 to totSubDirsB
j=j+1
dateienlistB$(j) = "[";infolistB$(totfilesB+i,1);"]"
next i
for i = 1 to totfilesB
j=j+1
dateienlistB$(j) = infolistB$(i,0)
next i
end sub