MakeInstall
Posted: Mon Oct 02, 2017 11:37 am
updated 26 July 2018
Mr.Kibernetik software support
https://nitisara.ru/forum/
Code: Select all
/*
MakeInstall Prep by rbytes, Aug 2018
Creates an install list for MakeInstall by Dutchman
Customized for Datamine 3
*/
OPTION BASE 1
SET BUTTONS CUSTOM
SET TOOLBAR OFF
laun$=LAUNCHER$ ()
GET SCREEN SIZE sw,sh
iostest=0
IF iostest THEN
sw=568
sh=320
dev$=""
ENDIF
rw=sw/1024!rh=sh/740
lf$=CHR$(10)
Savepath$="/MakeInstall/"
'SET OUTPUT FONT SIZE 18*rw
DIR$="/Datamine 3/" '*** set to root directory by default if no path is entered
SHADOW ON
/*'*** Create interface ***
FIELD "display" TEXT display$ AT 0,0 SIZE sw,sh ML RO
FIELD "display" HIDE
FIELD "display" FONT NAME "Courier"
FIELD "display" FONT SIZE 18*rw
'r'
'*** User preferences ***
FILE$=Savepath$&"/install.list" '*** file where list will be saved
Indent$=" " '*** indents each folder-level, e.g. "#" or " "
''
'*** Prepare to scan folders and files
TEXT
TEXT CLEAR
FIELD "search" HIDE
'*** Print scanning information on the text screen
IF DIR$="/" THEN path$="root directory" ELSE path$="path "&DIR$
PRINT
IF LEN(path$)<20 THEN
PRINT " Scanning files and folders in ";path$
ELSE
PRINT " Scanning files and folders in ";path$
ENDIF
IF DIR$="/" THEN
PRINT " (About 24 seconds or 7.7 progress bars)"
PRINT
ELSE
PAUSE 3 '*** allows time to read processing information
ENDIF
IF LEFT$(REVERSE$(DIR$),1)<>"/" THEN DIR$&="/"
IF NOT FILE_EXISTS(DIR$) THEN
PRINT "Folder """&DIR$&""" not found"
STOP
ENDIF
'*** Scan files and folders
IF FILE_EXISTS(FILE$) THEN FILE FILE$ DELETE
CALL Content(FILE$,DIR$,Indent$,SEARCH$)
TEXT CLEAR
'*** Advise user of next phase - formatting the list ***
IF SEARCH$<>"" THEN
searchinfo$="Search string is """&SEARCH$&"""."&lf$
ELSE
searchinfo$=""
ENDIF
'PRINT
'PRINT " Formatting a scrollable list (takes about 3 seconds)"
cnt=0
WHILE NOT FILE_END(FILE$)
FILE FILE$ READLINE temp$
IF SEARCH$="" THEN
display$&=temp$&lf$
ELSE
IF INSTR(temp$,"#")<>-1 THEN
IF temp$=display2$ THEN
'display$&=display2$&lf$
trig=0
ELSE
display2$=temp$
'fndfold+=1
'display$&=temp$&lf$
trig=1
ENDIF
ENDIF
IF INSTR(LOWSTR$(temp$),SEARCH$)<>-1 THEN
IF trig=1 AND display3$<>display2$ THEN
fndfold+=1
display$&=lf$&display2$&lf$
display3$=display2$
ENDIF
fndfile+=1
display$&=temp$&lf$
ENDIF
ENDIF
END WHILE
print
run "MakeInstall.sb"
end
'*** Function Definitions
DEF bp(a$) = BUTTON_PRESSED(a$) '*** Detect a pressed button
DEF Content(FILE$,DIR$,Indent$,SEARCH$) '*** Write contents of folder Dir$ to File$
' Folder-names are preceded by "#"
' Indent$ is added at each level
' If Content.number<>0 then names
' will be preceded by level-number&"|"
' Dirs and Files-count are written to
' .Dirs and .Files
'---------- by Dutchman, 2017 ----------
IF numbers THEN Level$=Level&"|" ELSE Level$=""
FILE FILE$ PRINT Tab$&Level$;"#";DIR$
.DIRS+=1
Tab$&=Indent$
level+=1
IF numbers THEN Level$=Level&"|" ELSE Level$=""
Leader$=Tab$&level$
'*** List files and dirs
Content$="" ' clear for this folder
DIR DIR$ LIST FILES F1$,n1
DIR DIR$ LIST DIRS F2$,n2
FOR i=1 TO n1
'exclude files that should not be included
if F1$(i) = "Datamine V3.1 copy.sb" then skip2
if F1$(i) = "Datamine V3.sb" then skip2
if F1$(i) = "MakeInstall.sb" then skip2
if F1$(i) = "MakeInstall.info" then skip2
if F1$(i) = "MakeInstall Prep.sb" then skip2
if F1$(i) = "install.list" then skip2
if instr(F1$(i),"Log ")<>-1 then skip2
Content$&=F1$(i)&","
skip2:
NEXT i
FOR i=1 TO n2
'exclude folders that should not be included
IF F2$(i)="Datamine 3" THEN skip
'IF F2$(i)="Utilities" THEN skip
IF F2$(i)="Config" THEN skip
IF F2$(i)="Save" THEN skip
IF F2$(i)="Dump" THEN skip
IF F2$(i)="Export" THEN skip
IF F2$(i)="Import" THEN skip
IF F2$(i)="Database 2" THEN skip
IF F2$(i)="Images 2" THEN skip
IF F2$(i)="Notes 2" THEN skip
IF F2$(i)="CD Music" THEN skip
IF F2$(i)="Countries" THEN skip
IF F2$(i)="Countries copy" THEN skip
IF F2$(i)="Countries test" THEN skip
IF F2$(i)="Winesold" THEN skip
IF F2$(i)="Personnel" THEN skip
IF F2$(i)="Snakes" THEN skip
IF F2$(i)="Online Example" THEN skip
Content$&="#"&F2$(i)&","
skip:
NEXT i
'*** Write contents
WHILE LEN(Content$)>1
p=INSTR(Content$,",")
F$=LEFT$(Content$,p-1)
Content$=RIGHT$(Content$,LEN(Content$)-p)
IF INSTR(F$,"#")<1 THEN '** is file
FILE FILE$ PRINT Leader$&F$
.FILES+=1
ELSE ' is folder
'PRINT CHR$(9632); ' progress bar not needed for small batch
f$=DIR$&RIGHT$(f$,LEN(F$)-1)&"/"
CALL Content(FILE$,f$,Indent$,SEARCH$)
ENDIF
END WHILE
RETURN
ENDDEF