But I already know how to do this. It returns a flat list of information.
I'm looking for a routine that returns a nested array which is structured in essentially the same way as the folders.
Anyway, I found a way to do it. I need to break from this for a few days, to prepare for a sql and .net interview. But I have a basic strategy for getting the array, and will share it on the forum after it's done.
There are existing modules that come close to this. There's one in the Xailer distribution, but it returns the info in a treeview, which isn't what I'm looking for. There's also several legacy modules that list files or directories, like XD_PICKDIR from the XDot clipper library. But they don't seem to return the directory in the format I'm looking for.
Here's an example of the type of structure I'm trying to generate. It's NOT from a folder structure, it's from a menu structure that I'm working on. But ultimately, this is the kind of nested array I'm trying to generate, from a folder and subfolders.
Code: Select all
{ ;
{"Office","Excel, Word, Dummy", ;
{ ;
{"Excel", "Microsoft Excel", {|| ExecuteApp( Chr(34) + "c:\Program Files (x86)\Microsoft Office\Office12\Excel.exe" + Chr(34) ) }},;
{"Word", "Microsoft Word", {|| ExecuteApp( Chr(34) + "c:\Program Files (x86)\Microsoft Office\Office12\WinWord.exe" + Chr(34)) }},;
{"Dummy", "Dummy Menu Item", {||qout("Third SubItem from First") } } ;
} ;
} , ;
{ "Utilities","Temp folder, Second SubItem, Third SubItem", ;
{ ;
{"Temp folder","Generate Working folder", {||popupstring("Enter anything")}},;
{"Second SubItem", "Second SubItem from Second", {||qout("What the...?")}},;
{"Third SubItem", "Third SubItem from Second", {||qout("Third SubItem from Second")}} ;
} ;
}, ;
{ "Other Apps","PDF Viewer, Notepad, NotePad++, Dummy", ;
{ ;
{"Sumatra", "Sumatra PDF Viewer", {|| ExecuteApp( "C:\PortableApps\SumatraPDFPortable\SumatraPDFPortable.exe" ) }},;
{"Notepad", "Run Notepad", {|| ExecuteNotepad() }},;
{"Notepad++", "Run Notepad++", {|| ExecuteApp( Chr(34) + "g:\PortableApps\Notepad++Portable\Notepad++Portable.exe" + Chr(34)) }},;
{"Thunderbird", "Thunderbird Portable", {|| ExecuteApp( "G:\PortableApps\ThunderbirdPortable\ThunderbirdPortable.exe" ) }},;
{"Dummy", "Dummy Menu Item", {||qout("Dummy Menu Item")} } ;
} ;
}, ;
{"Clipboard","Send to Clipboard?.txt, Manipulate Clipboard, Common Strings", ;
{ ;
{ "SendToFile", "SendToFile1, SendToFile2", ;
{ ;
{"SendToFile1","Send Contents of Clipboard to C:\Clips\Clipboard1.txt", {|| CopyClipboardToFile1() } },;
{"SendToFile2","Send Contents of Clipboard to C:\Clips\Clipboard2.txt", {|| CopyClipboardToFile2() } } ;
} ;
}, ;
{ "Manipulate Clipboard", "Sort, LowerCase, UpperCase, Remove Trailing Strings, Surround Clipboard list, DXXX Insert, Dummy", ;
{ ;
{"Sort", "Sort Lines in Clipboard", {|| CopyStringToClipBoard( SortClipboardLines( GetSystemClipBoard() ) )}},;
{"LowerCase", "Convert Clipboard to LowerCase", {|| CopyStringToClipBoard( Lower( GetSystemClipBoard() ) ) }},;
{"UpperCase", "Convert Clipboard to UpperCase", {|| CopyStringToClipBoard( Upper( GetSystemClipBoard() ) ) }},;
{"Remove Beg/End", "Removing Beginning and Ending Strings", {|| CopyStringToClipBoard( RemoveRemainingCharacters( RemoveFromStringUpTo( GetSystemClipBoard(), "[![CDATA[" ), "]]></ns1" ) ) }},;
{"Surround", "Prefix and Afix each String in a List", {|| CopyStringToClipBoard( SurroundLinesWithCustomStrings( GetSystemClipBoard(), 'BEFORE', 'AFTER' ) ) }},;
{"DXXX INSERT", "Generate INSERT Sql for DXXX License list", ;
{|| CopyStringToClipBoard( SurroundLinesWithCustomStrings( GetSystemClipBoard(), ;
"INSERT INTO DXXX_LIC.[dbo].[LicenseTBL] ( [IsActive], [CreatedDate], [CreatedBy], [ModifiedDate], ;
[ModifiedBy], [LicenseId],[ReprintRequestUser], [ReprintRequestDate] ) VALUES ( 1, GETDATE(), 'SYSTEM', GETDATE(),'SYSTEM', ;
( SELECT LId FROM Licenses WHERE LNumber = '" , ;
"' ), 'SYSTEM', GETDATE() );" + Chr(59) ) ) }},;
{"Dummy", "Dummy Menu Item", {||qout("Dummy Menu Item")} } ;
} ;
}, ;
{ "Common Strings", "My Email, Date, Function Doc, Dummy", ;
{ ;
{"Email", "My email XXXXX@gmail.com - to ClipBoard", {|| CopyStringToClipBoard( "XXXXX@gmail.com" ) } },;
{"Date", "Today MM/DD/YYYY", {|| CopyStringToClipBoard( hb_DtoC(DATE(), 'MM/DD/YYYY' ) ) } },;
{"Function Doc", "Generate Function Documentation", {|| CopyStringToClipboard( GenerateFunctionDocumentation( "ThisFunction" ) ) } },;
{"Dummy", "Dummy Menu Item", {||qout("Dummy Menu")}}
} ;
}, ;
{"Dummy SubItem", "Dummy SubItem from Second", {||qout("Fourth SubItem from Second")}},;
{"Fifth SubItem", "Fifth SubItem from Second", {||qout("Fifth SubItem from Second")}}
} ;
}, ;
{ "Web Searches", "Google Search with Clipboard, DuckDuckGo Search with Clipboard, WolFram Alpha, Dummy", ;
{ ;
{"Google Search", "Google Search with Clipboard", {|| GoogleSearch( GetSystemClipboard() ) } },;
{"DuckDuckGo", "DuckDuckGo Search with Clipboard", {|| DuckDuckGoSearch( GetSystemClipboard() ) } },;
{"Wolfram Alpha", "Wolfram Alpha Search with Clipboard", {|| WolframAlphaSearch( GetSystemClipboard() ) } },;
{"Dummy", "Dummy Menu Item", {||qout("Dummy Menu Item")} } ;
} ;
}, ;
{ "TODO","Generate, Insert, Current, List, DONE, Third Subitem", ;
{ ;
{"Generate","Generate Today's TODO XXX_DAILY_DDMMYYYY.TXT file", {||qout("In Development") }},;
{"Insert","Insert TODO item", {||qout("In Development") }},;
{"Select", "Select Current TODO item", {||qout("In Development") }},;
{"DONE", "Set Selected TODO item to DONE", {||qout("In Development") }},;
{"List", "List Active TODO items", {||qout("In Development") }},;
{"Third SubItem", "Third SubItem from Second", {||qout("Third SubItem from Second")}} ;
} ;
}, ;
{"Dummy Menu", "Dummy Menu, Dummy Menu 2, Dummy Menu 3", ;
{ ;
{"Dummy Menu", "Dummy 11, Dummy 12, Dummy 13", ;
{ ;
{"Dummy 11", "Check Today's ToDo path", {|| GetTodayToDoFilePath() } },;
{"Copy Open", "Copy Clipboard and Open file", {|| CopyClipBoardToFile_and_OpenInEditor( "DTFOCM_DAILY_" + hb_DtoC( DATE(), "DDMMYYYY" ) + ".XML", "NOTEPAD" ) } },;
{"Dummy 13", "Dummy Menu Item", {||qout("Dummy Menu Item")} } ;
} ;
}, ;
{"Dummy Menu 2", "Dummy Menu Item", {|| DuckDuckGoSearch( GetSystemClipboard() ) } },;
{"Dummy Menu 2", "Dummy Menu Item", {||qout("Dummy Menu Item")} } ;
} ;
} ;
}