Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.
|
Forum Index : Microcontroller and PC projects : FILEBOX - My first program for CMM2 (very alpha)
Author | Message | ||||
Hark0 Newbie Joined: 02/07/2020 Location: SpainPosts: 31 |
Hello! I'm working on my own file manager. The goal are a very simple program for copy, move, edit files, etc... Currently, the program loads and show folders and files. You can create, rename and delete folders (!!! Not delete full folders). I don't know how "trap the error" about folder with contents. I need some explanation about ON ERROR options. Many options not are implemented yet.... copy, move, etc files.... Not work in terminal mode... I'm are using TEXT for print screen. Not are finished, very alpha.... I have some "problems": - I can't RUN a selected program (BAS). (In memory are filebox.bas,... hmmmm how unload?) - I can't EDIT a selected file... same as previous. Some help about how to implement these functions are welcome. Thanks in advance. PS: I add the source code (22 Kb). FILEBOX19.zip Edited 2020-08-10 21:12 by Hark0 ZX-UNO: ZX-Spectrum Clone with FPGA |
||||
Atomizer_Zero Senior Member Joined: 04/07/2020 Location: United KingdomPosts: 134 |
Very cool looking file manager! I'm not too sure on how you'd go about implementing running and editing of files. Some features I would personally like, if you're open for suggestions, is the ability to hide certain file types, have it colour coded, sort by name or type and bulk rename (rename all pngs for example). Oh and displaying a HEX table for the files like for example 0000: 89 50 4E 47 00 00 00 00 00 00 00 00 00 00 00 00 |.PNG............ 0001: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF |................ Didn't know how much I wanted something like this until I starting typing... Just had a thought... You could potentially write your own editor inside the file manager? At least then you could edit the files. Anyway, keep it up and good luck. looks great so far! |
||||
Hark0 Newbie Joined: 02/07/2020 Location: SpainPosts: 31 |
Hmmm, I think EDIT can be solved loading the file into the program... basically "adding a simple editor"... not the initial goal of the project. RUN are more difficult to implement. Yes, the program have many possiblilities, this is my first code program for CMM2... ;-) It is precisely what I have commented at the beginning of the post. I think for now I will focus on the functions related to files (move, copy, ...) the basics. ZX-UNO: ZX-Spectrum Clone with FPGA |
||||
TassyJim Guru Joined: 07/08/2011 Location: AustraliaPosts: 6111 |
This is an extract from my file manager program. SUB showHEX f$ LOCAL INTEGER row, fSize, fpos, n LOCAL txt$, hx$ CLS showing = 2 row = 2 OPEN f$ FOR INPUT AS #2 fSize = LOF(#2) PRINT @(8, 13, 2) f$ ;" ";STR$(fSize,8,0);" bytes" DO WHILE NOT EOF(#2) txt$ = INPUT$(16, #2) hx$=HEX$(fpos,8)+" " FOR n = 1 TO LEN(txt$) hx$=hx$+HEX$(ASC(MID$(txt$,n,1)),2)+" " NEXT n IF LEN(hx$) < 62 THEN hx$=hx$+SPACE$(62-LEN(hx$)) FOR n = 1 TO LEN(txt$) IF ASC(MID$(txt$,n,1))>32 AND ASC(MID$(txt$,n,1)) < 127 THEN hx$=hx$+MID$(txt$,n,1) ELSE hx$=hx$+"." ENDIF NEXT n PRINT @(8, row*13, 0) hx$ row = row + 1 fpos = fpos + 16 IF row > 41 OR EOF(#2) THEN PRINT @(8, helpLine, 0) " Press any key to continue, PGup to go back or esc to quit..." PRINT @(8, 13, 2) f$ ;" ";STR$(fpos,8,0);"/";STR$(fSize,8,0);" bytes" DO k$ = INKEY$ LOOP UNTIL k$<>"" IF k$ = CHR$(27) THEN showing = 0 refreshDue = 2 EXIT DO ELSEIF k$ = CHR$(136) THEN ' page up fpos = fpos - 40*16*2 'to the start of 2 pages back IF fpos < 0 THEN fpos = 0 SEEK #2, fpos CLS row = 2 ELSE CLS row = 2 ENDIF ENDIF LOOP CLOSE #2 END SUB I think the only extras needed are helpLine = 572 showing and refreshDue are flags used by the main program and can be ignored. Search the forum for the full program. FM.BAS Jim VK7JH MMedit  MMBasic Help |
||||
Atomizer_Zero Senior Member Joined: 04/07/2020 Location: United KingdomPosts: 134 |
Ah, will check it out. Cheers! |
||||
capsikin Guru Joined: 30/06/2020 Location: AustraliaPosts: 341 |
So long as the file name doesn't contain any tricky characters (e.g. quote marks, maybe new lines, not sure what else) you can use execute with a run command: quote$=chr$(34) cmd$="run "+quote$+"myfile.bas"+quote$ execute cmd$ Also I noticed the built in file manager crashed when I tried to make a file copy with a quote mark in it to test this. Edited 2020-08-11 11:58 by capsikin |
||||
Hark0 Newbie Joined: 02/07/2020 Location: SpainPosts: 31 |
Thanks @TassyJim.... I take note of your source. @capsikin.... EXECUTE Command? hmmmm I go trying things... ZX-UNO: ZX-Spectrum Clone with FPGA |
||||
Print this page |