/* * * Copy file(s) between 1541 and Amiga * * (c) 1995 by Christer Bjarnemo mr.bjarnemo@mn.medstroms.se * * Based on Twin-Dopus by Patrick Van Beem (patrick.van.beem@aobh.xs4all.nl), * which based he's script on the DOpusLhaARexx package by Geoff Seeley. * */ dircmd = "Work:Emulators/A64/Utils/" /* Note. If the file ENVARC:1541.PREFS */ rxdir = "Rexx:Dopus/1541/" /* exists, that one will override the */ tmpdir = "t:" /* settings here... */ DOpusPort = 'DOPUS.1' snuff = '22'x if open(1,'env:1541.prefs','Read') then do dircmd = readln(1) rxdir = readln(1) tmpdir = readln(1) end close(1) dircmd = slashpath(dircmd) rxdir = slashpath(rxdir) tmpdir = slashpath(tmpdir) if ~show(l,"rexxsupport.library") then call addlib("rexxsupport.library",0,-30,0) if showlist('Ports', DOpusPort) = 0 then do say 'Directory Opus Arexx port not found. Aborting.' call CleanUp end address(DOpusPort) options results /* setup DOpus window and tell user what's happening */ Busy on TopText "Copying selected files..." /* Get the destination path */ OtherWindow 'Status 6 -1' GetEntry Result ToPath = Result if left(ToPath,1) = '*' then do ToPath = SubStr(ToPath,2) DoReread='TRUE' end else do 'Status 13 -1' ToPath = result if ToPath = '' then do TopText "No destination directory selected." call CleanUp end DoReread='FALSE' end ToPath=Quote(ToPath) OtherWindow /* Get the current path and do file-copy, depending on the */ /* type of path (1541/normal path) */ 'Status 6 -1' GetEntry Result FilePath = Result /* 1541-way */ if left(FilePath,1) = '*' then do FilePath = SubStr(FilePath,2) GetSelectedAll SelectedEntries = result if SelectedEntries = 'RESULT' then do TopText "No files selected." call CleanUp end NumberOfEntries = words(SelectedEntries) do EntryNumber = 1 to NumberOfEntries Index = word(SelectedEntries, EntryNumber) GetEntry Index+1 Entry = result File = strip(left(Entry,25)) toptext 'Copying "'File'" to 'ToPath'...' if right(FilePath,1) = ':' then File = Quote(FilePath || File) else File = Quote(FilePath || '' || File) address command dircmd'64toAmiga >'tmpdir'1541.tmp 'File' 'left(ToPath,length(ToPath)-1)''right(File,length(File)-1)' 8' if open(1,tmpdir'1541.tmp','Read') then do Do for 8 ; tmp = readln(1) ; End say tmp Toptext tmp close(1) end selection = Index||' 0 0' SelectEntry selection end end /* Normal way */ else do 'Status 13 -1' FilePath = result if FilePath = '' then do TopText "No source directory selected." call CleanUp end 'GetSelectedAll "|" -1' SelectedEntries = result if SelectedEntries = 'RESULT' then do TopText "No files selected." call CleanUp end NumberOfEntries = CountWords(SelectedEntries) do EntryNumber = 1 to NumberOfEntries File = GetWord(EntryNumber, SelectedEntries) toptext 'Writing "'File'" to 1541...' SelectFile Quote(File) FileOnly = Quote(File) File = Quote(FilePath || File) address command dircmd'Amigato64 >'tmpdir'1541.tmp 'left(ToPath,length(ToPath)-1)''right(File,length(File)-1)' 'FileOnly' 8' if open(1,tmpdir'1541.tmp','Read') then do Do for 9 ; tmp = readln(1) ; End say tmp Toptext tmp close(1) end end end 'DisplayDir -1' if DoReread='TRUE' then do otherwindow say rxdir address arexx rxdir'1541Dir.rexx' end else do otherwindow 'rescan -1' otherwindow end call CleanUp exit /*---------------------------------------------------------------------------*/ CleanUp: /* Remove any files and exit */ Busy off exit return /*--------------------------------------------------------------------------*/ Quote: procedure /* add quotes to string */ parse arg string return '"'||string||'"' /*--------------------------------------------------------------------------*/ GetWord: procedure /* get word from '|' separated string */ parse arg number,words if(left(words,1) ~= '|') then words = '|'||words do i=1 to number idx = index(words, '|'); words = substr(words, idx+1) end end = index(words, '|') - 1 if words = "" then return "" ret_str = substr(words, 1, end) return ret_str /*--------------------------------------------------------------------------*/ CountWords: procedure /* count words from '|' separated string */ parse arg words count = 0 idx = index(words, '|') do while idx ~= 0 count = count + 1 words = substr(words, idx+1) idx = index(words, '|') end return count /*---------------------------------------------------------------------------*/ Slashpath: procedure /* Put a (/) or (:) at the end of filenames (if neccessary) */ parse arg string if right(string,1) ~= ':' & right(string,1) ~= '/' then do string = string'/' end return string