Qxplorer

Anything QL Software or Programming Related.
User avatar
NL_QL_Usr
Chuggy Microdrive
Posts: 58
Joined: Sun Jan 08, 2023 8:42 am

Qxplorer

Post by NL_QL_Usr »

Qxplorer.
The Q68 comes with an lot of directories and files.
This made me think a file thingy could be useful and fun to make.
This superbasic program uses QLIB TK2 ect.
Off course I saw great programs like Q-Trans and QLcommander etc...
But I liked to give a try myself.

I am sharing this superbasic program as is.
It is not a finished product.
For me it is just something I find useful and fun to make.
A lot works but also many things need more code..
Error trapping is almost none.

Its just about sharing code.
Maybe it is of use for someone.
I will put in this 1st post an update if ever!

The program:

First time: It will make a PROGD$&"tmp" directory
And write a file qxplorer_ini
This file contains the Drives in use
You can off edit this file for you needs

Command: Mostly shown in extra window
arrow l DUP
arrow r DDOWN if cursor is directory
arrow up - dwn the list
pgdwn pgup same but full page
(D)rive change Drives
(F)ilter filters the files as
a = simply all files and directories
starting with a
filter just enter resest to all files
(N)ew make new directory or file
(R)ename a file
(V)iew view a file Ftype 0
(C) Copy file or directory to clipboard
right upper shows the nr of files to paste
(P)aste Paste all files
(M)usic Play a soundfile file .ub
(K)illsound

Enter executes an OBJ or EXE Ftype 1
F1 help
ESC Quit program
upd 2 some mistakes solved
Last edited by NL_QL_Usr on Sun Jan 07, 2024 10:01 am, edited 9 times in total.


User avatar
NL_QL_Usr
Chuggy Microdrive
Posts: 58
Joined: Sun Jan 08, 2023 8:42 am

Re: Qxplorer

Post by NL_QL_Usr »

Update 3
Many changes.

(V)iew views a file ESC returns
when viewing long files you can esc
but it only shows the first 81 char of a line
Enter now exec obj exe ft 1
and plays .ub or _ub files
also ddown when on dire\ctory
(K)ill just stops playing soundfile
(D)rive The ini is not used for drive list

copying, rename, delete, seem ok now

Iv'e made a little routine which list the active drives available

100 REMark find drives NL_QL_USR
110 :
120 DIM drv$(20,3)
130 drv$(0)="WIN":drv$(1)="FLP"
140 drv$(2)="MDV":drv$(3)="FAT"
160 drv%=4
170 CLS
180 PRINT "datad=";DATAD$
190 PRINT "progd=";PROGD$
200 PRINT
210 REPeat l
220 FOR d=0 TO drv%
230 FOR n=1 TO 8
240 rr=FTEST(drv$(d)&n&"_")
250 IF rr>=0:PRINT drv$(d)&n&"_",rr
260 END FOR n
270 END FOR d

Although a bit slower
I think it works nice

The ini file is still there
but not (yet) used


User avatar
NL_QL_Usr
Chuggy Microdrive
Posts: 58
Joined: Sun Jan 08, 2023 8:42 am

Re: Qxplorer

Post by NL_QL_Usr »

update 101
added a sort list
few changes
For now I am satisfied with it. :D

oops did an upload off the wrong file
is now changed latest is qxplorer101.zip
Last edited by NL_QL_Usr on Thu Dec 21, 2023 10:11 am, edited 1 time in total.


qbits
Trump Card
Posts: 174
Joined: Sun Dec 11, 2016 3:32 pm

Re: Qxplorer

Post by qbits »

Hi NL_QL_Usr
I applaud your efforts, but are unfamiliar with Q_PIPE on Line 280 when run it is listed us an unknown procedure with my setup.

May I also suggest maintain an area bottom of screen for Interpreter command channel#0 keeping this separate from #2 the editor screen while developing code.
Attached is a copy of my FTidySE_pdf.

Expand your horizons with QL SuperBASIC
QBITS
Attachments
QB02_FTidySE_doc.pdf
(621.41 KiB) Downloaded 54 times


User avatar
NL_QL_Usr
Chuggy Microdrive
Posts: 58
Joined: Sun Jan 08, 2023 8:42 am

Re: Qxplorer

Post by NL_QL_Usr »

Hello Qbits

Thanks for your kind words.
When I see your great work I feel ashamed ;) Great documentation and very nice written.

The extension Q_PIPE is part of the QLIB extensions QLIB_EXT.

I realize it is far from a good product but I have fun making it. It has been a long time since I did anything with a QL this is a great way off getting some own proc's functions etc again.

By sharing it might just be useful to someone.


User avatar
Andrew
Aurora
Posts: 796
Joined: Tue Jul 17, 2018 9:10 pm

Re: Qxplorer

Post by Andrew »

Hello NL_QL_Usr
I like your work! Somehow it reminds me of XTree, I used that program a lot in early 90's.


Derek_Stewart
Font of All Knowledge
Posts: 3975
Joined: Mon Dec 20, 2010 11:40 am
Location: Sunny Runcorn, Cheshire, UK

Re: Qxplorer

Post by Derek_Stewart »

Hi,

Just got round looking at this, I must the programme is really good.

I mostly use cursor keys for mouse control and HotKeys for programme launch. So Qxplorer works good for me.

I do most of my SBASIC programming from QD, and use QD/SBAS Thing to load the SBASIC programme into SBASIC interpreter. Which needs all channels explicitly opened. To get Qxplorer to run I had to open channel #0 no really problems. I usually write programmes to open their own channels.

Can the directory tree be stripped off the filenames, and this is displayed above in the display. This could allow multiple column display of filenames.

Have you thought about opening the directory with the the OPEN_DIR command or Toolkit 2 function, FOP_DIR. This would save using pipes.

But really excellent programme, I may use it a lot.


Regards,

Derek
User avatar
NL_QL_Usr
Chuggy Microdrive
Posts: 58
Joined: Sun Jan 08, 2023 8:42 am

Re: Qxplorer

Post by NL_QL_Usr »

Hey Andrew :D Great to hear you like it!!

Hey Derek!

Nice to hear you like it.
For me it is handy also because I hardly ever use a mouse.(On the Q68)
I only just saw your example of TKII from you viewtopic.php?p=28333&hilit=fop_dir#p28333
with Fop_Dir. I tried it at first but did not get good results, but I will try it.
It will probably mean I have to do a lot of rewriting.
And I have a lot off other ideas for programming so I would also like to go to a next project.

Anyway I did a small update again 102 with a little better view (even Quil doc's are a bit readable).


User avatar
dilwyn
Mr QL
Posts: 2761
Joined: Wed Dec 01, 2010 10:39 pm

Re: Qxplorer

Post by dilwyn »

I haven't had time to look at your program so please don't think of this as any form of criticism!

I'd just like to offer some routines, some of which I use in program like my Q-Trans, which may prove useful in file handling programs. You are very welcome to use any of this code if anything proves useful.

1. Read the directory device drivers list into an array called devs$(), to enable only offering devices which exist on the system the program runs. It reads the names of directory device drivers which exist on the system it's run on into the array called devs$. On my QPC2 system, for example, it lists DOS DEV FLP WIN RAM as devices which exist on my system. This is how Q-Trans adjusts its device names to reflect the system it's running on.

Code: Select all

100 REMark Read directory devices lists
110 :
120 sv = 163840 : REMark QDOS default system variables address
130 REMark are we on Minerva or SBASIC?
140 v$ = VER$ : IF v$ = 'JSL1' OR v$ = 'HBA' THEN sv= VER$(-2)
150 :
160 REMark get pointer to the directory device driver linked list
170 ad_ptr = PEEK_L(sv+72)
180 :
190 ndevs%   = 0 : REMark number of device names
200 longest% = 0 : REMark length of longest name
210 REPeat pass1
220   dnl_ptr = ad_ptr+36    : REMark device name length pointer
230   lon% = PEEK_W(dnl_ptr) : REMark length of name
240   IF lon% > longest% THEN longest% = lon%
250   ndevs% = ndevs%+1             : REMark count number of device names
260   ad_ptr = PEEK_L(ad_ptr)       : REMark next linked list entry
270   IF ad_ptr = 0 THEN EXIT pass1 : REMark end of list
280 END REPeat pass1
290 :
300 REMark dimension array to hold device names
310 DIM devs$(ndevs%-1,longest%)
320 :
330 ad_ptr = PEEK_L(sv+72) : REMark restart list
340 ndevs% = 0
350 REPeat pass2
360   dnl_ptr = ad_ptr+36
370   lon = PEEK_W(dnl_ptr)
380   REMark add device driver name to list in devs$() array
390   FOR i = dnl_ptr+2 TO dnl_ptr+lon+1
400     devs$(ndevs%) = devs$(ndevs%) & CHR$(PEEK(i))
410   END FOR i
420   ndevs% = ndevs%+1
430   ad_ptr = PEEK_L(ad_ptr)
440   IF ad_ptr = 0 THEN EXIT pass2
450 END REPeat pass2
460 :
470 CLS : PRINT ndevs%;' devices:'\devs$! : REMark show it worked!
2. Directory name functions - to perform actions such as splitting up a filename into directory name, filename and extension parts. Needs Toolkit 2.

Code: Select all

30000 DEFine FuNction Directory_Name$ (filename$)
30010   LOCal ch,d$
30020   ch = FOP_DIR(filename$)
30030   IF ch < 0 THEN
30040     d$ = ''
30050   ELSE
30060     d$ = FNAME$(#ch)
30070     IF d$ > '' THEN
30080       IF d$(LEN(d$)) <> '_' THEN d$ = d$&'_'
30090     END IF
30100   END IF
30110   RETurn d$
30120 END DEFine Directory_Name$
30130 :
30140 DEFine FuNction Drive_Name$ (filename$)
30150   LOCal d$,ch
30160   d$ = ''
30170   ch = '_' INSTR filename$
30180   IF ch > 0 THEN d$ = filename$(1 TO ch)
30190   RETurn d$
30200 END DEFine Drive_Name$
30210 :
30220 DEFine FuNction Pure_Filename$ (filename$)
30230   LOCal ch,d$
30240   ch = LEN(Drive_Name$(filename$))+LEN(Directory_Name$(filename$))
30250   d$ = ''
30260   IF LEN(filename$) > ch THEN d$ = filename$(ch+1 TO LEN(filename$))
30270   RETurn d$
30280 END DEFine Pure_Filename$
30290 :
30300 DEFine FuNction Extension$ (filename$, separator$, maxlen)
30310   LOCal ch,c,ext$,f$
30320   REMark maxlen is the maximum length of extension permitted
30330   REMark usually '_' or '.' plus three characters
30340   REMark separator$ is '_' (QDOS) or '.' (PC)
30350   f$ = Pure_Filename$(filename$) : REMark remove drive+directory
30360   ext$ = '' : REMark extension string
30370   ch = LEN(f$)-maxlen+1
30380   IF ch < 1 THEN ch = 1
30390   FOR c = LEN(f$) TO ch STEP -1
30400     IF f$(c) = separator$ THEN
30410       ext$ = f$(c TO LEN(f$))
30420       EXIT c
30430     END IF
30440   END FOR c
30450   RETurn ext$
30460 END DEFine Extension$
3. Using FOP_DIR to allow reading filenames from a directory without having to rely on DIR to a PIPE or ramdisc. Needs Toolkit 2. This particular version reads the entire hard disk (or whatever) and prints each filename from the variable d$ in line 300 - if you wanted to build an array of filenames, use this variable. Also, if you wanted to show directory names as well as filenames, see lines 260 to 270 which are REMmed out as it stands.

Code: Select all

100 REMark extended dir of all sub-directories
110 Extended_DIR 'win1_',''
120 :
130 DEFine PROCedure Extended_DIR (drive$,directory$)
140   LOCal loop,ch,d$,fp,n$
150   ch = FOP_DIR (drive$&directory$) : REMark open channel to directory
160   IF ch < 0 THEN RETurn : REMark unable to open directory
170   fp = 14 : REMark file position in directory for filename
180   REPeat loop
190     BGET #ch\fp : IF EOF(#ch) THEN CLOSE #ch : EXIT loop
200     GET #ch,d$ : REMark get directory entry name
210     IF LEN(d$) > 0 THEN 
220       REMark a directory length of 0 may be a deleted file
230       BGET #ch\fp-9 : REMark file type byte
240       IF CODE(INKEY$(#ch)) = 255 THEN 
250         REMark this name is a subdirectory, so we need to DIR this
260         REMark if you want directory names printed, add this
270         REMark PRINT d$;' ->'
280         Extended_DIR drive$,d$
290       ELSE 
300         PRINT d$
310       END IF 
320     END IF 
330     fp = fp + 64
340   END REPeat loop
350 END DEFine Extended_DIR
4. There are further similar example programs in a zip file on my wesbite which use routines like Extended_DIR to make a variety of file handling programs such as bulk delete, recreate a directory tree, simple file locator, sub-directory copier and so on. https://dilwyn.qlforum.co.uk/files/hdutils.zip

I just hope something proves useful. Good luck.


User avatar
NL_QL_Usr
Chuggy Microdrive
Posts: 58
Joined: Sun Jan 08, 2023 8:42 am

Re: Qxplorer

Post by NL_QL_Usr »

Hello Dilwyn..
Thanks for your reaction. And off course I am only happy with tips.
I tried the examples and they are great!
It would be nice to update my qxplorer with the extra nice routines. Especially using FOP_DIR will make a lot off difference.
It will take a while I think because it probable means a lot off changes, maybe even having to rewrite it all.
Once again Thank a Lot for your Great site!!!!
It is real great to have so much info there!!


Post Reply