_TITLE "Fetch Text app of GUI Boxes" 'B+ 2019-10-15 ' a box for selecting directories, a box for files, a box to display file text and a box to show selected text
'2019-11-12 add a clipboard clip$ and post
CONST xmax
= 1200 '150 chars CONST ymax
= 720 '45 chars CONST offFC
= &HFF999999, offBC
= &HFF333333 CONST DD$
= "$" + "$" ' details delimiter not likely to occur in Text?
c
AS INTEGER 'column, these are all in character cell units not pixels w
AS INTEGER ' actual text will have 2 less character used to frame box o
AS INTEGER 'on/off active = got focus =-1 else 0 DNA
AS INTEGER ' the kind of box 1 = txtBx, 2 = selBx
TYPE txtBxType
'these are all in character cell units not pixels txt
AS STRING ' to convert to string array with Split delim
AS STRING 'for txt to split when drawing to base 1 array rowStart
AS INTEGER ' track top line of display curRow
AS INTEGER ' highlite row 1 to.. ubound of array R1
AS INTEGER 'this is anchor position of text block selection R2
AS INTEGER ' this is above or below anchor position maxW
AS INTEGER 'find the length of longest string - text display width + 1 maxH
AS INTEGER ' ubound of text array - display height of box + 1 ubText
AS INTEGER ' track this so don't have to recalc maximum curRow can go
id
AS INTEGER 'trace back to parent Bx number txt
AS STRING 'for split into string array sNum
AS INTEGER 'tracking key press number for selection <enter> highlite
AS INTEGER ' select highlite by space bar or left mouse click selected
AS INTEGER ' use getSelected$ for number or text$ maxH
AS INTEGER 'track upper limit or string array
DIM SHARED CRLF$
'a common delimiter for txt files
IF ENVIRON$("TEMP") <> "" THEN 'Thanks to Steve McNeill use user temp files directory ELSE 'Thanks to Steve McNeill this should be very unlikely tmpDir = "C:\temp"
'Box type arrays and counts, theBx is the Box with focus
' Local variables for this program
' ========================================== DIM and Layout New Boxes Here ========================================================
' assign new Bx put the Bx controls in Tab order (Shift + Tab reverse order)
' for reference here is call to newBx
' newBx col, row, txtwidth + 2 in font cells, txtHeight + 1 in font cells, fore Color, back Color, details string depends on Bx type
'details string build for new TextBox or SelectBox, DD$ is delimiter for detail split in code
' detail = "TextBox" + DD$
' detail = detail + theText$ + DD$
' detail = detail + theDelimiter$ (of theText$: CRLF$ for txt files or , for data files...)
loadDIR drs()
loadFiles fls()
d$ = join$(drs())
f$ = join$(fls())
dbx = newBx(2, 1, 104, 21, &HFF88AAFF, &HFF000088, "selBx" + DD$ + d$ + DD$ + CRLF$)
fbx = newBx(107, 1, 43, 21, &HFFFFAA88, &HFF880000, "selBx" + DD$ + f$ + DD$ + CRLF$)
cbx = newBx(2, 23, 148, 11, &HFFAAFFAA, &HFF008800, "textBx" + DD$ + c$ + DD$ + CRLF$)
sbx = newBx(2, 35, 148, 10, &HFFFFFF00, &HFF550033, "txtBx" + DD + s$ + DD$ + CRLF$)
'===================================================== END of Layout =============================================================
FOR j
= 1 TO nBx
'redraw everything drawTxtBx j
drawSelBx j
COLOR &HFFAAAAAA, &HFF000000 'keep color for screen after drawing focus 'which box has the focus? then mouse and key handler
test$ = getItem$(dbx)
IF test$
<> "" THEN 'new directory 'LOCATE 1, 1: PRINT test$
'INPUT "OK "; w$
'_KEYCLEAR
loadDIR drs()
loadFiles fls()
d$ = join$(drs())
f$ = join$(fls())
putItem dbx, d$ + DD$ + CRLF$
putItem fbx, f$ + DD$ + CRLF$
test$ = getItem$(fbx) 'get file name for file content
c$ = fileStr$(test$)
putItem cbx, c$ + DD$ + CRLF$
test$ = getItem$(cbx)
putItem sbx, test$ + DD$ + CRLF$
_KEYCLEAR 'it takes an enter keypress to select by number, need to clear that for next input
FUNCTION getItem$
(bxNum
AS INTEGER) 'return the item value from bxNum, once retrieved clear value?? CASE 1 'text box mainly text box is just for displaying stuff, select a block of text Split txtBx(b).txt, txtBx(b).delim, tx()
start = txtBx(b).R1: n = txtBx(b).R2
IF i
= start
THEN getItem$
= tx
(start
) ELSE getItem$
= getItem$
+ CRLF$
+ tx
(i
) txtBx(b).selected = 0
CASE 2 'select box, reurn text string selected n = selBx(b).selected
Split selBx(b).txt, selBx(b).delim, tx()
getItem$ = tx(n)
selBx(b).selected = 0 ' clear the selected index
SUB putItem
(bxNum
AS INTEGER, details$
) ' change out text and reset DNA Box CASE 1 'change out text and it's delimiter Split details$, DD$, d()
txtBx(b).txt = d(1)
txtBx(b).delim = d(2)
txtBx(b).rowStart = 1
txtBx(b).colStart = 1
txtBx(b).curRow = 1
txtBx(b).R1 = 1
txtBx(b).R2 = 1
txtBx(b).selected = 0
mxW = 1
Split txtBx(b).txt, txtBx(b).delim, tx()
txtBx(b).maxW = mxW - (Bx(bxNum).w - 2) + 1 ' display width is 2 less than bx.w, formula says add 1 so -2 + 1 = -1
txtBx
(b
).maxH
= UBOUND(tx
) - Bx
(bxNum
).h
+ 2 ' display height is -1 from bx.h + 1 IF txtBx
(b
).maxH
< 1 THEN txtBx
(b
).maxH
= 1 txtBx
(b
).ubText
= UBOUND(tx
) ' max row
CASE 2 'change out text and it's delimiter Split details$, DD$, d()
selBx(b).txt = d(1)
selBx(b).delim = d(2)
selBx(b).sNum = 0
selBx(b).highlite = 1
selBx(b).selected = 0
Split selBx(b).txt, selBx(b).delim, tx()
selBx
(b
).maxH
= UBOUND(tx
) ' display height is -1 from bx.h + 1
SUB focus
'mouse and key event handling
IF nBx
AND theBx
= 0 THEN theBx
= 1: Bx
(theBx
).o
= -1 'set theBx for startup
'to use mouse wheel for scrolling I have to do this before knowing if theBx with focus has changed, assuming it hasn't
IF txtBx
(c
).curRow
+ mw
>= 1 AND txtBx
(c
).curRow
+ mw
<= txtBx
(c
).ubText
THEN txtBx(c).curRow = txtBx(c).curRow + mw
IF txtBx
(c
).curRow
< txtBx
(c
).rowStart
THEN txtBx
(c
).rowStart
= txtBx
(c
).curRow
IF txtBx
(c
).curRow
> txtBx
(c
).rowStart
+ Bx
(theBx
).h
- 2 THEN txtBx(c).rowStart = txtBx(c).rowStart + txtBx(c).curRow - txtBx(c).rowStart - Bx(theBx).h + 2
IF txtBx
(c
).rowStart
> txtBx
(c
).maxH
THEN txtBx
(c
).rowStart
= txtBx
(c
).maxH
txtBx(c).R2 = txtBx(c).curRow
IF selBx
(c
).highlite
+ mw
>= 1 AND selBx
(c
).highlite
+ mw
<= selBx
(c
).maxH
THEN selBx(c).highlite = selBx(c).highlite + mw
'now we see if theBx = index of box that has focus has changed by mouse over
mc = mx \ 8 + 1: mr = my \ 16 + 1
IF mx
<> oldmx
OR my
<> oldmy
THEN 'check what bx mouse is over IF mc
>= Bx
(i
).c
AND mc
<= Bx
(i
).c
+ Bx
(i
).w
- 1 THEN IF mr
>= Bx
(i
).r
AND mr
<= Bx
(i
).r
+ Bx
(i
).h
- 1 THEN b = i
oldmx = mx: oldmy = my
'now we see if theBx = index of box that has focus has changed by Tab Key press
b
= theBx
- 1:
IF b
< 1 THEN b
= nBx
b
= theBx
+ 1:
IF b
> nBx
THEN b
= 1 Bx(theBx).o = 0: Bx(b).o = -1: theBx = b
'now handle other mouse and key events according to bx(theBx).DNA = the type of box
FOR b
= 1 TO nTxtBx
'which txtBx tw = Bx(theBx).w - 2: th = Bx(theBx).h - 1 'get the display width and height
'mouse, make sure mouse is in theBx
IF mc
>= Bx
(theBx
).c
AND mc
<= Bx
(theBx
).c
+ Bx
(theBx
).w
THEN IF mr
>= Bx
(theBx
).r
AND mr
<= Bx
(theBx
).r
+ Bx
(theBx
).h
THEN IF mc
= Bx
(theBx
).c
AND mb1
THEN 'clicking left side of frame IF mr
= Bx
(theBx
).r
THEN ' clicking top left corner = ctrl + home txtBx(b).curRow = 1: txtBx(b).colStart = 1: txtBx(b).rowStart = 1
ELSEIF mr
= Bx
(theBx
).r
+ Bx
(theBx
).h
THEN ' clicking bottom left corner cntrl + end txtBx(b).curRow = txtBx(b).ubText: txtBx(b).colStart = 1: txtBx(b).rowStart = txtBx(b).maxH
ELSEIF Bx
(theBx
).r
< mr
AND mr
< Bx
(theBx
).r
+ Bx
(theBx
).h
THEN ' clicking between corners txtBx(b).colStart = txtBx(b).colStart - tw
IF txtBx
(b
).colStart
< 1 THEN txtBx
(b
).colStart
= 1
'click right frame = Pg right
ELSEIF (mc
= Bx
(theBx
).c
+ Bx
(theBx
).w
- 1 OR mc
= Bx
(theBx
).c
+ Bx
(theBx
).w
) AND mb1
THEN txtBx(b).colStart = txtBx(b).colStart + tw
IF txtBx
(b
).colStart
> txtBx
(b
).maxW
THEN txtBx
(b
).colStart
= txtBx
(b
).maxW
'click top frame = PgUp
txtBx(b).curRow = txtBx(b).curRow - th
IF txtBx
(b
).curRow
< 1 THEN txtBx
(b
).curRow
= 1 IF txtBx
(b
).curRow
< txtBx
(b
).rowStart
THEN txtBx(b).rowStart = txtBx(b).rowStart - th
IF txtBx
(b
).rowStart
< 1 THEN txtBx
(b
).rowStart
= 1 txtBx(b).R2 = txtBx(b).curRow
' click bottom frame = PgDn
txtBx(b).curRow = txtBx(b).curRow + th
txtBx(b).rowStart = txtBx(b).rowStart + th
IF txtBx
(b
).curRow
> txtBx
(b
).ubText
THEN txtBx
(b
).curRow
= txtBx
(b
).ubText
IF txtBx
(b
).rowStart
> txtBx
(b
).maxH
THEN txtBx
(b
).rowStart
= txtBx
(b
).maxH
txtBx(b).R2 = txtBx(b).curRow
IF mb1
THEN 'click main body, just highlite or select to the click txtBx(b).curRow = txtBx(b).rowStart + mr - Bx(theBx).r - 1
IF txtBx
(b
).curRow
< 1 THEN txtBx
(b
).curRow
= 1 IF txtBx
(b
).curRow
> txtBx
(b
).ubText
THEN txtBx
(b
).curRow
= txtBx
(b
).ubText
txtBx(b).R2 = txtBx(b).curRow
'key presses
txtBx(b).curRow = 1: txtBx(b).rowStart = 1
txtBx(b).R2 = txtBx(b).curRow
txtBx(b).rowStart = txtBx(b).maxH
txtBx(b).curRow = txtBx(b).ubText
txtBx(b).R2 = txtBx(b).curRow
IF txtBx
(b
).colStart
- tw
< 1 THEN txtBx(b).colStart = 1
txtBx(b).colStart = txtBx(b).colStart - tw
IF txtBx
(b
).colStart
+ tw
> txtBx
(b
).maxW
THEN txtBx(b).colStart = txtBx(b).maxW
txtBx(b).colStart = txtBx(b).colStart + tw
IF txtBx
(b
).maxW
> 1 THEN 'left right home and end IF txtBx
(b
).colStart
> 1 THEN txtBx
(b
).colStart
= txtBx
(b
).colStart
- 1 IF txtBx
(b
).colStart
< txtBx
(b
).maxW
THEN txtBx
(b
).colStart
= txtBx
(b
).colStart
+ 1 IF txtBx
(b
).maxW
> 1 THEN txtBx
(b
).colStart
= 1 IF txtBx
(b
).maxW
> 1 THEN txtBx
(b
).colStart
= txtBx
(b
).maxW
CASE 13 'enter we have made our selection txtBx(b).selected = -1
txtBx(b).selected = 0
IF txtBx
(b
).curRow
> 1 THEN txtBx
(b
).curRow
= txtBx
(b
).curRow
- 1 IF txtBx
(b
).curRow
< txtBx
(b
).rowStart
THEN txtBx
(b
).rowStart
= txtBx
(b
).curRow
txtBx(b).R2 = txtBx(b).curRow
IF txtBx
(b
).curRow
< txtBx
(b
).ubText
THEN txtBx
(b
).curRow
= txtBx
(b
).curRow
+ 1 IF txtBx
(b
).curRow
> txtBx
(b
).rowStart
+ th
- 1 THEN '''''''''''''''''''''' txtBx(b).rowStart = txtBx(b).rowStart + 1
IF txtBx
(b
).rowStart
> txtBx
(b
).maxH
THEN txtBx
(b
).rowStart
= txtBx
(b
).maxH
txtBx(b).R2 = txtBx(b).curRow
txtBx(b).curRow = txtBx(b).curRow - th
IF txtBx
(b
).curRow
< 1 THEN txtBx
(b
).curRow
= 1 IF txtBx
(b
).curRow
< txtBx
(b
).rowStart
THEN txtBx(b).rowStart = txtBx(b).rowStart - th
IF txtBx
(b
).rowStart
< 1 THEN txtBx
(b
).rowStart
= 1 txtBx(b).R2 = txtBx(b).curRow
txtBx(b).curRow = txtBx(b).curRow + th
txtBx(b).rowStart = txtBx(b).rowStart + th
IF txtBx
(b
).curRow
> txtBx
(b
).ubText
THEN txtBx
(b
).curRow
= txtBx
(b
).ubText
IF txtBx
(b
).rowStart
> txtBx
(b
).maxH
THEN txtBx
(b
).rowStart
= txtBx
(b
).maxH
txtBx(b).R2 = txtBx(b).curRow
FOR b
= 1 TO nSelBx
'which selBx th = Bx(theBx).h - 1 'get the display width and height
page
= INT(selBx
(b
).highlite
/ th
) IF selBx
(b
).highlite
MOD th
= 0 THEN page
= page
- 1
'mouse is probably already inside box unless theBx was set by tabbing so double check for mouse functions
IF mc
>= Bx
(theBx
).c
AND mc
<= Bx
(theBx
).c
+ Bx
(theBx
).w
THEN 'mouse must be inside columns IF mr
>= Bx
(theBx
).r
AND mr
<= Bx
(theBx
).r
+ Bx
(theBx
).h
THEN ' mouse inside rows IF mr
= Bx
(theBx
).r
AND mc
= Bx
(theBx
).c
AND mb1
THEN 'Ctrl + home if clicked selBx(b).highlite = 1
ELSEIF mr
= Bx
(theBx
).r
+ Bx
(theBx
).h
AND mc
= Bx
(theBx
).c
AND mb1
THEN 'Ctrl + end if clicked selBx(b).highlite = selBx(b).maxH
IF selBx
(b
).highlite
- th
< 1 THEN 'PUp selBx(b).highlite = 1
selBx(b).highlite = selBx(b).highlite - th
'fix click highlite and select
ELSEIF mr
> Bx
(theBx
).r
AND mr
< Bx
(theBx
).r
+ Bx
(theBx
).h
- 1 AND mb1
THEN ' clicked so select it selBx(b).highlite = page * th + mr - Bx(theBx).r
IF selBx
(b
).highlite
< 1 THEN selBx
(b
).highlite
= 1 IF selBx
(b
).highlite
> selBx
(b
).maxH
THEN selBx
(b
).highlite
= selBx
(b
).maxH
IF mb1
THEN selBx
(b
).selected
= selBx
(b
).highlite
ELSEIF mr
= Bx
(theBx
).r
+ Bx
(theBx
).h
AND mb1
THEN 'pgdn if clicked IF selBx
(b
).highlite
+ th
> selBx
(b
).maxH
THEN selBx(b).highlite = selBx(b).maxH
selBx(b).highlite = selBx(b).highlite + th
END IF ' bunch of conditions
'key presses
IF selBx
(b
).maxH
> 1 THEN selBx
(b
).highlite
= 1 'ctrl + home IF selBx
(b
).maxH
> 1 THEN selBx
(b
).highlite
= selBx
(b
).maxH
' ctrl + end CASE 13 'enter select the number input IF selBx
(b
).sNum
>= 1 AND selBx
(b
).sNum
<= selBx
(b
).maxH
THEN selBx(b).selected = selBx(b).sNum
selBx(b).selected = selBx(b).highlite
selBx(b).sNum = 0
selBx(b).selected = selBx(b).highlite
selBx(b).sNum = 0
CASE 48 TO 57 'add digit to sNum CASE 99, 21248 'c for clear or delete selBx(b).sNum = 0
IF selBx
(b
).highlite
> 1 THEN selBx
(b
).highlite
= selBx
(b
).highlite
- 1 IF selBx
(b
).highlite
< selBx
(b
).maxH
THEN selBx
(b
).highlite
= selBx
(b
).highlite
+ 1 IF selBx
(b
).highlite
- th
< 1 THEN selBx(b).highlite = 1
selBx(b).highlite = selBx(b).highlite - th
IF selBx
(b
).highlite
+ th
> selBx
(b
).maxH
THEN selBx(b).highlite = selBx(b).maxH
selBx(b).highlite = selBx(b).highlite + th
FOR b
= 1 TO nTxtBx
'b is txtBx index that matches the Bx index, theorectically other controls will have Bx index Split txtBx(b).txt, txtBx(b).delim, tx() ' get the text into an array
tw = Bx(i).w - 2: th = Bx(i).h - 1 'get the display width and height
IF txtBx
(b
).R1
> txtBx
(b
).R2
THEN sStart
= txtBx
(b
).R2: sEnd
= txtBx
(b
).R1
ELSE sStart
= txtBx
(b
).R1: sEnd
= txtBx
(b
).R2
IF txtBx
(b
).maxW
> 1 THEN 'text indicator column bar needed d! = 8 * (tw - 1) * (txtBx(b).colStart - 1) / (txtBx(b).maxW - 1)
LINE ((Bx
(i
).c
) * 8 + 4 + d!
- j!
, (Bx
(i
).r
- .5) * 16 - 2 * j!
)-STEP(2 * j!
, Bx
(i
).h
* 16 + 4 * j!
), _RGB32(255 - j!
* 50, 255 - j!
* 50, 255 - j!
* 50), BF
IF txtBx
(b
).maxH
> 1 THEN 'text indicator row bar needed d! = 16 * (th - 1) * (txtBx(b).curRow - 1) / (txtBx(b).ubText - 1)
LINE ((Bx
(i
).c
- 1) * 8 - 2 * j!
, (Bx
(i
).r
+ .5) * 16 - 2 + d!
- j!
)-STEP(Bx
(i
).w
* 8 + 4 * j!
, 2 * j!
), _RGB32(255 - j!
* 50, 255 - j!
* 50, 255 - j!
* 50), BF
IF Bx
(i
).o
THEN 'box and frame fc = Bx(i).fc: bc = Bx(i).bc
LINE ((Bx
(i
).c
- 1) * 8, (Bx
(i
).r
- .5) * 16)-STEP(Bx
(i
).w
* 8, Bx
(i
).h
* 16), bc
, BF
fc = offFC: bc = offBC
LINE ((Bx
(i
).c
- 1) * 8, (Bx
(i
).r
- .5) * 16)-STEP(Bx
(i
).w
* 8, Bx
(i
).h
* 16), bc
, BF
LINE ((Bx
(i
).c
- 1) * 8, (Bx
(i
).r
- .5) * 16)-STEP(Bx
(i
).w
* 8, Bx
(i
).h
* 16), fc
, B
'text and highlite startRow
IF txtBx
(b
).rowStart
+ r
- 1 >= 1 AND txtBx
(b
).rowStart
+ r
- 1 <= txtBx
(b
).ubText
THEN s$
= LEFT$(MID$(tx
(txtBx
(b
).rowStart
+ r
- 1), txtBx
(b
).colStart
) + SPACE$(tw
), tw
) LP Bx(i).c + 1, Bx(i).r + r, s$
FOR b
= 1 TO nSelBx
'b is txtBx index that matches the Bx index, theorectically other controls will have Bx index Split selBx(b).txt, selBx(b).delim, tx() ' get the text into an array
tw = Bx(i).w - 2: th = Bx(i).h - 1 'get the display width and height
page
= INT(selBx
(b
).highlite
/ th
)
IF selBx
(b
).highlite
MOD th
= 0 THEN page
= page
- 1
fc = Bx(i).fc: bc = Bx(i).bc
LINE ((Bx
(i
).c
- 1) * 8, (Bx
(i
).r
- .5) * 16)-STEP(Bx
(i
).w
* 8, Bx
(i
).h
* 16), Bx
(i
).bc
, BF
fc = offFC: bc = offBC
LINE ((Bx
(i
).c
- 1) * 8, (Bx
(i
).r
- .5) * 16)-STEP(Bx
(i
).w
* 8, Bx
(i
).h
* 16), offBC
, BF
LINE ((Bx
(i
).c
- 1) * 8, (Bx
(i
).r
- .5) * 16)-STEP(Bx
(i
).w
* 8, Bx
(i
).h
* 16), fc
, B
IF page
* th
+ r
>= 1 AND page
* th
+ r
<= selBx
(b
).maxH
THEN LP Bx(i).c + 1, Bx(i).r + r, s$
nBx = nBx + 1
Bx(nBx).c = c: Bx(nBx).r = r
Bx(nBx).w = w: Bx(nBx).h = h
Bx(nBx).fc = fc: Bx(nBx).bc = bc
Bx(nBx).o = 0
Split details, DD$, d()
CASE "TEXTBOX", "TXTBX", "TEXTBX", "TXTBOX", "TEXT BOX", "TXT BX", "TEXT BX", "TXT BOX", "BOX O TEXT" Bx(nBx).DNA = 1
nTxtBx = nTxtBx + 1
txtBx(nTxtBx).id = nBx
txtBx(nTxtBx).txt = d(2)
txtBx(nTxtBx).delim = d(3)
txtBx(nTxtBx).rowStart = 1
txtBx(nTxtBx).colStart = 1
txtBx(nTxtBx).curRow = 1
txtBx(nTxtBx).R1 = 1
txtBx(nTxtBx).R2 = 1
txtBx(nTxtBx).selected = 0
mxW = 1
Split txtBx(nTxtBx).txt, txtBx(nTxtBx).delim, tx()
txtBx(nTxtBx).maxW = mxW - (Bx(nBx).w - 2) + 1 ' display width is 2 less than bx.w, formula says add 1 so -2 + 1 = -1
txtBx
(nTxtBx
).maxH
= UBOUND(tx
) - Bx
(nBx
).h
+ 2 ' display height is -1 from bx.h + 1 IF txtBx
(nTxtBx
).maxH
< 1 THEN txtBx
(nTxtBx
).maxH
= 1 txtBx
(nTxtBx
).ubText
= UBOUND(tx
) CASE "SELECTBOX", "SELBX", "SELECTBX", "SELBOX", "SELECT BOX", "SEL BX", "SELECT BX", "SEL BOX", "MENU" Bx(nBx).DNA = 2
nSelBx = nSelBx + 1
selBx(nSelBx).id = nBx
selBx(nSelBx).txt = d(2)
selBx(nSelBx).delim = d(3)
selBx(nSelBx).sNum = 0
selBx(nSelBx).highlite = 1
selBx(nSelBx).selected = 0
Split selBx(nSelBx).txt, selBx(nSelBx).delim, tx()
selBx
(nSelBx
).maxH
= UBOUND(tx
) ' display height is -1 from bx.h + 1
newBx% = nBx
'This SUB will take a given N delimited string, and delimiter$ and create an array of N+1 strings using the LBOUND of the given dynamic array to load.
'notes: the loadMeArray() needs to be dynamic string array and will not change the LBOUND of the array it is given. rev 2019-08-27
curpos
= 1: arrpos
= LBOUND(loadMeArray
): LD
= LEN(delim
) dpos
= INSTR(curpos
, SplitMeString
, delim
) loadMeArray
(arrpos
) = MID$(SplitMeString
, curpos
, dpos
- curpos
) arrpos = arrpos + 1
curpos = dpos + LD
dpos
= INSTR(curpos
, SplitMeString
, delim
) loadMeArray
(arrpos
) = MID$(SplitMeString
, curpos
)
END FUNCTION 'last line 317 + CRLF always added at end of .bas files
IF join$
= "" THEN join$
= sa$
(i
) ELSE join$
= join$
+ CRLF$
+ sa$
(i
)
tmpFile = tmpDir + "\DIR$INF0.INF" 'aha!, not a fully pathed file to user directory but here is good!
SHELL _HIDE "DIR /a:d >" + tmpFile
'get directories but have to do a little pruning Index% = -1
d$
= _TRIM$(rightOf$
(fline$
, "<DIR>")) Index% = Index% + 1
fa(Index%) = d$
tmpFile = tmpDir + "\FILE$INF0.INF" 'aha!, not a fully pathed file to user directory but here is good!
SHELL _HIDE "DIR *.* /a:-d /b /o:-gen > " + tmpFile
Index% = -1
Index% = Index% + 1