ListAndGo 8.1 - desktop search utility and multidisc jukebox
Posted: Thu Oct 15, 2015 10:00 am
If you're perfectly proper user you have installed on your computer Copernic Desktop Search or any other indexing searcher. If you are less good, (just like me), you might appreciate ListAndGo a little tool that searches for programs on basis their name (respectively part of name).
Program can view multiple drives or directories. It is a portable program (no installation) and because it is enormously small (cca 130 kB) can be located on the same computer multiple times in multiple directories, in each with different settings. Found files can be open directly from ListAndGo.
The program is equipped with a backup for viewing temporarily disconnected external drives. Backup takes the form of a simple database of names and location of stored files. Entering the gap (as a query) creates an alphabetical list of all files.
Unlike standard tool "Search programs and files" this program seeks regardless of accents - it is extremely helpful for all non-English users.
2.0 - A major enhancement output. Announced files with complete path are arranged so that the path is always to move the end of the line and the lines are then compared alphabetically by file name. Using a lettered switches located behind the name of the program created software version adapts to search for movies, books, pictures and sounds.
3.0 - Next enhancement output. Choice of shortened form of output is present.
3.1 - Fixed a minor bug (related to Czech alphabet only).
3.2 - The full contents searched drives or directories can be obtained using spaces as a query.
3.3 - Query added to the header shortened list.
3.4 - Fixed error in backup
3.7 - Next type of output added
3.8 - Suppressing undesired flicker initial window, improved search numbers
4.0 - Unpublished version
5.0 - Separation of data files for each version, jukebox function added.
6.0 - Improved error treatment. Instead console menu are the gadgets.
6.1 - Quick start added.
7.0 - ExamineDirectory instead dir = avoid problems with CP 1250. Improving the appearance. Fixed tiny bugs.
8.0 - Big change in appearance, easier operation, greater speed, integration of all versions, fixed EditorGadget bug.
8.1 - Interrupt of Jukebox on demand added.
Program can view multiple drives or directories. It is a portable program (no installation) and because it is enormously small (cca 130 kB) can be located on the same computer multiple times in multiple directories, in each with different settings. Found files can be open directly from ListAndGo.
The program is equipped with a backup for viewing temporarily disconnected external drives. Backup takes the form of a simple database of names and location of stored files. Entering the gap (as a query) creates an alphabetical list of all files.
Unlike standard tool "Search programs and files" this program seeks regardless of accents - it is extremely helpful for all non-English users.
2.0 - A major enhancement output. Announced files with complete path are arranged so that the path is always to move the end of the line and the lines are then compared alphabetically by file name. Using a lettered switches located behind the name of the program created software version adapts to search for movies, books, pictures and sounds.
3.0 - Next enhancement output. Choice of shortened form of output is present.
3.1 - Fixed a minor bug (related to Czech alphabet only).
3.2 - The full contents searched drives or directories can be obtained using spaces as a query.
3.3 - Query added to the header shortened list.
3.4 - Fixed error in backup
3.7 - Next type of output added
3.8 - Suppressing undesired flicker initial window, improved search numbers
4.0 - Unpublished version
5.0 - Separation of data files for each version, jukebox function added.
6.0 - Improved error treatment. Instead console menu are the gadgets.
6.1 - Quick start added.
7.0 - ExamineDirectory instead dir = avoid problems with CP 1250. Improving the appearance. Fixed tiny bugs.
8.0 - Big change in appearance, easier operation, greater speed, integration of all versions, fixed EditorGadget bug.
8.1 - Interrupt of Jukebox on demand added.
Code: Select all
;*******************************************************************************
;*******************************************************************************
; Title: ListAndGo v. 8.1
; Author: Lubos (member of PB forum from 2004/02/04)
; Date of issue: 2015/10/15 (last revision 2016/08/30)
; PureBasic 5.41 LTS
; OS: Windows
; License: Free for non-commercial use
;
; Utility "ListAndGo" - serves for finding location of files in more discs or directories witth using subsets of file name
;(regardless separators, diacritic and presence of multiple chars or spaces).
; After entering a query ( single char is minimum query),
; the file containig dir list of selected discs (or directories) is inspected, line by line.
; Found items are provided with a number to enable the immediate start.
;
; The program contains five labels called by GOTO statement (AGAIN:, FORMAT:, LEAVE:, QUICK: and ITEM:).
;
; Answer.txt - numbered output
;
; Alfabet.txt - adjusted output - transfer path on the end of line and sorting own filenames alphabetically,
;
; Alfacut.txt - shortened Alfabet.txt = name files + numbers for run
;******************************************************************************
Dim Text$(1)
Dim Abc$(1)
Dim Short$(1)
Dim W.s (200)
Dim M.s (200)
Dim R.s (200)
Dim Duration.f(2)
;
;***********************************************************
#WindowWidth = 390
#WindowHeight = 350
;***********************************************************
If LoadFont(0, "Arial", 11)
SetGadgetFont(#PB_Default, FontID(0)) ; Set the loaded Arial 16 font as new standard
EndIf
;************************ Caps Lock **********************
Procedure CapsLock(Flag)
If GetKeyState_(#VK_CAPITAL) <> Flag
n.INPUT
n\type = #INPUT_KEYBOARD
n\ki\wVk = #VK_CAPITAL
n\ki\dwFlags = 0
SendInput_(1,@n,SizeOf(n))
n\ki\dwFlags = #KEYEVENTF_KEYUP
SendInput_(1,@n,SizeOf(n))
EndIf
EndProcedure
;************************ Scroll Lock **********************
Procedure ScrollLock(Flag)
If GetKeyState_(#VK_SCROLL) <> Flag
n.INPUT
n\type = #INPUT_KEYBOARD
n\ki\wVk = #VK_SCROLL
n\ki\dwFlags = 0
SendInput_(1,@n,SizeOf(n))
n\ki\dwFlags = #KEYEVENTF_KEYUP
SendInput_(1,@n,SizeOf(n))
EndIf
EndProcedure
ScrollLock(0)
;*********************************************************
Procedure RecursiveSafe_Directory(path$, List File.s())
Protected NewList ToDo.s(), hd
If Right(path$, 1) <> "\" : path$ + "\" : EndIf
AddElement(ToDo())
ToDo() = path$
ResetList(ToDo())
While NextElement(ToDo())
path$ = ToDo()
DeleteElement(ToDo())
hd = ExamineDirectory(#PB_Any, path$, "*.*")
If hd
While NextDirectoryEntry(hd)
If DirectoryEntryType(hd) = #PB_DirectoryEntry_File
AddElement(File())
File() = path$ + DirectoryEntryName(hd)
Else
If DirectoryEntryName(hd) <> "." And DirectoryEntryName(hd) <> ".."
; ajout du répertoire
AddElement(ToDo())
ToDo() = path$ + DirectoryEntryName(hd) + "\"
EndIf
EndIf
Wend
FinishDirectory(hd)
EndIf
ResetList(ToDo())
Wend
EndProcedure
NewList file.s()
;******************************************************************************
;Procedures for transforming special chars CP 1250 to diactriticless form
;and for replacing separators and spaces by one space
;changes the double characters to single (except digits)
; changes W,w to V,v
Procedure.s OneSpace(Lexical$)
Lexical$=ReplaceString(Lexical$,"Ľ", "L")
Lexical$=ReplaceString(Lexical$,"ľ", "l")
Lexical$=ReplaceString(Lexical$,"ô", "o")
Lexical$=ReplaceString(Lexical$,"ŕ", "r")
Lexical$=ReplaceString(Lexical$,"ä", "a")
Lexical$=ReplaceString(Lexical$,"ĺ", "I")
Lexical$=ReplaceString(Lexical$,"Ô", "O")
Lexical$=ReplaceString(Lexical$,"Ĺ", "L")
Lexical$=ReplaceString(Lexical$,"á", "a")
Lexical$=ReplaceString(Lexical$,"č", "c")
Lexical$=ReplaceString(Lexical$,"é", "e")
Lexical$=ReplaceString(Lexical$,"í", "i")
Lexical$=ReplaceString(Lexical$,"š", "s")
Lexical$=ReplaceString(Lexical$,"ú", "u")
Lexical$=ReplaceString(Lexical$,"ů", "u")
Lexical$=ReplaceString(Lexical$,"ž", "z")
Lexical$=ReplaceString(Lexical$,"ě", "e")
Lexical$=ReplaceString(Lexical$,"ť", "t")
Lexical$=ReplaceString(Lexical$,"ý", "y")
Lexical$=ReplaceString(Lexical$,"ř", "r")
Lexical$=ReplaceString(Lexical$,"Á", "A")
Lexical$=ReplaceString(Lexical$,"Č", "C")
Lexical$=ReplaceString(Lexical$,"Ť", "T")
Lexical$=ReplaceString(Lexical$,"Ň", "N")
Lexical$=ReplaceString(Lexical$,"Ď", "D")
Lexical$=ReplaceString(Lexical$,"Ó", "O")
Lexical$=ReplaceString(Lexical$,"É", "E")
Lexical$=ReplaceString(Lexical$,"Ě", "E")
Lexical$=ReplaceString(Lexical$,"Í", "I")
Lexical$=ReplaceString(Lexical$,"Ř", "R")
Lexical$=ReplaceString(Lexical$,"Š", "S")
Lexical$=ReplaceString(Lexical$,"Ú", "U")
Lexical$=ReplaceString(Lexical$,"Ů", "U")
Lexical$=ReplaceString(Lexical$,"Ž", "Z")
Lexical$=ReplaceString(Lexical$,"Ý", "Y")
Lexical$=ReplaceString(Lexical$,"Ä", "A")
Lexical$=ReplaceString(Lexical$,"Ŕ", "R")
Lexical$=ReplaceString(Lexical$,"["," ")
Lexical$=ReplaceString(Lexical$,"]"," ")
Lexical$=ReplaceString(Lexical$,"{"," ")
Lexical$=ReplaceString(Lexical$,"}"," ")
Lexical$=ReplaceString(Lexical$,"*", " ")
Lexical$=ReplaceString(Lexical$,"?", " ")
Lexical$=ReplaceString(Lexical$,":", " ")
Lexical$=ReplaceString(Lexical$,"/", " ")
Lexical$=ReplaceString(Lexical$,"\", " ")
Lexical$=ReplaceString(Lexical$,">", " ")
Lexical$=ReplaceString(Lexical$,"<", " ")
Lexical$=ReplaceString(Lexical$,"-", " ")
Lexical$=ReplaceString(Lexical$,"_", " ")
Lexical$=ReplaceString(Lexical$,".", " ")
Lexical$=ReplaceString(Lexical$,",", " ")
Lexical$=ReplaceString(Lexical$,";", " ")
Lexical$=ReplaceString(Lexical$,"|", " ")
Lexical$=ReplaceString(Lexical$,Chr(10), " ")
Lexical$=ReplaceString(Lexical$,Chr(13), " ")
Lexical$=ReplaceString(Lexical$,Chr(34), " ") ; "
Lexical$=ReplaceString(Lexical$,Chr(176), " ")
Lexical$=ReplaceString(Lexical$,Chr(239), "d")
Lexical$=ReplaceString(Lexical$,Chr(243), "o")
Lexical$=ReplaceString(Lexical$,Chr(242), "n")
Lexical$=ReplaceString(Lexical$,"W", "V")
Lexical$=ReplaceString(Lexical$,"w", "v")
For i = 1 To 47
One$= Chr(i)
While CountString(Lexical$,(One$+One$))
Lexical$ = ReplaceString(Lexical$,(One$+One$),One$)
Wend
Next i
For i = 58 To 255
One$= Chr(i)
While CountString(Lexical$,(One$+One$))
Lexical$ = ReplaceString(Lexical$,(One$+One$),One$)
Wend
Next i
ProcedureReturn Lexical$
EndProcedure
;-§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§
;
W(1) =" Paint filter"
M(1) ="Obrázkový filtr"
W(2) = "Custom filter"
M(2) = "Zvolený filtr"
W(3) =" No filter"
M(3) = "Bez filtru"
W(4) = " Music filter"
M(4) = "Hudební filtr"
W(5) = " Film filter"
M(5) ="Filmový filtr"
W(6) =" Text filter"
M(6) ="Textový filtr"
W(7) = "FIRST RUN"
M(7) ="???"
L$ = "This program is provided free."
L$= L$+Chr(13)+"Sale of the program is prohibited."
L$= L$+Chr(13)+"Supposed that program will be useful,"+Chr(13)+" but use is without any waranty."
L$=L$+Chr(13)+"Renaming or modifying is not allowed."
L$= L$+Chr(13)+"Suggestions for improvement posted in the forums PureBasic" +Chr(13)+"are of course welcome. "
W(8)= L$
M(8) = "Tento program je poskytován bezplatně."
M(8) =M(8)+ Chr(13)+"Prodej programu je zakázán."
W(9) = "Go out"
M(9) = "Ukončit"
W(10) = "Next list of directories is default example."
W(10)= W(10)+ Chr(13) +Chr(13)
W(10)=W(10)+ "It will necessary to edit the list displayed in next step!"
W(11) = "QUICK START "
M(11) = "RYCHLÝ START"
W(12) = "Old backup: "
W(13) = "Exit"
M(13) = "Konec"
;-§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§
For i = 1 To 200
R(i) =W(i)
Next i
;-VERSION
Stopka=1
;-aaaaaaaaaaaaaaa
OpenWindow(0, 100, 200, #WindowWidth, #WindowHeight, "ListAndGo v. 8.1", #PB_Window_MinimizeGadget)
Top = 10
GadgetHeight = 24
FrameGadget(#PB_Any, 10, Top, 370, 290, "") : Top+20
PanelGadget(3, 20, Top, #WindowWidth-50, #WindowHeight-Top-60)
AddGadgetItem(3, 0," MENU ")
ButtonGadget(41, 50, 199, 240, GadgetHeight, W(2) )
StringGadget(49, 20,199, 24, GadgetHeight, " X")
ButtonGadget(42, 50, 10, 240, GadgetHeight,W(3) )
StringGadget(50, 20,10, 24, GadgetHeight, "")
ButtonGadget(43, 50, 48, 240, GadgetHeight,W(5))
StringGadget(51, 20,48, 24, GadgetHeight, " F")
ButtonGadget(44, 50, 86, 240, GadgetHeight, W(6))
StringGadget(52, 20, 86, 24, GadgetHeight, " T")
ButtonGadget(45, 50, 124, 240, GadgetHeight,W(4))
StringGadget(53, 20,124, 24, GadgetHeight, " M")
ButtonGadget(46, 50, 161, 240, GadgetHeight,W(1))
StringGadget(54, 20,161, 24, GadgetHeight, " P")
;===============================================
If FileSize("Directory.txt") = -1
DisableGadget(50,1)
Else
DisableGadget(50,0)
SetGadgetColor(50, #PB_Gadget_BackColor,$FACE87)
EndIf
If FileSize("Directoryx.txt") = -1
DisableGadget(49,1)
Else
DisableGadget(49,0)
SetGadgetColor(49, #PB_Gadget_BackColor, $7280FA )
EndIf
If FileSize("Directoryf.txt") = -1
DisableGadget(51,1)
Else
DisableGadget(51,0)
SetGadgetColor(51, #PB_Gadget_BackColor , $29DDE9)
EndIf
If FileSize("Directoryt.txt") = -1
DisableGadget(52,1)
Else
DisableGadget(52,0)
SetGadgetColor(52, #PB_Gadget_BackColor , $2AD75C)
EndIf
If FileSize("Directorym.txt") = -1
DisableGadget(53,1)
Else
DisableGadget(53,0)
SetGadgetColor(53, #PB_Gadget_BackColor, $DFE25C)
EndIf
If FileSize("Directoryp.txt") = -1
DisableGadget(54,1)
Else
DisableGadget(54,0)
SetGadgetColor(54, #PB_Gadget_BackColor,$F5B4FB)
EndIf
;============================================
AddGadgetItem(3, 1," INFO ")
Top = 10
TextGadget(16,50,10,240,200, W(8))
CloseGadgetList()
OptionGadget(401,#WindowWidth-150, #WindowHeight-352, 80, 20, "ENG")
OptionGadget(409,#WindowWidth-50, #WindowHeight-352, 80, 20, "CZ")
HideGadget(401,1) ; temporarily - preparing for version 9.0
HideGadget(409,1); temporarily
TextGadget (9, 10, #WindowHeight-30, 250, 24, Chr(169) +" Luboš Svoboda 2016")
ButtonGadget(48, #WindowWidth-100, #WindowHeight-36, 90, 24, W(13) )
SetGadgetState(3, 0)
SetGadgetState(409,0)
Repeat
If GetGadgetState(409) = 1
SetGadgetText(16,M(8))
SetGadgetText(41,M(2))
SetGadgetText(42,M(3))
SetGadgetText(43,M(5))
SetGadgetText(44,M(6))
SetGadgetText(45,M(4))
SetGadgetText(46,M(1))
SetGadgetText(48,M(13))
For i = 1 To 200
If M(i)<>""
W(i)=M(i)
EndIf
Next i
EndIf
If GetGadgetState(409) = 0
SetGadgetText(16,R(8))
SetGadgetText(41,R(2))
SetGadgetText(42,R(3))
SetGadgetText(43,R(5))
SetGadgetText(44,R(6))
SetGadgetText(45,R(4))
SetGadgetText(46,R(1))
SetGadgetText(48,R(13))
For i = 1 To 200
W(i)=R(i)
Next i
EndIf
Event = WaitWindowEvent()
If Event = #PB_Event_Gadget
Select EventGadget()
Case 41; CustomJukebox
Cliend.s ="X"
Stopka=0
Event = #PB_Event_CloseWindow
Case 42 ; No filter
Cliend.s=""
Stopka=0
Event = #PB_Event_CloseWindow
Case 43 ; film
Cliend.s ="F"
Stopka=0
Event = #PB_Event_CloseWindow
Case 44 ; text
Cliend.s="T"
Stopka=0
Event = #PB_Event_CloseWindow
Case 45 ; music
Cliend.s="M"
Stopka=0
Event = #PB_Event_CloseWindow
Case 46 ; paint
Cliend.s="P"
Stopka=0
Event = #PB_Event_CloseWindow
Case 48 ; Go out...
Became = 48
Event = #PB_Event_CloseWindow
EndSelect
EndIf
Until Event = #PB_Event_CloseWindow
CloseWindow(0)
If Became = 48
End
EndIf
;-aaaaaaaaaaaaaaa
If Stopka=1
End
EndIf
;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Ext$ ="- no filter"
Ink =$FACE87
If Cliend.s = "T"
Ext$ =" - text filter"
Ink = $2AD75C
EndIf
If Cliend.s ="X"
Ext$ =" - custom filter"
Ink = $7280FA
EndIf
If Cliend.s = "M"
Ext$ =" - music filter"
Ink = $DFE25C
EndIf
If Cliend.s = "P"
Ext$ =" - picture filter"
Ink = $F5B4FB
EndIf
If Cliend.s = "F"
Ext$ =" - film filter"
Ink = $29DDE9
EndIf
;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
CreateFile(0, "Source"+Cliend.s+".txt")
CloseFile(0)
If OpenFile(3,"Backup"+Cliend.s+".txt")
Bck = Lof(3)
EndIf
If Bck > 0
Result = GetFileDate("Backup"+Cliend.s+".txt",#PB_Date_Modified )
Title1$ = W(11)+ Ext$
Title2$ = W(12)+ Str(Bck)+" B "+Chr(13)+"Last modified: "+ FormatDate("%dd. %mm. %yyyy", Result)
;-1.choice
;-bbbbbbbbbbbbbb
OpenWindow(0, 100, 200, #WindowWidth, #WindowHeight, Title1$, #PB_Window_MinimizeGadget)
Top = 10
GadgetHeight = 24
FrameGadget(#PB_Any, 10, Top, 370, 290, "") : Top+20
PanelGadget(3, 20, Top, #WindowWidth-50, #WindowHeight-Top-60)
AddGadgetItem(3, 0, "First choice")
TextGadget(84, 50,20,300,60, Title2$)
ButtonGadget(86, 50, 78, 240, GadgetHeight, "Quick start from old backup")
ButtonGadget(87, 50, 116, 240, GadgetHeight,"Scan state for decision about source")
CloseGadgetList()
ButtonGadget(88, #WindowWidth-100, #WindowHeight-36, 80, 24, W(9))
SetGadgetState(3, 0)
TextGadget (9, 10, #WindowHeight-30, 250, 24, Chr(169) +" Luboš Svoboda 2016")
StringGadget(11,#WindowWidth-50, #WindowHeight-352, 38, 22, " "+ Cliend + " ")
SetGadgetColor(11,#PB_Gadget_BackColor,Ink)
Repeat
Became = 0
Event = WaitWindowEvent()
If Event = #PB_Event_Gadget
Select EventGadget()
Case 86
Became = 86
Event = #PB_Event_CloseWindow
Case 87
HideWindow(0,1)
Became = 87
Event = #PB_Event_CloseWindow
Case 88
Became = 88
Event = #PB_Event_CloseWindow
EndSelect
EndIf
Until Event = #PB_Event_CloseWindow
If Became = 88
Goto LEAVE
EndIf
;-bbbbbbbbbbb
If Became = 86
Source$=Path$ +"Backup"+Cliend.s+".txt"
A$="Backup"+Cliend.s
Goto QUICK
ElseIf Became = 0
End
Else ; Became = 87
; no action
EndIf
EndIf
;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
FirstRun=0
If OpenFile (2,"Directory"+Cliend.s+".txt")
If Lof(2) = 0
FirstRun=1
CloseFile(2)
EndIf
EndIf
If FirstRun = 1
;-jjjjjjjjjjj
OpenWindow(0, 100, 200, #WindowWidth, #WindowHeight, W(7), #PB_Window_MinimizeGadget)
Top = 10
GadgetHeight = 24
Top = 10
GadgetHeight = 24
FrameGadget(#PB_Any, 10, Top, 370, 290, "") : Top+20
PanelGadget(3, 20, Top, #WindowWidth-50, #WindowHeight-Top-60)
AddGadgetItem(3, 0, "Search of files")
TextGadget(31, 50, 40, 240, 160, W(10))
ButtonGadget(36, 50, 188, 240, GadgetHeight, " Continue")
CloseGadgetList()
ButtonGadget(38, #WindowWidth-100, #WindowHeight-36, 90, 24, W(13))
SetGadgetState(3, 0)
StringGadget(11,#WindowWidth-50, #WindowHeight-352, 38, 22, " "+ Cliend + " ")
SetGadgetColor(11,#PB_Gadget_BackColor,Ink)
TextGadget (9, 10, #WindowHeight-30, 250, 24, Chr(169) +" Luboš Svoboda 2016")
Repeat
Event = WaitWindowEvent()
If Event = #PB_Event_Gadget
Select EventGadget()
Case 36
Became = 36
Event = #PB_Event_CloseWindow
Case 38
Became = 38
Event = #PB_Event_CloseWindow
EndSelect
EndIf
Until Event = #PB_Event_CloseWindow
;-jjjjjjjjjjj
If Became = 36
; continue
Else
DeleteFile("Directory"+Cliend.s+".txt")
End
EndIf
If OpenFile(2,"Directory"+Cliend.s+".txt")
WriteStringN (2, "DON'T EDIT THIS LINE!")
WriteStringN(2, "")
WriteStringN (2, "C:\Users\John\Dogs\")
WriteStringN (2, "E:\Animals\Pets")
WriteStringN (2, "F:\")
WriteStringN (2,"")
WriteStringN (2,"")
WriteStringN (2,"")
WriteStringN (2," Example of list of the directories for search the query.")
WriteStringN (2," The list of directories can be edited in this file as needed.")
WriteStringN (2," Change of saved list is possible at next run of program.")
WriteStringN(2, "")
WriteStringN(2, "")
WriteStringN(2, "")
WriteStringN(2, " IMPORTANT!")
WriteStringN(2, "")
WriteStringN (2," EDIT the list of directories as needed!")
WriteStringN(2, "")
WriteStringN(2, "")
WriteStringN (2," Then SAVE file and CLOSE the Notepad!")
C$=GetCurrentDirectory()+"Directory"+Cliend.s+".txt"
CloseFile(2)
EndIf
EndIf
CloseFile(#PB_All)
RunProgram(GetCurrentDirectory()+"Directory"+Cliend.s+".txt","" ,GetCurrentDirectory(),#PB_Program_Wait )
;******************************************************************************
Path$=GetCurrentDirectory()
Source$=Path$+"Source"+Cliend.s+".txt"
A$="Source"+Cliend.s
If CreateFile(2,Source$)
CloseFile(2)
EndIf
;
If OpenWindow(0, 100, 200,390,350, "INITIAL PREPARING ")
TextGadget(33, 100, 120, 250, 60, RemoveString(Ext$,"-"))
TextGadget(31, 80, 50, 250, 60, " List And Go")
TextGadget(32, 120, 250, 250, 60, " Wait . . .")
StartDrawing(WindowOutput(0))
Circle(80, 175, 30, Ink)
StopDrawing()
EndIf
Start1 = ElapsedMilliseconds()
If OpenFile (2,"Directory"+Cliend.s+".txt")
If DeleteFile ("Source"+Cliend.s+".txt")
EndIf
Active$ ="Active directories:" +Chr(13)
Nonfu$ = "Nonfunctional directories." + Chr(13)
While Eof(2) = 0
Reading$=ReadString(2,#PB_Ascii )
If FindString(Reading$,":")>0
Result =FindString(Reading$,"*")
If Result > 0
Reading$ = Mid(Reading$,1,Result-1)
EndIf
CutReading$=ReverseString(Reading$)
Crop=FindString(CutReading$,".",1)
If Crop>0
CutReading$= Mid(CutReading$,Crop)
Crop=FindString(CutReading$,"\",1)
CutReading$= Mid(CutReading$,Crop)
EndIf
CutReading$=ReverseString(CutReading$)
CutReading$=RemoveString(CutReading$," ",1)
If FileSize(CutReading$) = -2 And Len( CutReading$) > 1
RecursiveSafe_Directory(Reading$, file())
If OpenFile(0, "Source"+Cliend.s+".txt")
ForEach file()
WriteStringN(0, file(),#PB_Ascii)
Next
CloseFile(0)
EndIf
EndIf
If FileSize(CutReading$) = -2 And Len( CutReading$) > 1
Active$=Active$ + CutReading$+Chr(13)
EndIf
If FileSize(CutReading$) <> -2 And Len( CutReading$) > 1
Nonfunctional=1
Nonfu$=Nonfu$ + CutReading$ +Chr(13)
EndIf
EndIf
Wend
CloseFile(2)
EndIf
CloseWindow(0)
Src = FileSize("Source"+Cliend.s+".txt")
If Src < 0
Src = 0
EndIf
Bck = FileSize("Backup"+Cliend.s+".txt")
If Bck< 0
Bck = 0
EndIf
;-ccccccccccccccc
;-2.choice
Title1$ = "SOURCE SELECTION" + Ext$
OpenWindow(0, 100, 200, #WindowWidth, #WindowHeight, Title1$, #PB_Window_MinimizeGadget)
Top = 10
GadgetHeight = 24
FrameGadget(#PB_Any, 10, Top, 370, 290, "") : Top+20
PanelGadget(3, 20, Top, #WindowWidth-50, #WindowHeight-Top-60)
AddGadgetItem(3, 0, "Second choice")
EditorGadget(61, 5, 10, 325, 140,#PB_Editor_ReadOnly)
SetGadgetColor(61,#PB_Gadget_FrontColor,$FF0000)
SetGadgetItemText(61, 1, Active$+Chr(13)+Nonfu$)
If Nonfunctional=1
SetGadgetColor(61,#PB_Gadget_FrontColor,$0000FF)
EndIf
ButtonGadget(76, 50, 160, 240, GadgetHeight, "Use old backup file "+ Str(Bck)+" B", #PB_Button_Left )
ButtonGadget(77, 50, 190, 240, GadgetHeight, "Use present state "+Str(Src)+" B"+ Chr(13), #PB_Button_Left )
If Bck=0
DisableGadget(76,1)
EndIf
If Src=0
DisableGadget(77,1)
EndIf
CloseGadgetList()
ButtonGadget(78, #WindowWidth-100, #WindowHeight-36, 80, 24, W(9))
Duration(1) = (ElapsedMilliseconds()-Start1)*0.001
StringGadget(79,#WindowWidth-380, #WindowHeight-352, 180, 22, "Source built: "+ StrF(Duration(1),1)+ " s")
StringGadget(11,#WindowWidth-50, #WindowHeight-352, 38, 22, " "+ Cliend + " ")
SetGadgetColor(11,#PB_Gadget_BackColor,Ink)
SetGadgetState(3, 0)
TextGadget (9, 10, #WindowHeight-30, 250, 24, Chr(169) +" Luboš Svoboda 2016")
Repeat
Became = 0
Event = WaitWindowEvent()
If Event = #PB_Event_Gadget
Select EventGadget()
Case 76
Became = 76
Source$=Path$ +"Backup"+Cliend.s+".txt"
A$="Backup"+Cliend.s
Event = #PB_Event_CloseWindow
Case 77
Became = 77
; Source$ remain
Event = #PB_Event_CloseWindow
Case 78
Became = 78
InputResult$=""
Event = #PB_Event_CloseWindow
EndSelect
EndIf
Until Event = #PB_Event_CloseWindow
If Became = 78
Goto LEAVE
EndIf
If Became = 0
End
EndIf
;-ccccccccccccccc
QUICK:
If IsFile(3)
CloseFile(3)
EndIf
If Cliend.s = "X"
;-kkkkkkkkkkk
OpenWindow(0, 100, 200, #WindowWidth, #WindowHeight, "PRESELECTION", #PB_Window_MinimizeGadget)
Top = 10
GadgetHeight = 24
FrameGadget(#PB_Any, 10, Top, 370, 290, "") : Top+20
PanelGadget(3, 20, Top, #WindowWidth-50, #WindowHeight-Top-60)
AddGadgetItem(3, 0, "Input of type of files")
StringGadget(101, 50, 40, 240, GadgetHeight, "",#PB_Text_Border)
SetGadgetColor(101,#PB_Gadget_FrontColor,$008000)
SetGadgetColor(101, #PB_Gadget_BackColor, $FFFFFF)
SetActiveGadget(101)
ButtonGadget(106, 50, 78, 240, GadgetHeight, "Type of file")
TextGadget(107, 50, 116, 300, 90, "Please specify the file type to perform" +Chr(13)+"first selection.")
CloseGadgetList()
ButtonGadget(108, #WindowWidth-100, #WindowHeight-36, 80, 24, W(9))
SetGadgetState(3, 0)
StringGadget(11,#WindowWidth-50, #WindowHeight-352, 38, 22, " "+ Cliend + " ")
SetGadgetColor(11,#PB_Gadget_BackColor,Ink)
TextGadget (9, 10, #WindowHeight-30, 250, 24, Chr(169) +" Luboš Svoboda 2016")
Repeat
Became = 0
Event = WaitWindowEvent()
If Event = #PB_Event_Gadget
Select EventGadget()
Case 106
Became = 106
Input$=GetGadgetText(101)
If Input$ =""
Input$ = " "
EndIf
CharLower_(Input$)
Event = #PB_Event_CloseWindow
Case 108
Became = 108
Event = #PB_Event_CloseWindow
EndSelect
EndIf
Until Event = #PB_Event_CloseWindow
If Became = 108
Goto Leave
EndIf
If Became = 0
End
EndIf
;-kkkkkkkkkk
EndIf
Title1$="QUERY " + Ext$
Title4$=""
;-AGAIN
AGAIN:
Total=0
Empty=0
Relevant=0
B$=""
If RelevantMax > 0
Goto ITEM
EndIf
If RelevantMax < 0
RelevantMax=0
Title1$ =Plug$ + "NEW QUERY " + Ext$
Plug$ =""
Goto AGAIN
EndIf
;-ddddddddddddddd
;-SEARCH
OpenWindow(0, 100, 200, #WindowWidth, #WindowHeight, "SEARCH" +Ext$, #PB_Window_MinimizeGadget)
Top = 10
GadgetHeight = 24
FrameGadget(#PB_Any, 10, Top, 370, 290, "") : Top+20
PanelGadget(3, 20, Top, #WindowWidth-50, #WindowHeight-Top-60)
AddGadgetItem(3, 0, "Choice of files")
StringGadget(51, 50, 40, 240, GadgetHeight, "",#PB_Text_Border)
SetGadgetColor(51,#PB_Gadget_FrontColor,$FF0000)
SetGadgetColor(51, #PB_Gadget_BackColor, $FFFFFF)
SetActiveGadget(51)
ButtonGadget(56, 50, 78, 240, GadgetHeight, " Query")
ButtonGadget(57, 50, 116, 240, GadgetHeight," All files (Jukebox mode)")
CloseGadgetList()
ButtonGadget(58, #WindowWidth-100, #WindowHeight-36, 80, 24, W(9))
SetGadgetState(3, 0)
StringGadget(11,#WindowWidth-50, #WindowHeight-352, 38, 22, " "+ Cliend + " ")
SetGadgetColor(11,#PB_Gadget_BackColor,Ink)
TextGadget (9, 10, #WindowHeight-30, 250, 24, Chr(169) +" Luboš Svoboda 2016")
Repeat
Became = 0
Event = WaitWindowEvent()
If Event = #PB_Event_Gadget
Select EventGadget()
Case 56
Became = 56
PrimeQuest$=GetGadgetText(51)
Event = #PB_Event_CloseWindow
Case 57
Became = 57
PrimeQuest$=" "
Event = #PB_Event_CloseWindow
Case 58
Became = 58
Event = #PB_Event_CloseWindow
EndSelect
EndIf
Until Event = #PB_Event_CloseWindow
If Became = 0
End
EndIf
;-ddddddddddddddd
Title4$=""
Quest$ = PrimeQuest$
CharLower_(Quest$) ; command CharLower_ () origins from Windows API - is better than Ucase()
Quest$=OneSpace(Quest$)
;********************************************************************************
LEAVE:
;-LEAVE
If Became = 8 Or Became = 26 Or Became = 58 Or Became = 68 Or Became = 78 Or Became = 88 Or Became = 98 Or Became = 108
If RelevantMax=0
PostMessage_(FindWindow_(@"notepad", 0), #WM_CLOSE, 0, 0)
Title1$ = "TERMINATION" + Ext$
Title2$ = "New source file: "+Str(Src)+" B"+ Chr(13) +"Old backup file: "+ Str(Bck)+" B"+ Chr(13)+ Chr(13)
Title3$ = Title2$+"If it's meaningful, make a backup now!"
If Title5$ <>""
Title2$ = Title5$
EndIf
;-eeeeeeeee
OpenWindow(0, 100, 200, #WindowWidth, #WindowHeight, Title1$, #PB_Window_MinimizeGadget)
Top = 10
GadgetHeight = 24
FrameGadget(#PB_Any, 10, Top, 370, 290, "") : Top+20
PanelGadget(3, 20, Top, #WindowWidth-50, #WindowHeight-Top-60)
AddGadgetItem(3, 0, "Last operations")
If Source$=Path$ +"Backup"+Cliend.s+".txt"
Title3$ = "No new source file! "+ Chr(13) +"Old backup file: "+ Str(Bck)+" B"
EndIf
TextGadget(24,50,10,260,160,Title3$)
ButtonGadget(26, 50, 148, 240, GadgetHeight, "Save new backup")
If Became = 26 Or Src = 0
DisableGadget(26,1)
TextGadget(24,50,10,260,160,Title2$)
EndIf
ButtonGadget(27, 50, 186, 240, GadgetHeight,W(13))
CloseGadgetList()
SetGadgetState(3, 0)
StringGadget(11,#WindowWidth-50, #WindowHeight-352, 38, 22, " "+ Cliend + " ")
SetGadgetColor(11,#PB_Gadget_BackColor,Ink)
TextGadget (9, 10, #WindowHeight-30, 250, 24, Chr(169) +" Luboš Svoboda 2016")
Became = 0
Repeat
Event = WaitWindowEvent()
If Event = #PB_Event_Gadget
Select EventGadget()
Case 26
Became = 26
If CopyFile(Source$, Path$+ "Backup"+Cliend.s+".txt")
Title5$ = "Old backup file: "+Str(Bck)+" B"+ Chr(13) +"New backup file: "+ Str(Src)+" B"+ Chr(13)+ Chr(13)
EndIf
Event = #PB_Event_CloseWindow
Case 27
End
Event = #PB_Event_CloseWindow
EndSelect
EndIf
Until Event = #PB_Event_CloseWindow
If Became =26
Goto Leave
EndIf
If Became = 0
End
EndIf
;-eeeeeeeee
EndIf
;-ITEM
ITEM:
Title1$ = "RUN ITEM" + Ext$
;-fffffffffffffff
;-STARTUP
OpenWindow(0, 100, 200, #WindowWidth, #WindowHeight, Title1$, #PB_Window_MinimizeGadget)
Top = 10
GadgetHeight = 24
FrameGadget(#PB_Any, 10, Top, 370, 290, "") : Top+20
PanelGadget(3, 20, Top, #WindowWidth-50, #WindowHeight-Top-60)
AddGadgetItem(3, 0, "Startup items")
TextGadget(60, 50,20,300,GadgetHeight,"Valid range: 1 - "+Str(RelevantMax))
StringGadget(61, 50, 40, 240, GadgetHeight, "",#PB_Text_Border);, #PB_String_Numeric )
SetGadgetColor(61,#PB_Gadget_FrontColor,$0000FF)
SetGadgetColor(61, #PB_Gadget_BackColor, $FFFFFF)
SetActiveGadget(61)
InputResult$=GetGadgetText(61)
InputResult$=ReplaceString(InputResult$,Chr(35), "")
TextGadget(65, 15,70,330,GadgetHeight,"More items separated by commas can be used.")
ButtonGadget(66, 50, 98, 240, GadgetHeight, " Start")
ButtonGadget(67, 50, 136, 240, GadgetHeight," Format menu")
ButtonGadget(64, 50, 180, 240, GadgetHeight," New query")
CloseGadgetList()
ButtonGadget(68, #WindowWidth-100, #WindowHeight-36, 80, 24, W(9))
SetGadgetState(3, 0)
StringGadget(11,#WindowWidth-50, #WindowHeight-352, 38, 22, " "+ Cliend + " ")
SetGadgetColor(11,#PB_Gadget_BackColor,Ink)
TextGadget (9, 10, #WindowHeight-30, 250, 24, Chr(169) +" Luboš Svoboda 2016")
Repeat
Became = 0
Event = WaitWindowEvent()
If Event = #PB_Event_Gadget
Select EventGadget()
Case 64
Became = 64
Event = #PB_Event_CloseWindow
Case 66
Became = 66
InputResult$=GetGadgetText(61)
Event = #PB_Event_CloseWindow
Case 67
Became = 67
Event = #PB_Event_CloseWindow
Case 68
Became = 68
RelevantMax=0
Event = #PB_Event_CloseWindow
EndSelect
EndIf
Until Event = #PB_Event_CloseWindow
;-fffffffffffff
If Became = 0
End
EndIf
If Became = 68
Goto Leave
EndIf
;--CutReading$
If Became = 67
Goto FORMAT
EndIf
If Became = 64
RelevantMax = 0
Title1$="NEW QUERY " + Ext$
Goto AGAIN
EndIf
If Became = 66
If (Val(InputResult$)) =< 0 Or Val(InputResult$) > RelevantMax
Title4$ = InputResult$
Goto ITEM
Else
Salami$ = InputResult$ + ","
While CountString(Salami$,",,")
Salami$ = ReplaceString(Salami$,",,",",")
Wend
Howmuch = CountString(InputResult$,",")
CloseWindow(0)
For k = 1 To Howmuch +1
Found = FindString(Salami$,",",1)
Shred$=Mid(Salami$,1,Found-1)
Salami$=Mid(Salami$,Found+1)
If (Val(Shred$)) =< 0 Or Val(Shred$) > RelevantMax
Continue
EndIf
If RunProgram(Text$(Val(Shred$)),"",Path$,#PB_Program_Wait )
EndIf
Next k
Goto ITEM
EndIf
EndIf
EndIf
;*******************************************************************************
If CreateFile(1, "Answer"+Cliend.s+".txt")
Else
SetFileAttributes("Answer"+Cliend.s+".txt", #PB_FileSystem_Normal)
EndIf
If CreateFile(1, "Answer"+Cliend.s+".txt")
Else
MessageRequester("Create file error for:", "Answer"+Cliend.s+".txt")
PostMessage_(FindWindow_(@"notepad", 0), #WM_CLOSE, 0, 0)
Goto AGAIN
EndIf
If CreateFile(5,"Alfabet"+Cliend.s+".txt")
Else
SetFileAttributes("Alfabet"+Cliend.s+".txt", #PB_FileSystem_Normal)
EndIf
If CreateFile(5,"Alfabet"+Cliend.s+".txt")
Else
MessageRequester("Create file error for:", "Alfabet"+Cliend.s+".txt")
PostMessage_(FindWindow_(@"notepad", 0), #WM_CLOSE, 0, 0)
Goto AGAIN
EndIf
If CreateFile(6,"Alfacut"+Cliend.s+".txt")
Else
SetFileAttributes("Alfacut"+Cliend.s+".txt", #PB_FileSystem_Normal)
EndIf
If CreateFile(6,"Alfacut"+Cliend.s+".txt")
Else
MessageRequester("Create file error for:", "Alfacut"+Cliend.s+".txt")
PostMessage_(FindWindow_(@"notepad", 0), #WM_CLOSE, 0, 0)
Goto AGAIN
EndIf
If Superstopka = 1
End
EndIf
;*******************************************************************************
OpenWindow(0, 100, 200,390,350, "SEARCHING "+ Ext$)
TextGadget(1, 120, 150, 250, 60, " Wait . . .")
StartDrawing(WindowOutput(0))
Circle(80, 175, 30, Ink)
StopDrawing()
;*******************************************************************************
If ReadFile(0, Source$)
Start2 = ElapsedMilliseconds()
WriteStringN (5, "Automatically overwritten file. For safekeeping saved under another name! ")
WriteStringN (5, " ")
WriteStringN (5, "Preselection: "+Input$ + " (any case sensitive)")
WriteStringN (5, " ")
WriteStringN (5, "Entering expression: "+ PrimeQuest$)
WriteStringN (5, "Demanded expression: "+ Quest$)
WriteStringN (5, " ")
WriteStringN (6, " ")
WriteStringN (6, " Demanded expression: "+ Quest$)
WriteStringN (6, " ")
While Eof(0) = 0
PrimeRow$=ReadString(0,#PB_Ascii )
Total =Total+1
Small$ = PrimeRow$
CharLower_(Small$)
Filter=0
If Cliend.s=""
Filter= 1 ; without cli - no filteration
EndIf
Ext$ ="- no filter"
If Cliend.s = "T"
Text= FindString (Small$,".doc") + FindString (Small$,".docx") + FindString (Small$,".mobi") + FindString (Small$,".txt")
Text = Text + FindString (Small$,".rtf") + FindString (Small$,".epub") + FindString (Small$,".pdf")
Text = Text + FindString (Small$,".lit") + FindString (Small$,".zip") + FindString (Small$,".rar")
Text = Text + FindString (Small$,".djvu") + FindString (Small$,".azw") + FindString (Small$,".pdb")+ FindString (Small$,".odt")
Text = Text + FindString (Small$,".html") + FindString (Small$,".prc") + FindString (Small$,".mht") + FindString (Small$,".mp3")
Filter = Text
Ext$ =" - text filter"
EndIf
If Cliend.s ="X"
Filter= FindString (Small$,Input$)
Ext$ =" - custom filter (" +Input$ +")"
EndIf
If Cliend.s = "M"
Music= FindString (Small$,".mp3") + FindString (Small$,".flv") + FindString (Small$,".wav") + FindString (Small$,".webm")
Music = Music + FindString (Small$,".ogg") + FindString (Small$,".wma") + FindString (Small$,".midi")+ FindString (Small$,".flac")
Music = Music + FindString (Small$,".zip") + FindString (Small$,".rar")
Filter = Music
Ext$ =" - music filter"
EndIf
If Cliend.s = "P"
Pictur = FindString (Small$,".jpg") + FindString (Small$,".png") + FindString (Small$,".bmp") + FindString (Small$,".ico")
Pictur = Pictur + FindString (Small$,".gif") + FindString (Small$,".tiff") + FindString (Small$,".djvu")
Pictur = Pictur + FindString (Small$,".zip") + FindString (Small$,".rar")+ FindString (Small$,".pdf")
Filter = Pictur
Ext$ =" - picture filter"
EndIf
If Cliend.s = "F"
Film= FindString (Small$,".avi") + FindString (Small$,".mp4") + FindString (Small$,".flv") + FindString (Small$,".webm")
Film = Film + FindString (Small$,".mkv") + FindString (Small$,".bup") + FindString (Small$,".bin")
Film = Film + FindString (Small$,".zip") + FindString (Small$,".rar") + FindString (Small$,".ts")
Filter=Film
Ext$ =" - film filter"
EndIf
If Len(PrimeRow$)=0 Or (Filter = 0)
Empty = Empty +1
Else
Row$ = " "+Small$
Row$=OneSpace(Row$)
Find = FindString(Row$, Quest$,1)
If Find > 0
Relevant = Relevant+1
If Relevant = 1
WriteStringN (5, " ")
WriteStringN (5, "======================================= ")
WriteStringN (5, " ")
EndIf
Trnsf$ = ReverseString(PrimeRow$)
Cut = FindString(Trnsf$,"\",1)
Trn1$ = ReverseString(Mid(Trnsf$,1, Cut-1))
Trn2$ = ReverseString(Mid(Trnsf$,Cut))
Trnsf$ = Trn1$ + " ==> "+Trn2$
ReDim Text$(Relevant)
ReDim Abc$(Relevant)
ReDim Short$ (Relevant)
WriteString (1," "+Str(Relevant)+"#")
WriteStringN (1, " "+PrimeRow$)
Text$(Relevant)=PrimeRow$
Abc$(Relevant)= " "+ Trnsf$+ " "+Str(Relevant) +"# "
Short$(Relevant)=Trn1$ + " "+Str(Relevant)+"# "
WriteStringN (1, " ")
EndIf
EndIf
Wend
SortArray(Abc$(),#PB_Sort_Ascending |#PB_Sort_NoCase )
SortArray(Short$(),#PB_Sort_Ascending |#PB_Sort_NoCase )
Nz=0
For i =1 To Relevant
WriteStringN (5, " " +Abc$(i))
WriteStringN (5, " ")
If Short$(i)<>""
Nz=Nz+1
WriteStringN (6, " " +Short$(i))
WriteStringN (6, " ")
EndIf
Next i
RelevantMax=Relevant
If Relevant = 0
RelevantMax=-1
EndIf
Duration(2) = (ElapsedMilliseconds() - Start2)*0.001
WriteStringN (5, " ")
WriteStringN (5, "======================================= ")
WriteStringN (5, " ")
WriteStringN (5, " ")
WriteStringN (5, "Source lines: "+ Str(Total) )
WriteStringN (5, "Empty lines: "+ Str(Empty))
WriteStringN (5, "Valid lines: "+ Str(Total-Empty))
WriteStringN (5, "Time: "+ StrF(Duration(2),1) +" s")
WriteStringN (5, " ")
WriteStringN (5, " ")
WriteStringN (5, "Result lines: "+ Str(Relevant))
WriteStringN (5, " ")
WriteStringN (6, " ")
WriteStringN (6, "Result lines: "+ Str(Nz))
WriteStringN (6, " ")
WriteStringN (5, " ")
WriteStringN (5, "Instance directory: "+Path$)
WriteStringN (5, " ")
If FindString(Source$,"Source")
WriteStringN (5, "Active directories for the creation of a source file:")
WriteStringN (5, " ")
WriteStringN (5, Active$)
EndIf
If FindString(Source$,"Backup")
Date$ = FormatDate("%yyyy/%mm/%dd", GetFileDate("Backup"+Cliend.s+".txt", #PB_Date_Modified ) )
WriteStringN (5, "Backup file from " + Date$ + " is used to create the source file.")
WriteStringN (5, " ")
EndIf
WriteStringN (5, "The source file is saved as: "+ Source$)
WriteStringN (5, " ")
WriteStringN (5, "For the purpose of the search were used temporarily modified lines of source file.")
WriteStringN (5, "Diacritics marks and special chars were removed.")
WriteStringN (5, "Double chars were converted to simple.")
WriteStringN (5, "All chars were transformed to lower case.")
WriteStringN (5, "In the same way was modified query.")
WriteStringN (5, " ")
WriteStringN (5, " ")
WriteStringN (5, "====================================================== ")
WriteStringN (5, " ")
WriteStringN (5, "ListAndGo"+ Ext$ + " v. 8.1 ")
WriteStringN (6, "ListAndGo"+ Ext$ + " v. 8.1 ")
WriteStringN (1, " ")
WriteStringN (1, "ListAndGo"+ Ext$ + " v. 8.1 ")
CloseFile(0)
CloseFile(1)
CloseFile(5)
CloseFile(6)
SetFileAttributes("Answer"+Cliend.s+".txt", #PB_FileSystem_ReadOnly)
SetFileAttributes("Alfabet"+Cliend.s+".txt", #PB_FileSystem_ReadOnly)
SetFileAttributes("Alfacut"+Cliend.s+".txt", #PB_FileSystem_ReadOnly)
EndIf
;*******************************************************************************
CloseWindow(0)
If Relevant= 0
Plug$ =("NO RESULT => ")
Goto AGAIN
Else
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
If LoadFont(0, "Arial", 11)
SetGadgetFont(#PB_Default, FontID(0)) ; Set the loaded Arial 16 font as new standard
EndIf
;-ggggggggggggg
Superstopka = 1
;-FORMAT
FORMAT:
OpenWindow(0, 100, 200, #WindowWidth, #WindowHeight, "FORMAT OF RESULTS" + Ext$, #PB_Window_MinimizeGadget)
Top = 10
GadgetHeight = 24
FrameGadget(#PB_Any, 10, Top, 370, 290, "") : Top+20
PanelGadget(3, 20, Top, #WindowWidth-50, #WindowHeight-Top-60)
AddGadgetItem(3, 0, "Choice of format")
ButtonGadget(4, 50, 180, 240, GadgetHeight, " JUKEBOX")
If Quest$ =" "
DisableGadget(4,0)
Else
DisableGadget(4,1)
EndIf
ButtonGadget(5, 50, 40, 240, GadgetHeight, " Name ==> Path\ Number#")
ButtonGadget(6, 50, 78, 240, GadgetHeight, " Name Number#")
ButtonGadget(7, 50, 116, 240, GadgetHeight," Number# Path\Name")
GadgetToolTip(4, "This choice gradually starts items recorded in Jukebox.txt file.")
GadgetToolTip(5, "Displays search results in the appropriate format.")
GadgetToolTip(6, "Displays search results in the appropriate format.")
GadgetToolTip(7, "Displays search results in the appropriate format.")
CloseGadgetList()
TextGadget (9, 10, #WindowHeight-30, 250, 24, Chr(169) +" Luboš Svoboda 2016")
StringGadget(111,#WindowWidth-380, #WindowHeight-352, 180, 22, "Search took: "+ StrF(Duration(2),1)+ " s")
StringGadget(11,#WindowWidth-50, #WindowHeight-352, 38, 22, " "+ Cliend + " ")
SetGadgetColor(11,#PB_Gadget_BackColor,Ink)
ButtonGadget(8, #WindowWidth-100, #WindowHeight-36, 80, 24, W(9))
SetGadgetState(3, 0)
Repeat
Became = 0
Event = WaitWindowEvent()
If Event = #PB_Event_Gadget
Select EventGadget()
Case 4 ; Jukebox
Became = 4
B$="Jukebox"
If OpenFile(4,"Jukebox"+Cliend.s+".txt")
If Lof(4)=0
WriteStringN(4,"****************************Don't edit next line!*************************")
WriteStringN(4,"No editable line. Edit next lines.")
EndIf
CloseFile(4)
EndIf
Title1$ = "DIRECTIVE FOR JUKEBOX LIST"
Title2$ = " " + Chr(13)
Title2$ = Title2$+"The list of items can be edited in the file Jukebox.txt as needed."
Title2$ = Title2$+ Chr (13) + " Change of adjustment is possible at any time."
Title2$ = Title2$+ Chr(13)+ " Use only one number per line for new item."
; Title2$ = Title2$+ Chr(13)+ " Don't use # with inputed number. Write digits only. "
Title2$ = Title2$+ Chr(13)+" Name of new item and # will fullfiled automatically. "
;Title2$ = Title2$+ Chr(13)+Chr(13) +"Press OK to view the file Jukebox.txt!"
;-hhhhhhh
;-JUKEBOX
OpenWindow(0, 100, 200, #WindowWidth, #WindowHeight, "JUKEBOX MEMORY" + Ext$, #PB_Window_MinimizeGadget)
Top = 10
GadgetHeight = 24
FrameGadget(#PB_Any, 10, Top, 370, 290, "") : Top+20
PanelGadget(3, 20, Top, #WindowWidth-50, #WindowHeight-Top-60)
AddGadgetItem(3, 0, "Jukebox list")
TextGadget(61, 50, 0, 240, 220, Title2$);, #PB_String_Numeric)
ButtonGadget(64, 50, 200, 240, GadgetHeight," Show list")
CloseGadgetList()
ButtonGadget(68, #WindowWidth-100, #WindowHeight-36, 80, 24, W(9))
SetGadgetState(3, 0)
StringGadget(11,#WindowWidth-50, #WindowHeight-352, 38, 22, " "+ Cliend + " ")
SetGadgetColor(11,#PB_Gadget_BackColor,Ink)
TextGadget (9, 10, #WindowHeight-30, 250, 24, Chr(169) +" Luboš Svoboda 2016")
Repeat
Became = 0
Event = WaitWindowEvent()
If Event = #PB_Event_Gadget
Select EventGadget()
Case 64
Became = 64
Event = #PB_Event_CloseWindow
Case 68
Became = 68
InputResult$=""
Event = #PB_Event_CloseWindow
EndSelect
EndIf
Until Event = #PB_Event_CloseWindow
If Became = 68
Goto LEAVE
EndIf
If Became = 0
End
EndIf
;-hhhhhhh
CloseWindow(0)
RunProgram(GetCurrentDirectory()+"Jukebox"+Cliend.s+".txt","" ,GetCurrentDirectory(),#PB_Program_Wait)
Title1$= "JUKEBOX" + Ext$
Title2$ = "Copy of Jukebox"+Cliend.s + ".txt will saved as Mirror"+Cliend.s+ ".txt."+Chr(13)
Title2$ = Title2$ + "Mirror"+Cliend+" file serves for viewing of Jukebox"+Cliend+" list." +Chr(13)
;-iiiiiiiiiii
OpenWindow(0, 100, 200, #WindowWidth, #WindowHeight, Title1$, #PB_Window_MinimizeGadget)
Top = 10
GadgetHeight = 24
FrameGadget(#PB_Any, 10, Top, 370, 290, "") : Top+20
PanelGadget(3, 20, Top, #WindowWidth-50, #WindowHeight-Top-60)
AddGadgetItem(3, 0, "Start of jukebox")
ButtonGadget(96, 50, 70, 240, GadgetHeight, "Run jukebox")
ButtonGadget(97, 50, 180, 240, GadgetHeight,"New startup files")
TextGadget(95, 10, 20, 340,90, Title2$)
TextGadget(595,10,100,300,75,"For stop of Jukebox just push Caps Lock!"+Chr(13)+"Use of Scroll Lock (Fn + C) is possible too." + Chr(13)+"Currently playing song will continue to the end.")
SetGadgetColor(595,#PB_Gadget_FrontColor, $0000FF )
CloseGadgetList()
ButtonGadget(98, #WindowWidth-100, #WindowHeight-36, 80, 24, W(9))
SetGadgetState(3, 0)
StringGadget(11,#WindowWidth-50, #WindowHeight-352, 38, 22, " "+ Cliend + " ")
SetGadgetColor(11,#PB_Gadget_BackColor,Ink)
TextGadget (9, 10, #WindowHeight-30, 250, 24, Chr(169) +" Luboš Svoboda 2016")
Repeat
Became = 0
Event = WaitWindowEvent()
If Event = #PB_Event_Gadget
Select EventGadget()
Case 96
Became = 96
Reading$=""
If IsFile(4)
CloseFile(4)
EndIf
If OpenFile (4,"Jukebox"+Cliend.s+".txt")
If IsFile(7)
CloseFile(7)
EndIf
If CreateFile (7,"Mirror"+Cliend.s+".txt")
WriteStringN(7,"****************************Don't edit next line!*************************")
WriteStringN(7,"No editable line. Edit next lines.")
While Eof(4) = 0
Reading$=ReadString(4,#PB_Ascii )
If FindString(Reading$,"#") > 0
Cut = FindString(Reading$,"#",1)
Reading$= Mid(Reading$,1, Cut-1)
EndIf
If Val(Reading$) > 0 And Val(Reading$) < RelevantMax+1 And Len(Reading$) < 8
Trnsf$ = ReverseString(Text$(Val(Reading$)))
Cut = FindString(Trnsf$,"\",1)
Trn1$ = ReverseString(Mid(Trnsf$,1, Cut-1))
WriteStringN(7,Reading$+"#"+Space (10-Len(Reading$))+Trn1$)
EndIf
Wend
EndIf
EndIf
CloseFile(4)
CloseFile(7)
CopyFile("Mirror"+Cliend.s+".txt","Jukebox"+Cliend.s+".txt")
PostMessage_(FindWindow_(@"notepad", 0), #WM_CLOSE, 0, 0)
;XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
If OpenFile(7,"Mirror"+Cliend.s+".txt")
FileSeek(7,0)
WriteStringN(7, "MIRROR OF JUKEBOX FILE ONLY! ANY EDITATION IS USELESS!" )
WriteStringN(7, " ")
CloseFile(7)
EndIf
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
If OpenFile (4,"Jukebox"+Cliend.s+".txt")
CloseWindow(0)
While Eof(4) = 0
Reading$=ReadString(4,#PB_Ascii )
If FindString(Reading$,"#") > 0
Cut = FindString(Reading$,"#",1)
Reading$= Mid(Reading$,1, Cut-1)
EndIf
If Val(Reading$) > 0 And Val(Reading$) < RelevantMax
Compiler= RunProgram(Text$(Val(Reading$)),"",GetCurrentDirectory(),#PB_Program_Open)
If GetKeyState_(#VK_SCROLL) = 1 Or GetKeyState_(#VK_CAPITAL) = 1
KillProgram(Compiler)
Break
EndIf
If IsProgram(Compiler)
WaitProgram(Compiler)
EndIf
EndIf
Wend
CloseFile(4)
If GetKeyState_(#VK_SCROLL) = 1
ScrollLock(0)
EndIf
If GetKeyState_(#VK_CAPITAL)
CapsLock(0)
EndIf
EndIf
; End ; finish jukebox and program too
;Else
Goto AGAIN
; EndIf
Event = #PB_Event_CloseWindow
Case 97
Result = 7
Became = 97
Event = #PB_Event_CloseWindow
Case 98
Became = 98
Quest$ = ""
RelevantMax = 0
Event = #PB_Event_CloseWindow
EndSelect
EndIf
Until Event = #PB_Event_CloseWindow
If Became = 0
End
EndIf
If Became = 98
Goto LEAVE
EndIf
;-iiiiiiiiiiiiiiiiii
Case 5 ; Name ==> Path\ Number#
Became = 5
Superstopka = 0
B$="Alfabet"
HideWindow(0,1)
Event = #PB_Event_CloseWindow
Case 6 ; Name Number#"
Became = 6
Superstopka = 0
B$="Alfacut"
HideWindow(0,1)
Event = #PB_Event_CloseWindow
Case 7 ; Path\Name Number#"
Became = 7
Superstopka = 0
B$="Answer"
HideWindow(0,1)
Event = #PB_Event_CloseWindow
Case 8 ; Go out...
Became = 8
Quest$ = ""
RelevantMax = 0
Event = #PB_Event_CloseWindow
EndSelect
EndIf
Until Event = #PB_Event_CloseWindow
;-ggggggggggggg
If Became = 98 Or Became = 8
Goto LEAVE
EndIf
If Became = 0
End
EndIf
EndIf
;zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz
If B$=""
Goto LEAVE
EndIf
If B$="Jukebox"
Goto AGAIN
Else
RunProgram(GetCurrentDirectory()+ B$+""+Cliend.s+".txt")
Title1$ = "NEW QUERY " +Ext$
PostMessage_(FindWindow_(@"notepad", 0), #WM_CLOSE, 0, 0)
Goto AGAIN
EndIf
;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
End