LiberKey offline files sorter
Posted: Mon Nov 22, 2010 10:42 pm
I use a wonderful little portable menuing system called LiberKey and recently learned how to get it to store the updates locally for me to give to other people, rather than just updating LiberKey and then deleting them.
That left me with the problem of keeping them sorted in the order the LiberKey installs them (Category, subcategory) as my friends didn't want ALL the updates.
So I created a text catalogue file of all the updates available on the LiberKey site with Category/Subcategory/Filebasename and made this sorter.
Now when I have a few hundred megabytes of offline LiberKey updates, I just run this sorter.
Save this list below as "LiberSort.Idx" in the same directory that you intend to run the sorter in.
P.S You will have to get your own graphics, this project didn't warrant a package job.
That left me with the problem of keeping them sorted in the order the LiberKey installs them (Category, subcategory) as my friends didn't want ALL the updates.
So I created a text catalogue file of all the updates available on the LiberKey site with Category/Subcategory/Filebasename and made this sorter.
Now when I have a few hundred megabytes of offline LiberKey updates, I just run this sorter.
Code: Select all
;==================================================================================================
;
;==================================================================================================
; Window Constants
Enumeration 1
#Window_LiberSort
EndEnumeration
#WindowIndex = #PB_Compiler_EnumerationValue
Enumeration 1
; Window_LiberSort
#Gadget_LiberSort_fmain
#Gadget_LiberSort_pwork
#Gadget_LiberSort_twork
#Gadget_LiberSort_terror
#Gadget_LiberSort_ftosortfrom
#Gadget_LiberSort_tosortfrom
#Gadget_LiberSort_ftosortto
#Gadget_LiberSort_tosortto
#Gadget_LiberSort_fgetsortfiles
#Gadget_LiberSort_getsortfiles
#Gadget_LiberSort_fgettargetdir
#Gadget_LiberSort_gettargetdir
#Gadget_LiberSort_frunjob
#Gadget_LiberSort_runjob
#Gadget_LiberSort_flabels
#Gadget_LiberSort_lsourcedir
#Gadget_LiberSort_sourcedir
#Gadget_LiberSort_ltargetdir
#Gadget_LiberSort_targetdir
#Gadget_LiberSort_fexit
#Gadget_LiberSort_ferrors
#Gadget_LiberSort_errors
#Gadget_LiberSort_exit
EndEnumeration
#GadgetIndex = #PB_Compiler_EnumerationValue
; Image Constants
Enumeration 1
#Image_LiberSort_twork
#Image_LiberSort_terror
#Image_LiberSort_getsortfiles
#Image_LiberSort_gettargetdir
#Image_LiberSort_runjob
#Image_LiberSort_exit
EndEnumeration
#ImageIndex = #PB_Compiler_EnumerationValue
; Load Images
CatchImage(#Image_LiberSort_twork, ?_OPT_LiberSort_twork)
CatchImage(#Image_LiberSort_terror, ?_OPT_LiberSort_terror)
CatchImage(#Image_LiberSort_getsortfiles, ?_OPT_LiberSort_getsortfiles)
CatchImage(#Image_LiberSort_gettargetdir, ?_OPT_LiberSort_gettargetdir)
CatchImage(#Image_LiberSort_runjob, ?_OPT_LiberSort_runjob)
CatchImage(#Image_LiberSort_exit, ?_OPT_LiberSort_exit)
DataSection
_OPT_LiberSort_twork : IncludeBinary "Images\sort16x16.ico"
_OPT_LiberSort_terror : IncludeBinary "Images\errors16x16.ico"
_OPT_LiberSort_getsortfiles : IncludeBinary "Images\folder cyan open 32x32.ico"
_OPT_LiberSort_gettargetdir : IncludeBinary "Images\directory32x32.ico"
_OPT_LiberSort_runjob : IncludeBinary "Images\run32x32.ico"
_OPT_LiberSort_exit : IncludeBinary "Images\exit32x32.ico"
EndDataSection
;==================================================================================================
;
;==================================================================================================
Procedure.l Window_LiberSort()
If OpenWindow(#Window_LiberSort, 21, 64, 865, 655, "", #PB_Window_SystemMenu|#PB_Window_MinimizeGadget|#PB_Window_MaximizeGadget|#PB_Window_ScreenCentered|#PB_Window_Invisible)
Frame3DGadget(#Gadget_LiberSort_fmain, 5, 0, 855, 645, "")
PanelGadget(#Gadget_LiberSort_pwork, 15, 15, 835, 620)
AddGadgetItem(#Gadget_LiberSort_pwork, -1, " Main work form", ImageID(#Image_LiberSort_twork))
Frame3DGadget(#Gadget_LiberSort_ftosortfrom, 5, 0, 255, 510, "")
ListIconGadget(#Gadget_LiberSort_tosortfrom, 15, 15, 235, 485, "Source files", 231, #PB_ListIcon_FullRowSelect|#PB_ListIcon_AlwaysShowSelection)
SetGadgetFont(#Gadget_LiberSort_tosortfrom, LoadFont(#Gadget_LiberSort_tosortfrom, "Arial", 10, 0))
Frame3DGadget(#Gadget_LiberSort_ftosortto, 265, 0, 560, 510, "")
ListIconGadget(#Gadget_LiberSort_tosortto, 275, 15, 540, 485, "Category", 233, #PB_ListIcon_FullRowSelect|#PB_ListIcon_AlwaysShowSelection)
AddGadgetColumn(#Gadget_LiberSort_tosortto, 1, "Filename", 233)
AddGadgetColumn(#Gadget_LiberSort_tosortto, 2, "Status", 70)
SetGadgetFont(#Gadget_LiberSort_tosortto, LoadFont(#Gadget_LiberSort_tosortto, "Arial", 10, 0))
Frame3DGadget(#Gadget_LiberSort_fgetsortfiles, 5, 515, 60, 70, "")
ButtonImageGadget(#Gadget_LiberSort_getsortfiles, 15, 535, 40, 40, ImageID(#Image_LiberSort_getsortfiles))
Frame3DGadget(#Gadget_LiberSort_fgettargetdir, 70, 515, 60, 70, "")
ButtonImageGadget(#Gadget_LiberSort_gettargetdir, 80, 535, 40, 40, ImageID(#Image_LiberSort_gettargetdir))
Frame3DGadget(#Gadget_LiberSort_frunjob, 135, 515, 60, 70, "")
ButtonImageGadget(#Gadget_LiberSort_runjob, 145, 535, 40, 40, ImageID(#Image_LiberSort_runjob))
Frame3DGadget(#Gadget_LiberSort_flabels, 200, 515, 560, 70, "")
TextGadget(#Gadget_LiberSort_lsourcedir, 210, 530, 45, 15, "Source")
SetGadgetFont(#Gadget_LiberSort_lsourcedir, LoadFont(#Gadget_LiberSort_lsourcedir, "Arial", 10, 0))
StringGadget(#Gadget_LiberSort_sourcedir, 260, 530, 490, 20, "", #PB_String_ReadOnly)
SetGadgetFont(#Gadget_LiberSort_sourcedir, LoadFont(#Gadget_LiberSort_sourcedir, "Arial", 8, 0))
TextGadget(#Gadget_LiberSort_ltargetdir, 210, 555, 45, 15, "Target")
SetGadgetFont(#Gadget_LiberSort_ltargetdir, LoadFont(#Gadget_LiberSort_ltargetdir, "Arial", 10, 0))
StringGadget(#Gadget_LiberSort_targetdir, 260, 555, 490, 20, "", #PB_String_ReadOnly)
SetGadgetFont(#Gadget_LiberSort_targetdir, LoadFont(#Gadget_LiberSort_targetdir, "Arial", 8, 0))
Frame3DGadget(#Gadget_LiberSort_fexit, 765, 515, 60, 70, "")
ButtonImageGadget(#Gadget_LiberSort_exit, 775, 535, 40, 40, ImageID(#Image_LiberSort_exit))
AddGadgetItem(#Gadget_LiberSort_pwork, -1, " Errors and status information", ImageID(#Image_LiberSort_terror))
Frame3DGadget(#Gadget_LiberSort_ferrors, 5, 0, 820, 590, "")
ListIconGadget(#Gadget_LiberSort_errors, 15, 15, 800, 565, "Status message", 140, #PB_ListIcon_FullRowSelect|#PB_ListIcon_AlwaysShowSelection)
AddGadgetColumn(#Gadget_LiberSort_errors, 1, "Explanation", 656)
SetGadgetFont(#Gadget_LiberSort_errors, LoadFont(#Gadget_LiberSort_errors, "Arial", 10, 0))
CloseGadgetList()
HideWindow(#Window_LiberSort, 0)
ProcedureReturn WindowID(#Window_LiberSort)
EndIf
EndProcedure
;==================================================================================================
; Constants for statusbar handling and colouring
;==================================================================================================
#SB_SETBKCOLOR = $2001 ; Statusbar colour constant
;==================================================================================================
; My personal constants
;==================================================================================================
#Author = "Miklós G Bolváry" ; Author's name
#CopyRight = "PeriTek Visions 2010" ; Copyright holder
#Version = "v0.00" ; Program version
#Regstring = " --* Freeware *-- " ; Registration string
#Basename = "LiberSort " ; Base name for ini and dataabse
#Program = #Basename + #Version + #Regstring ; Copyright string
#Traynote = #Basename + #Version ; Copyright string
#Eol = Chr(13) + Chr(10) ; End of line marker
#TitleTime = 1
;==================================================================================================
; Tooltip structure data
;==================================================================================================
Structure ToolTipData ; If any tooltips setup, keep track of gadgets that have them so you can remove them if needed
Window.i
Gadget.i
Handle.i
EndStructure
;==================================================================================================
; All program variables
;==================================================================================================
Structure ProgramData
QuitValue.i ; Program quit flag
Mutex.i ; Open window flag
TrayState.i ; Is the form minimised to the system tray
ColourToggle.i ; Alternate list display banding
ToolTips.i ; Tool tips on or off
FormFade.i ; Save the window animation state
ScreenSnap.i ; Save screen snapping state
TitleTime.i ; Is the timer supposed to be on or off
CurrentDir.s ; The current directory
WindowTitle.s ; The main window title
EndStructure
;==================================================================================================
; Custom date routine structure
;==================================================================================================
Structure DateStructure ; Custom date routine
Year.w
Month.w
DayOfWeek.w
Day.w
Hour.w
Minute.w
Second.w
Milliseconds.w
EndStructure
;==================================================================================================
; LiberSort index structure
;==================================================================================================
Structure IndexData
Directory.s
BaseFilename.s
EndStructure
;==================================================================================================
; Any global variables, lists etc
;==================================================================================================
Global Program.ProgramData ; Structure to hold program data
Global NewList Index.IndexData()
Global NewList FoundDirs.s() ; List of dirs found by the search engine
Global NewList ToolTips.ToolTipData() ; All tool tip handles and data here
Global td.SYSTEMTIME ; This is used as interface for time and date conversions
Global TitleString.s ; The old window title string
;==================================================================================================
; NetMaestro's screen snap code
;==================================================================================================
Global screenW, screenH, SnapD = 50, AutoSnap = #True ;
SystemParametersInfo_(#SPI_GETWORKAREA, 0, @wa.RECT, 0) ; Client area of the desktop
ScreenW = wa\right ;
screenH = wa\bottom ;
;==================================================================================================
; Get working directories variables and create the physical dirs that go with them
;==================================================================================================
Program\CurrentDir = GetCurrentDirectory() ; Get the current directory name
;==================================================================================================
; Setup day and month literal names
;==================================================================================================
Global Dim NameOfDay.s(7) ; Fill an array with the names of the days (Terry Hough I think)
NameOfDay(0) = "Sunday"
NameOfDay(1) = "Monday"
NameOfDay(2) = "Tuesday"
NameOfDay(3) = "Wednesday"
NameOfDay(4) = "Thursday"
NameOfDay(5) = "Friday"
NameOfDay(6) = "Saturday"
Global Dim DaysPerMonth(12) ; Fill an array on how many days per month there are
For X = 0 To 11
DaysPerMonth(X) = 31
Next
DaysPerMonth(1) = 28
DaysPerMonth(3) = 30
DaysPerMonth(5) = 30
DaysPerMonth(8) = 30
DaysPerMonth(10) = 30
Global Dim NameOfMonth.s(12) ; Fill an array with the names of the months
NameOfMonth(0) = "January"
NameOfMonth(1) = "February"
NameOfMonth(2) = "March"
NameOfMonth(3) = "April"
NameOfMonth(4) = "May"
NameOfMonth(5) = "June"
NameOfMonth(6) = "July"
NameOfMonth(7) = "August"
NameOfMonth(8) = "September"
NameOfMonth(9) = "October"
NameOfMonth(10) = "November"
NameOfMonth(11) = "December"
Global Dim Years.s(7) ; Fill an array with the years
Years(0) = "2002"
Years(1) = "2003"
Years(2) = "2004"
Years(3) = "2005"
Years(4) = "2006"
Years(5) = "2007"
Years(6) = "2008"
;==================================================================================================
; All my shortcuts and other things
;==================================================================================================
Enumeration #GadgetIndex
#Systray_LiberSort_Tray ; Program tray constant
#Shortcut_LiberSort_Exit ;
EndEnumeration
;==================================================================================================
; All my image constants
;==================================================================================================
Enumeration #ImageIndex
#Image_LiberSort_Tray ; Program tray icon
EndEnumeration
;==================================================================================================
; Catch images from memory
;==================================================================================================
CatchImage(#Image_LiberSort_Tray, ?_PTK_LiberSort_Tray) ; database16x16.ico Minimised tray icon
;==================================================================================================
; Include images in the exe file
;==================================================================================================
DataSection
_PTK_LiberSort_Tray : IncludeBinary "Images\Analyse16x16.ico" ;
EndDataSection
;==================================================================================================
;
;==================================================================================================
Declare GetSourceDirectory()
Declare GetSourceFiles()
Declare GetTargetDirectory()
Declare SortFiles()
Declare LastLine(Gadget, LineNumber)
;====================================================================================================
; Universal, recursive search engine
;====================================================================================================
Procedure GetSourceDirectory()
SourceDir.s = PathRequester("LiberKey data path", "")
If SourceDir.s
AddGadgetItem(#Gadget_LiberSort_errors, -1, "Setting source" + Chr(10) + "<°)))o><²³ Setting source directory " + SourceDir.s)
SetGadgetText(#Gadget_LiberSort_sourcedir, SourceDir.s)
GetSourceFiles()
Else
AddGadgetItem(#Gadget_LiberSort_errors, -1, "Source abort" + Chr(10) + "<°)))o><²³ User didn't bother to select a source path or already exists")
EndIf
EndProcedure
;====================================================================================================
; Universal, recursive search engine
;====================================================================================================
Procedure GetSourceFiles()
If CountGadgetItems(#Gadget_LiberSort_tosortfrom) <> 0
ClearGadgetItems(#Gadget_LiberSort_tosortfrom)
EndIf
SearchDir.s = GetGadgetText(#Gadget_LiberSort_sourcedir)
If SearchDir.s
AddGadgetItem(#Gadget_LiberSort_errors, -1, "Fetching files" + Chr(10) + "<°)))o><²³ Retrieving files from " + SearchDir.s)
SetGadgetText(#Gadget_LiberSort_sourcedir, SearchDir.s)
ClearList(FoundDirs.s())
If SearchDir.s <> ""
If Right(SearchDir.s, 1) = "\"
SearchDir.s = Left(SearchDir.s, Len(SearchDir.s) - 1)
EndIf
AddElement(FoundDirs.s())
FoundDirs.s() = SearchDir.s
Index = 0
Repeat
SelectElement(FoundDirs.s(), Index)
Directory = ExamineDirectory(#PB_Any, FoundDirs.s(), "*.*")
If Directory
Path.s = FoundDirs.s() + "\"
While NextDirectoryEntry(Directory)
Filename.s = DirectoryEntryName(Directory)
Select DirectoryEntryType(Directory)
Case 1
While WindowEvent() : Wend
If LCase(GetExtensionPart(Path + Filename)) = "lks"
Counter + 1
AddGadgetItem(#Gadget_LiberSort_tosortfrom, -1, FileName.s)
SetWindowTitle(#Window_LiberSort, Program\WindowTitle + Str(Counter) + " Files found")
; Colour alternate lines in grey shades of colour
If Program\ColourToggle = 1
Program\ColourToggle = 0
SetGadgetItemColor(#Gadget_LiberSort_tosortfrom, Counter -1, #PB_Gadget_BackColor, $D4D4D4)
ElseIf Program\ColourToggle = 0
Program\ColourToggle = 1
SetGadgetItemColor(#Gadget_LiberSort_tosortfrom, Counter -1, #PB_Gadget_BackColor, $C1C1C1)
EndIf
EndIf
Case 2
Filename.s = DirectoryEntryName(Directory)
If Filename.s <> ".." And Filename.s <> "."
AddElement(FoundDirs())
FoundDirs() = Path + Filename.s
EndIf
EndSelect
Wend
FinishDirectory(Directory)
EndIf
Index + 1
Until Index > ListSize(FoundDirs()) -1
EndIf
Else
AddGadgetItem(#Gadget_LiberSort_errors, -1, "Source abort" + Chr(10) + "<°)))o><²³ The selected directory to search is empty")
EndIf
EndProcedure
;==================================================================================================
;
;==================================================================================================
Procedure GetTargetDirectory()
TargetDir.s = PathRequester("LiberKey data path", "")
If TargetDir.s
AddGadgetItem(#Gadget_LiberSort_errors, -1, "Setting target" + Chr(10) + "<°)))o><²³ Setting target directory " + TargetDir.s)
SetGadgetText(#Gadget_LiberSort_targetdir, TargetDir.s)
Else
AddGadgetItem(#Gadget_LiberSort_errors, -1, "Target abort" + Chr(10) + "<°)))o><²³ User didn't bother to select a target path or it already exists")
EndIf
EndProcedure
;==================================================================================================
;
;==================================================================================================
Procedure SortFiles()
SourceDir.s = GetGadgetText(#Gadget_LiberSort_sourcedir)
TargetDir.s = GetGadgetText(#Gadget_LiberSort_targetdir)
If SourceDir.s <> TargetDir.s
If TargetDir.s
NumFiles = CountGadgetItems(#Gadget_LiberSort_tosortfrom) - 1
For SortLoop = NumFiles To 0 Step -1
CurrentFile.s = GetGadgetItemText(#Gadget_LiberSort_tosortfrom, SortLoop)
ForEach(Index())
If FindString(CurrentFile.s, Index()\BaseFilename, 1)
TargetDirString.s = TargetDir.s + Index()\Directory + "\"
If MakeSureDirectoryPathExists_(TargetDirString.s) = #True
If CopyFile(SourceDir.s + CurrentFile.s, TargetDirString.s + CurrentFile.s)
Counter + 1
While WindowEvent() : Wend
AddGadgetItem(#Gadget_LiberSort_tosortto, -1, Index()\Directory + Chr(10) + Index()\BaseFilename + Chr(10) + "Okay")
SetWindowTitle(#Window_LiberSort, Program\WindowTitle + Str(Counter) + " " + CurrentFile.s)
DeleteFile(SourceDir.s + CurrentFile.s)
RemoveGadgetItem(#Gadget_LiberSort_tosortfrom, SortLoop)
LastLine(#Gadget_LiberSort_tosortto, Counter - 1)
Else
AddGadgetItem(#Gadget_LiberSort_errors, -1, "Cannot move" + Chr(10) + SourceDir.s + CurrentFile.s)
EndIf
Else
AddGadgetItem(#Gadget_LiberSort_errors, -1, "Dir create fail" + Chr(10) + "<°)))o><²³ Cannot create " + TargetDirString.s)
EndIf
Else
; String not found. Discard and try next one
EndIf
Next
Next SortLoop
Else
AddGadgetItem(#Gadget_LiberSort_errors, -1, "Sort aborted" + Chr(10) + "<°)))o><²³ Target sort directory was not specified")
EndIf
Else
AddGadgetItem(#Gadget_LiberSort_errors, -1, "Sort disallowed" + Chr(10) + "<°)))o><²³ The source and target directories must not be the same, bad things can happen")
EndIf
EndProcedure
;==================================================================================================
;
;==================================================================================================
Procedure SortFiles()
SourceDir.s = GetGadgetText(#Gadget_LiberSort_sourcedir)
TargetDir.s = GetGadgetText(#Gadget_LiberSort_targetdir)
If SourceDir.s <> TargetDir.s
If TargetDir.s
NumFiles = CountGadgetItems(#Gadget_LiberSort_tosortfrom) - 1
For SortLoop = NumFiles To 0 Step -1
CurrentFile.s = GetGadgetItemText(#Gadget_LiberSort_tosortfrom, SortLoop)
ForEach(Index())
If FindString(CurrentFile.s, Index()\BaseFilename, 1)
TargetDirString.s = TargetDir.s + Index()\Directory + "\"
If MakeSureDirectoryPathExists_(TargetDirString.s) = #True
If CopyFile(SourceDir.s + CurrentFile.s, TargetDirString.s + CurrentFile.s)
Counter + 1
While WindowEvent() : Wend
AddGadgetItem(#Gadget_LiberSort_tosortto, -1, Index()\Directory + Chr(10) + Index()\BaseFilename + Chr(10) + "Okay")
SetWindowTitle(#Window_LiberSort, Program\WindowTitle + Str(Counter) + " " + CurrentFile.s)
DeleteFile(SourceDir.s + CurrentFile.s)
RemoveGadgetItem(#Gadget_LiberSort_tosortfrom, SortLoop)
LastLine(#Gadget_LiberSort_tosortto, Counter - 1)
Else
AddGadgetItem(#Gadget_LiberSort_errors, -1, "Cannot move" + Chr(10) + SourceDir.s + CurrentFile.s)
EndIf
Else
AddGadgetItem(#Gadget_LiberSort_errors, -1, "Dir create fail" + Chr(10) + "<°)))o><²³ Cannot create " + TargetDirString.s)
EndIf
Else
; String not found. Discard and try next one
EndIf
Next
Next SortLoop
Else
AddGadgetItem(#Gadget_LiberSort_errors, -1, "Sort aborted" + Chr(10) + "<°)))o><²³ Target sort directory was not specified")
EndIf
Else
AddGadgetItem(#Gadget_LiberSort_errors, -1, "Sort disallowed" + Chr(10) + "<°)))o><²³ The source and target directories must not be the same, bad things can happen")
EndIf
EndProcedure
;==================================================================================================
;
;==================================================================================================
If Window_LiberSort()
;------------------------------------------------------------------------------------------------
;
;------------------------------------------------------------------------------------------------
AddGadgetItem(#Gadget_LiberSort_errors, -1, "Startup" + Chr(10) + "<°)))o><²³ " + #Program + "Ready to work")
;------------------------------------------------------------------------------------------------
;
;------------------------------------------------------------------------------------------------
ConfigFile = ReadFile(#PB_Any, Program\CurrentDir + "Directories.lbc")
If ConfigFile
AddGadgetItem(#Gadget_LiberSort_errors, -1, "Read Config" + Chr(10) + "<°)))o><²³ Sort from and to directories read from config")
SetGadgetText(#Gadget_LiberSort_sourcedir, ReadString(ConfigFile))
SetGadgetText(#Gadget_LiberSort_targetdir, ReadString(ConfigFile))
CloseFile(ConfigFile)
EndIf
;------------------------------------------------------------------------------------------------
;
;------------------------------------------------------------------------------------------------
IndexHandle = ReadFile(#PB_Any, Program\CurrentDir + "LiberSort.Idx")
If Indexhandle
AddGadgetItem(#Gadget_LiberSort_errors, -1, "Index load" + Chr(10) + "<°)))o><²³ Liberkey file sort index list loaded")
While Eof(Indexhandle) = 0
CurrentLine.s = ReadString(Indexhandle)
AddElement(Index())
Index()\Directory = StringField(CurrentLine.s, 1, "|")
Index()\BaseFilename = StringField(CurrentLine.s, 2, "|")
Wend
CloseFile(IndexHandle)
Else
End
EndIf
;------------------------------------------------------------------------------------------------
;
;------------------------------------------------------------------------------------------------
SetWindowTitle(#Window_LiberSort, "<°)))o><²³ " + #Program)
;------------------------------------------------------------------------------------------------
;
;------------------------------------------------------------------------------------------------
Program\WindowTitle = "<°)))o><²³ " + #Program
;------------------------------------------------------------------------------------------------
;
;------------------------------------------------------------------------------------------------
Program\QuitValue = 0
;------------------------------------------------------------------------------------------------
;
;------------------------------------------------------------------------------------------------
GetSourceFiles()
;------------------------------------------------------------------------------------------------
;
;------------------------------------------------------------------------------------------------
Repeat
Select WaitWindowEvent()
Case #PB_Event_CloseWindow
Select EventWindow()
Case #Window_LiberSort : Program\QuitValue = 1
EndSelect
Case #PB_Event_Menu
Select EventMenu()
Case #Shortcut_LiberSort_Exit : Program\QuitValue = 1
EndSelect
Case #PB_Event_Gadget
Select EventGadget()
Case #Gadget_LiberSort_getsortfiles : GetSourceDirectory()
Case #Gadget_LiberSort_gettargetdir : GetTargetDirectory()
Case #Gadget_LiberSort_runjob : GetSourceFiles() : SortFiles()
Case #Gadget_LiberSort_exit : Program\QuitValue = 1
EndSelect
EndSelect
Until Program\QuitValue = 1
;------------------------------------------------------------------------------------------------
;
;------------------------------------------------------------------------------------------------
ConfigFile = CreateFile(#PB_Any, Program\CurrentDir + "Directories.lbc")
If ConfigFile
WriteStringN(ConfigFile, GetGadgetText(#Gadget_LiberSort_sourcedir))
WriteStringN(ConfigFile, GetGadgetText(#Gadget_LiberSort_targetdir))
CloseFile(ConfigFile)
EndIf
;------------------------------------------------------------------------------------------------
;
;------------------------------------------------------------------------------------------------
CloseWindow(#Window_LiberSort)
EndIf
End
LiberSort saves the directories that you chose as source and target for next time._Audio\_Converter|Format_
_Audio\_Converter|XMedia_Recode_
_Audio\_Editor|Audacity_
_Audio\_Editor|mp3DirectCut_
_Audio\_Editor|MP3Gain_
_Audio\_Editor|Wavosaur_
_Audio\_Ipod_Manager|CopyTrans_Manager_
_Audio\_Ipod_Manager|Floola_
_Audio\_Ipod_Manager|SharePod_
_Audio\_Player|AIMP_
_Audio\_Player|Soundbase_
_Audio\_Player|XMPlay_
_Audio\_Radio|ICY_Radio_
_Audio\_Radio|RadioSure_
_Audio\_Radio|Screamer_
_Audio\_Ripper|BonkEnc_
_Audio\_Tagger|Mp3tag_
_Audio\_Tagger|TagScanner_
_Audio\_Text_To_Speech|DSpeech_
_Audio\_Tools|Audio_Identifier_
_Audio\_Tools|Tunatic_
_Cd and dvd\_Burning_Tools|Amok_CD-DVD_Burning_
_Cd and dvd\_Burning_Tools|CDBurnerXP_
_Cd and dvd\_Burning_Tools|ImgBurn_
_Cd and dvd\_Burning_Tools|InfraRecorder_
_Cd and dvd\_Cover_Printer|UnderCoverXP_
_Cd and dvd\_Image_Tools|AnyToISO_Converter_
_Cd and dvd\_Image_Tools|Folder2Iso_
_Cd and dvd\_Image_Tools|LCISOCreator_
_Cd and dvd\_Image_Tools|Virtual_CDRom_Control_Panel_
_Education\_Astronomy|Celestia_
_Education\_Astronomy|Stellarium_
_Education\_Typing|RapidTyping_
_Education\_Drawing|TuxPaint_
_File manager\_Backup|Abakt_
_File manager\_Backup|USB_Image_Tool_
_File manager\_Cataloguer|CdCat_
_File manager\_Comparison|KDiff3_
_File manager\_Comparison|WinMerge_
_File manager\_Compression|7-Zip_
_File manager\_Compression|IZArc2Go_
_File manager\_Compression|PeaZip_
_File manager\_Compression|Universal_Extractor_
_File manager\_Copy|TeraCopy_
_File manager\_Defragmenter|Defraggler_
_File manager\_Defragmenter|Disk_Defrag_
_File manager\_Defragmenter|UltraDefrag_
_File manager\_Directory_Lister|DirHTML_
_File manager\_Disk_Space_Tool|FilePro_
_File manager\_Disk_Space_Tool|Folder_Size_
_File manager\_Disk_Space_Tool|Windirstat_
_File manager\_Duplicate_Killer|DupKiller_
_File manager\_Manager|Free_Commander_
_File manager\_Manager|Q-Dir_
_File manager\_Recovery|DiskDigger_
_File manager\_Recovery|Free_Data_Recovery_Software_
_File manager\_Recovery|Recuva_
_File manager\_Recovery|Roadkil's_Unstoppable_Copier_
_File manager\_Renamer|Ant_Renamer_
_File manager\_Renamer|Bulk_Rename_Utility_
_File manager\_Renamer|ReNamer_
_File manager\_Search|Everything_
_File manager\_Search|SearchMyFiles_
_File manager\_Splitter|GSplit_
_File manager\_Splitter|YoyoCut_
_File manager\_Synchronization|DSynchronize_
_File manager\_Synchronization|FreeFileSync_
_File manager\_Tools|NewFileTime_
_File manager\_Universal_Viewer|Universal_Viewer_
_Game\_Action|Neverball_
_Game\_Action|Trackballs_
_Game\_Card|PokerTH_
_Game\_Puzzle|Jooleem_
_Game\_Puzzle|Lines95_
_Game\_Puzzle|Pathological_
_Game\_Puzzle|Simple_Sudoku_
_Game\_Reflexion|Yea_Chess_
_Game\_Strategy|Bombermaaan_
_Graphics\_3D|Anim8or_
_Graphics\_3D|Blender_
_Graphics\_Colour_Picker|Color_Mania_
_Graphics\_Colour_Picker|ColorPic_
_Graphics\_Editor|GIMP_
_Graphics\_Editor|Inkscape_
_Graphics\_Editor|MyPaint_
_Graphics\_Editor|Paint.NET_
_Graphics\_Editor|Photo_Filtre_
_Graphics\_Effect_And_Filter|FotoSketcher_
_Graphics\_Icon_Editor|Greenfish_Icon_Editor_Pro_
_Graphics\_Icon_Editor|IcoFX_
_Graphics\_Screen_Capture|FastStone_Capture_
_Graphics\_Screen_Capture|PicPick_
_Graphics\_Tools|On-Screen_Ruler_
_Graphics\_Tools|PngOptimizer_
_Graphics\_Tools|RIOT_
_Graphics\_Vector_Converter|WinTopo_
_Graphics\_Viewer|FastStone_Image_Viewer_
_Graphics\_Viewer|IrfanView_
_Graphics\_Viewer|XnView_
_Internet\_Bookmark_Manager|Transmute_
_Internet\_Browser|Google_Chrome_
_Internet\_Browser|Chromium_
_Internet\_Browser|Firefox_
_Internet\_Browser|Opera_
_Internet\_Browser|QtWeb_
_Internet\_Download|eMule_
_Internet\_Download|Free_Download_Manager_
_Internet\_Download|uTorrent_
_Internet\_Email|POP_Peeper_
_Internet\_Email|PopTray_
_Internet\_Email|Thunderbird_
_Internet\_Ftp|FileZilla_
_Internet\_Instant_Messenger|aMSN_
_Internet\_Instant_Messenger|Miranda_IM_
_Internet\_Instant_Messenger|Pidgin_
_Internet\_Internet_Relay_Chat|MegaIRC_
_Internet\_Rss_Reader|GreatNews_
_Internet\_Website_Authoring|iWebAlbum_
_Internet\_Website_Authoring|KompoZer_
_Internet\_Website_Authoring|MobaPhoto_
_Internet\_Webste_Copier|HTTrack_
_Networking - server\_Bandwidth_Monitor|NetMeter_
_Networking - server\_Bandwidth_Monitor|NetWorx_
_Networking - server\_Configuration|B.I.S.S._Hosts_Manager_
_Networking - server\_Configuration|PE_Network_Configurator_
_Networking - server\_Network_Analyser|SmartSniff_
_Networking - server\_Network_Analyser|Yale_
_Networking - server\_Remote_Control|TeamViewer_
_Networking - server\_Remote_Control|UltraVNC_Server_
_Networking - server\_Remote_Control|UltraVNC_Viewer_
_Networking - server\_Scanner|SoftPerfect_Network_Scanner_
_Networking - server\_Scanner|Performance_Pinging_
_Networking - server\_Server|HFS_
_Networking - server\_Settings_Manager|Net_Profiles_
_Networking - server\_Settings_Manager|NetSetMan_
_Networking - server\_Telnet_Ssh_Client|KiTTY_(PuTTY)_
_Networking - server\_Telnet_Ssh_Client|TeraTerm_Pro_
_Networking - server\_Telnet_Ssh_Client|WinSCP_
_Networking - server\_Tools|CurrPorts_
_Networking - server\_Tools|DShutdown_
_Networking - server\_Tools|eToolz_
_Networking - server\_Tools|IP2_
_Networking - server\_Tools|IPNetInfo_
_Networking - server\_Tools|Network_Stuff_
_Office\_Calculator|ESBCalc_
_Office\_Calculator|MyCalc2_
_Office\_Calculator|SpeedCrunch_
_Office\_Calendar|EssentialPIM_
_Office\_Calendar|Rainlendar_Lite_
_Office\_Calendar|Sunbird_
_Office\_Chrono|Pc_Chrono_
_Office\_Desktop_Tools\_Application_Launcher|Executor_
_Office\_Desktop_Tools\_Application_Launcher|RocketDock_
_Office\_Desktop_Tools\_Automation|AutoHotkey_
_Office\_Desktop_Tools\_Automation|Clavier+_
_Office\_Desktop_Tools\_Clipboard_Manager|Clipboardic_
_Office\_Desktop_Tools\_Clipboard_Manager|Ditto_
_Office\_Desktop_Tools\_Clock|ClocX_
_Office\_Desktop_Tools\_Clock|TimeSync_
_Office\_Desktop_Tools\_Customisation|Shock_Caption_
_Office\_Desktop_Tools\_Notes|PNotes_
_Office\_Desktop_Tools\_Notes|Stickies_
_Office\_Desktop_Tools\_Keyboard_And_Mouse|Click-N-Type_
_Office\_Desktop_Tools\_Save_Desktop_Icon|DesktopOK_
_Office\_Desktop_Tools\_Save_Desktop_Icon|Shock_Desktop_
_Office\_Desktop_Tools\_Virtual_Desktop|VirtuaWin_
_Office\_Desktop_Tools\_Zoom|Virtual_Magnifying_Glass_
_Office\_Desktop_Tools\_Zoom|ZoomIt_
_Office\_Diagram_Editor|Dia_
_Office\_Diagram_Editor|Diagram_Designer_
_Office\_Finance_Manager|Money_Manager_
_Office\_Finance_Manager|viCompte_
_Office\_Font_Manager|AMP_Font_Viewer_
_Office\_Font_Manager|FontList_
_Office\_Font_Manager|NexusFont_
_Office\_Note_Manager|TreeDBNotes_
_Office\_Office_Suite|AbiWord_
_Office\_Office_Suite|OpenOffice.org_
_Office\_Office_Suite|Scribus_
_Office\_Pdf|Foxit_Reader_
_Office\_Pdf|PDFTK_Builder_
_Office\_Pdf|PDF-XChange_Viewer_
_Office\_Pdf|SumatraPDF_
_Office\_Presentation|Pointofix_
_Office\_Task_Manager|Task_Coach_
_Office\_Text_Editor|AkelPad_
_Office\_Text_Editor|Notepad++_
_Office\_Text_Editor|PSPad_
_Office\_Text_Editor|RJ_TextEd_
_Office\_Tutorial_Creator|vTute_Recorder_
_Office\_Tutorial_Creator|Wink_
_Office\_Unit_Converter|Converber_
_Office\_Unit_Converter|ESBUnitConv_
_Platform|LiberKey_
_Platform|LiberKey_Platform_
_Removed|ThrottleWatch_
_Removed|Visual_Tooltip_
_Removed|WinFlip_
_Security\_AntiVirus_And_Spyware|ClamWin_
_Security\_AntiVirus_And_Spyware|Runscanner_
_Security\_AntiVirus_And_Spyware|SpyDLLRemover_
_Security\_Encryption|DCU_
_Security\_Encryption|Omziff_
_Security\_Encryption|TrueCrypt_
_Security\_Integrity_Checker|HashCalc_
_Security\_Integrity_Checker|HashMyFiles_
_Security\_Password_Manager|KeePass_Classic_Edition_
_Security\_Password_Manager|KeePass_Professional_Edition_
_Security\_Password_Manager|Password_Generator_
_Security\_Privacy_Tool|XP-AntiSpy_
_Security\_Secure_Deletion|UltraShredder_
_Security\_Secure_Deletion|WipeDisk_
_Security\_Secure_Deletion|WipeFile_
_Security\_Tools|USB_WriteProtector_
_System utilities\_Benchmark\_HardDisk|CrystalDiskMark_
_System utilities\_Benchmark\_HardDisk|HD_Speed_
_System utilities\_Benchmark\_Universal|CrystalMark_
_System utilities\_Cleaner_Uninstaller|CCleaner_
_System utilities\_Cleaner_Uninstaller|CleanAfterMe_
_System utilities\_Cleaner_Uninstaller|Driver_Sweeper_
_System utilities\_Cleaner_Uninstaller|FCleaner_
_System utilities\_Cleaner_Uninstaller|FileASSASSIN_
_System utilities\_Cleaner_Uninstaller|Glary_Utilities_
_System utilities\_Cleaner_Uninstaller|JavaRa_
_System utilities\_Cleaner_Uninstaller|MUICacheView_
_System utilities\_Cleaner_Uninstaller|MyUninstaller_
_System utilities\_Cleaner_Uninstaller|Remove_Empty_Directories_
_System utilities\_Cleaner_Uninstaller|Revo_Uninstaller_
_System utilities\_Cleaner_Uninstaller|Unlocker_
_System utilities\_Cleaner_Uninstaller|Wise_Disk_Cleaner_
_System utilities\_Emulator|MobaLiveCD_
_System utilities\_Hex_Editor|HxD_
_System utilities\_Information\_File_Monitoring|OpenedFilesView_
_System utilities\_Information\_Hardware_Monitoring|HWMonitor_
_System utilities\_Information\_Inventory|HWINFO32_
_System utilities\_Information\_Inventory|PC_Wizard_
_System utilities\_Information\_Inventory|SIW_
_System utilities\_Information\_Inventory|Speccy_
_System utilities\_Information\_Inventory|System_Explorer_
_System utilities\_Information\_Inventory|System_Spec_
_System utilities\_Information\_Inventory|WinAudit_
_System utilities\_Information\_Process|Bill2's_Process_Manager_
_System utilities\_Information\_Process|DTaskManager_
_System utilities\_Information\_Process|Process_Explorer_
_System utilities\_Information\_Process|Process_Hacker_
_System utilities\_Information\_Processor|CPU-Z_
_System utilities\_Information\_Processor|CrystalCPUID_
_System utilities\_Information\_Processor|Slow_
_System utilities\_Information\_Service|ServiWin_
_System utilities\_Information\_Startup_Manager|Autoruns_
_System utilities\_Information\_Startup_Manager|Startup_Control_Panel_
_System utilities\_Information\_Usb_Device|USBDeview_
_System utilities\_Information\_Video_Card|GPU_Caps_Viewer_
_System utilities\_Information\_Video_Card|GPU-Z_
_System utilities\_Registry\_Backup|Erunt_
_System utilities\_Registry\_Comparison|Regshot_
_System utilities\_Registry\_Compression|NTREGOPT_
_System utilities\_Registry\_Compression|Quicksys_RegDefrag_
_System utilities\_Registry\_Monitoring|Process_Monitor_
_System utilities\_Registry\_Monitoring|RegFromApp_
_System utilities\_Registry\_Repair|Free_Window_Registry_Repair_
_System utilities\_Registry\_Repair|Wise_Registry_Cleaner_
_System utilities\_Registry\_Search|RegScanner_
_System utilities\_Repair|Partition_Find_and_Mount_
_System utilities\_Tests\_Burning_Test|HeavyLoad_
_System utilities\_Tests\_Burning_Test|OCCT_
_System utilities\_Tests\_Hard_Disk|CrystalDiskInfo_
_System utilities\_Tests\_Hard_Disk|HD_Tune_
_System utilities\_Tests\_Monitor|CheckeMON_
_System utilities\_Tests\_Monitor|Eizo_Monitortest_
_System utilities\_Tests\_Ram|MemTest_
_System utilities\_Tools|Autoplay_Repair_
_System utilities\_Tools|BlueScreenView_
_System utilities\_Tools|ColorConsole_
_System utilities\_Tools|Drive_Manager_
_System utilities\_Tools|Fast_Explorer_
_System utilities\_Tools|Fat32Formatter_
_System utilities\_Tools|FileTypesMan_
_System utilities\_Tools|Path_Editor_
_System utilities\_Tools|RAMRush_
_System utilities\_Tools|Rapid_Environment_Editor_
_System utilities\_Tools|RegDllView_
_System utilities\_Tools|ResourcesExtract_
_System utilities\_Tools|ShellExView_
_System utilities\_Tools|SysExporter_
_System utilities\_Tools|USB_Disk_Ejector_
_System utilities\_Tweaker|Tweak_UI_
_System utilities\_Tweaker|XdN_Tweaker_
_System utilities\_Tweaker|XP-Config_
_System utilities\_Update_Checker|Filehippo_Update_Checker_
_Video\_Authoring|DVDStyler_
_Video\_Capture|VDownloader_
_Video\_Capture|WebVideoCap_
_Video\_Capture|xVideoServiceThief_
_Video\_Cataloguer|Ant_Movie_Catalog_
_Video\_Converter|Pocket_Divx_Encoder_
_Video\_Editor|Avidemux_
_Video\_Editor|VirtualDub_
_Video\_Player|Media_Player_Classic_
_Video\_Player|MPC_HomeCinema_
_Video\_Player|VLC_media_player_
_Video\_Player|Wimpy_FLV_Player_
_Video\_Repair|DivFix++_
_Video\_Tools|Aspect_
_Video\_Tools|K-Lite_Codec_Tweak_Tool_
_Video\_Tools|Filmerit_
_Video\_Tools|GSpot_
_Video\_Tools|MediaInfo_
_Video\_Tools|VideoCalc_
P.S You will have to get your own graphics, this project didn't warrant a package job.