Jump to content

Dir2HTML Create html site with links from a dir structure


Go to solution Solved by Xenobiologist,

Recommended Posts

Hello,

I started a little script to create a html page with links from a local directory structure.

At the end I want to have a html page which cotains tags like (div, span, ul, li, ...) to use it with Javascript.

The script works, but now the requirements have changed : The user wants to have a foldertree like here:

Example can be seen here: http://www.soa-bpm-integration.com/2009-07-12-dateibaeume-drupal-jquery-darstellen

So, that is why the html tags need to be set correctly, because my thought was to use Javascript which can also be written into the page which extends the functionality.

With JQuery and some plugins. (see example)

Anybody who can help with this (only the Autoit part) or anybody who has already a piece of code which does the job?

Opt('MustDeclareVars', 1)

Global $GUI

_main()

Func _main()
    #region ### START Koda GUI section ### Form=C:\Users\xf01145\Documents\GUI.kxf
    $GUI = GUICreate("Linkseitengenerator", 615, 204, 192, 124)
    GUICtrlCreateGroup("Einstellungen", 5, 10, 605, 190)
    GUICtrlCreateLabel("Titel der Seite", 15, 30, 69, 17)
    Local $title_I = GUICtrlCreateInput("Linksammlung", 145, 25, 456, 21)
    GUICtrlCreateLabel("Überschrift", 15, 55, 55, 17)
    Local $headline_I = GUICtrlCreateInput("Überschrift", 145, 50, 456, 21)
    Local $selectFolder_B = GUICtrlCreateButton("Startordner auswählen", 10, 120, 120, 25)
    Local $symbol_I = GUICtrlCreateInput("-", 145, 75, 456, 21)
    GUICtrlCreateLabel("Einrücksymbol", 15, 80, 72, 17)
    Local $startDir_I = GUICtrlCreateInput("c:\Autoit\GAD\Startseite-MI\", 145, 125, 456, 21)
;~  Local $startDir_I = GUICtrlCreateInput("", 145, 125, 456, 21)
    GUICtrlCreateGroup("Start", 5, 150, 605, 50)
    Local $start_B = GUICtrlCreateButton("Linkseite generieren", 15, 165, 590, 25)
    GUICtrlCreateGroup("", -99, -99, 1, 1)
    GUICtrlCreateLabel("Dateiname (index.html)", 15, 100, 111, 17)
    Local $filename_I = GUICtrlCreateInput("index.html", 145, 100, 456, 21)
    GUICtrlCreateGroup("", -99, -99, 1, 1)
    GUISetState(@SW_SHOW)
    #endregion ### END Koda GUI section ###
    Local $nMsg = 0

    While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
            Case $GUI_EVENT_CLOSE
                Exit (0)
            Case $selectFolder_B
                GUICtrlSetData($startDir_I, _selectStartFolder())
            Case $start_B
                FileDelete(GUICtrlRead($filename_I))
                _writeHTML(GUICtrlRead($title_I), GUICtrlRead($headline_I), GUICtrlRead($symbol_I), GUICtrlRead($filename_I), GUICtrlRead($startDir_I))
                ShellExecute(GUICtrlRead($filename_I))
        EndSwitch
    WEnd
EndFunc   ;==>_main

Func _selectStartFolder()
    Local $startDir = FileSelectFolder('Hallo Frau Wahrendorf, bitte wählen Sie den Startordner aus:', '', 7, @ScriptDir, $GUI)
    If @error = 1 Then Exit (0)
    Return $startDir
EndFunc   ;==>_selectStartFolder

Func _writeHTML($title, $headline, $symbol, $filename, $startDir)
    Local $szDrive, $szDir, $szFName, $szExt, $TestPath, $dir
    Local $startLevel = 0
    Local $currentLevel = 0
    Local $priviousLevel = 0
    Local $count = 0
    Local $splitted_A = 0
    Local $links = ''
    Local $ID = 0
    Local $level = 0

    Local $re = _RecFileListToArray($startDir, '*', 0, 1, 1, 2)

    StringReplace($startDir, '\', '\') ; startDir
    $startLevel = @extended

    For $i = 1 To UBound($re) - 1
        $currentLevel = 0
        StringReplace($re[$i], '\', '\') ; relativeDir
        $currentLevel = @extended

        $count = $currentLevel - $startLevel

        ; Verzeichnis
        If FileGetAttrib($re[$i]) = 'D' Then
            If $count = 0 Then $links &= '</br>' & @CRLF
            $links &= '<div id="' & $ID & '" style="font-size:16px;padding-left:' & $count * 15 & 'px;" onClick="javascript:toggle(' & $ID & ');"><b>' & $re[$i] & '</b></div>' & @CRLF
            ConsoleWrite($re[$i] & ' ' & $count & @CRLF)
            $ID += 1
        Else
            ; Link / Datei
            $splitted_A = _PathSplit($re[$i], $szDrive, $szDir, $szFName, $szExt)
            $re[$i] = StringReplace($re[$i], '\', '/')

            $links &= '<a style="padding-left:' & $count * 15 & 'px;" href = "file:///' & $re[$i] & '" > ' & _ ; Linkadresse
                    _fill($count, $symbol) & ' ' & $splitted_A[3] & $splitted_A[4] & ' </a> ' & _  ; Name des Link
                    '' & '<br>' & @CRLF ; Freitext
        EndIf
        $priviousLevel = $currentLevel
    Next

    Local $html = _
            '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"' & @CRLF & _
            '      "http://www.w3.org/TR/html4/strict.dtd">' & @CRLF & _
            '<html>' & @CRLF & _
            '<head>' & @CRLF & _
            '<title>' & $title & '</title>' & @CRLF & _
            '</head>' & @CRLF & _
            '<body>' & @CRLF & _
            '' & @CRLF & _
            '<h3>' & $headline & '</h1>' & @CRLF & _
            '' & @CRLF & _
            '<p>' & @CRLF & _
            $links & @CRLF & _
            '</p>' & @CRLF & _
            '' & @CRLF & _
            '' & @CRLF & _
            '<script>' & @CRLF & _
            'function toggle(id) {' & @CRLF & _
            '   if (document.getElementById(id).style.display == "none") {' & @CRLF & _
            '       document.getElementById(id).style.display = "";' & @CRLF & _
            '       }' & @CRLF & _
            '   else {' & @CRLF & _
            '           document.getElementById(id).style.display = "none";' & @CRLF & _
            '       }' & @CRLF & _
            '}' & @CRLF & _
            '</script>' & @CRLF & _
            '</body>' & @CRLF & _
            '</html>'
    ConsoleWrite($html & @CRLF)

    FileWrite($filename, $html)
    Return 1
EndFunc   ;==>_writeHTML

Func _fill($count, $symbol)
    Local $str = ''
    For $i = 0 To $count
        $str &= $symbol
    Next
    Return $str
EndFunc   ;==>_fill

Edit : Another requirement is: Sorting the files by name or date.

Thanks for any help.

Mega

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

I will have a look at your issue tonight if I remember, but you should know in HTML5 you don't need to use strange doctypes anymore, <!DOCTYPE html> is suffice.

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

Thanks. If you need more information let me know.

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

Edit : Another requirement is: Sorting the files by name or date.

 

I did something like this to create HTML email's based on criteria from Active Directory. I added all the required lines into an array and did my sorting from there. Then looped in the array into the HTML code. I will paste a copy of that function below.

Keep in mind it is tailored to my needs, so this is not just a copy and paste to work deal. This is more of an example that may help you out.

Func WinMail_DefineBody(ByRef $arrData)
    Local $i, $strFile = @TempDir & '\email.htm', $hdlFile = FileOpen($strFile, 2)
    FileWriteLine($hdlFile, '<html><head><meta http-equiv=Content-Type content="text/html; charset=us-ascii"><style><!-- /* Style Definitions */ ')
    FileWriteLine($hdlFile, 'p.Default {font-size:11.0pt;font-family:"Calibri","sans-serif";margin:0in;margin-bottom:.0001pt;}')
    FileWriteLine($hdlFile, 'p.TableItem {font-size:11.0pt;font-family:"Calibri","sans-serif";text-align:center;margin:0in;margin-bottom:.0001pt;}')
    FileWriteLine($hdlFile, 'span.Salutation {font-weight:bold;} span.Note {font-size:10.0pt;font-style:italic;font-weight:bold;}')
    FileWriteLine($hdlFile, 'span.Text {font-size:10.0pt;font-style:italic;} span.List {font-size:10.0pt;font-style:italic;margin-left:.25in;}')
    FileWriteLine($hdlFile, 'span.Email {font-size:10.0pt;} span.HeaderRow {font-weight:bold;color:white;} table.Default {border-collapse:collapse;}')
    FileWriteLine($hdlFile, 'td.Header {border:none;background:#4F81BD;padding:0in 5.4pt;height:15.0pt;}')
    FileWriteLine($hdlFile, 'td.RowItem {border:solid #4F81BD 1.0pt;padding:0in 5.4pt;height:15.0pt;} tr.Default {height:15.0pt;} -->')
    FileWriteLine($hdlFile, '</style></head><body lang=EN-US link=blue vlink=purple><p class=Default><span><img src="http://my.domain.com')
    FileWriteLine($hdlFile, '/CompanyBanner.jpg"></span></p><p class=Default><span>&nbsp;</span></p><p class=Default><span class=Salutation>')
    FileWriteLine($hdlFile, 'Application and/or System Administrator:</span></p><p class=Default><span>&nbsp;</span></p><p class=Default><span>The below ')
    FileWriteLine($hdlFile, 'report is notification of employee termination. Please follow the appropriate process of ensuring terminated employees are no ')
    FileWriteLine($hdlFile, 'longer able to log into or use your system or application.</span></p><p class=Default><span>&nbsp;</span></p><p class=Default>')
    FileWriteLine($hdlFile, '<span class=Note>Please Note:</span></p><p class=Default><span class=Text>Compliance with termination policies and procedures ')
    FileWriteLine($hdlFile, 'is mandated by:</span></p><p class=Default><span class=List>&sect; MyCompany Information Security Policy</span></p>')
    FileWriteLine($hdlFile, '<p class=Default><span class=List>&sect; AF-1110-03 IS&amp;T System and Data Access Security</span></p><p class=Default>')
    FileWriteLine($hdlFile, '<span class=List>&sect; IST C020&#8211; Access Rights Management</span></p><p class=Default><span>&nbsp;</span></p>')
    FileWriteLine($hdlFile, '<p class=Default><span>&nbsp;</span></p><p class=Default><span>Thank you</span></p><p class=Default><span>&nbsp;</span></p>')
    FileWriteLine($hdlFile, '<table class=Default border=0 cellspacing=0 cellpadding=0><tr class=Default><td nowrap valign=bottom class=Header>')
    FileWriteLine($hdlFile, '<p class=TableItem align=center><span class=HeaderRow>')
    FileWriteLine($hdlFile, $arrData[0][0] & '</span></p></td><td nowrap valign=bottom class=Header><p class=TableItem align=center><span class=HeaderRow>')
    FileWriteLine($hdlFile, $arrData[0][1] & '</span></p></td><td nowrap valign=bottom class=Header><p class=TableItem align=center><span class=HeaderRow>')
    FileWriteLine($hdlFile, $arrData[0][2] & '</span></p></td><td nowrap valign=bottom class=Header><p class=TableItem align=center><span class=HeaderRow>')
    FileWriteLine($hdlFile, $arrData[0][6] & '</span></p></td><td nowrap valign=bottom class=Header><p class=TableItem align=center><span class=HeaderRow>')
    FileWriteLine($hdlFile, $arrData[0][3] & '</span></p></td><td nowrap valign=bottom class=Header><p class=TableItem align=center><span class=HeaderRow>')
    FileWriteLine($hdlFile, $arrData[0][4] & '</span></p></td><td nowrap valign=bottom class=Header><p class=TableItem align=center><span class=HeaderRow>')
    FileWriteLine($hdlFile, $arrData[0][5] & '</span></p></td></tr>')
    For $i = 1 To (UBound($arrData, 1) - 1) Step 1
        If $arrData[$i][6] = '' Or $arrData[$i][6] = 'Not Found' Then
            ConsoleWrite('Line Entry ' $i & ' Skipped: ' & $arrData[$i][6] & @CRLF)
            ContinueLoop
        Else
            FileWriteLine($hdlFile, '<tr class=Default><td nowrap valign=bottom class=RowItem><p class=TableItem align=center><span>')
            FileWriteLine($hdlFile, $arrData[$i][0] & '</span></p></td><td nowrap valign=bottom class=RowItem><p class=TableItem align=center><span>')
            FileWriteLine($hdlFile, $arrData[$i][1] & '</span></p></td><td nowrap valign=bottom class=RowItem><p class=TableItem align=center><span>')
            FileWriteLine($hdlFile, $arrData[$i][2] & '</span></p></td><td nowrap valign=bottom class=RowItem><p class=TableItem align=center><span>')
            FileWriteLine($hdlFile, $arrData[$i][6] & '</span></p></td><td nowrap valign=bottom class=RowItem><p class=TableItem align=center><span>')
            FileWriteLine($hdlFile, $arrData[$i][3] & '</span></p></td><td nowrap valign=bottom class=RowItem><p class=TableItem align=center><span>')
            FileWriteLine($hdlFile, $arrData[$i][4] & '</span></p></td><td nowrap valign=bottom class=RowItem><p class=TableItem align=center><span>')
            FileWriteLine($hdlFile, $arrData[$i][5] & '</span></p></td></tr>')
            $intTrigger = 1
        EndIf
    Next
    FileWriteLine($hdlFile, '</table></body></html>')
    FileClose($hdlFile)
    Return $strFile
EndFunc   ;==>WinMail_DefineBody
Link to comment
Share on other sites

wruck,

You're missing doctype in your output as well as using obsolete attributes such as align and nowrap, oh and valign.

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

The real problem is to determine the hierarchy.

My script only contains the switch between file and folder. (at the moment)

To set the correct HTML tags it is necessary to know whether the level in the hierarchy has changed.

Storing all the Info (FileGetTime and the filepath) into an array and then sort the files in ervery folder separatly is a good idea.

This needs to be done, because the latest files (links) should be the ones on the top. (in ervery folder)

Something like:

Folder

-- file DECEMBER

-- file NOVEMBER

   -- NEW FOLDER

        -- DEC

        -- NOV

Edit: The HTML doctyope doesn't matter for me. The index.html file is starting locally in the browser.

Because of the changes (new files, new folders) the index.html should be generated and not be written by hand.

Edited by Xenobiologist

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

There is an excellent UDF by Melba (>RecFileListToArray) that returns all files in a folder structure. You could then StringSplit the results and merge into a MultiDim Array to get?

Check their example, they're using it. I think you've misunderstood the original issue. Edited by guinness

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

#include <WindowsConstants.au3>
#include <Array.au3>
#include <FileOperations.au3>
#include <GuiTreeView.au3>


Local $aListTree[3]
$aListTree[0] = '|.....'
$aListTree[1] = '+'
$aListTree[2] = '-'

; Глобальные просмотрщика файлов
Local $g_aExtAssot[1] = [0] ; Белый список ассоциаций
Local $g_aExtBlack[6] = [5, 'exe', 'scr', 'ico', 'ani', 'cur'] ; Чёрный список ассоциаций
Local $g_hImgAssot, $hTreeView, $iBtnSave

Local $Gui1
Global $sList

_ViewListFiles()

Func _ViewListFiles()
    Local $ListFile = FileSelectFolder('', '', 3, @WorkingDir)
    If @error Then Return
    Local $aLastPath, $aList, $GP, $i, $sep, $timer, $TreeView, _
            $aLastPath[125][3] = [[0]] ; (массив = "папка | дескриптор пункта | счётчик папок")

    $Gui1 = GUICreate('', 540, 560, -1, -1, BitOR($WS_CAPTION, $WS_SYSMENU, $WS_POPUP, $WS_OVERLAPPEDWINDOW))

    GUICtrlCreateTreeView(0, 0, 540, 530, -1, $WS_EX_CLIENTEDGE)
    GUICtrlSetResizing(-1, 2 + 4 + 32 + 64)
    $hTreeView = GUICtrlGetHandle(-1)

    If Not $g_hImgAssot Then ; Создаём список только при первом запуске
        $g_hImgAssot = _GUIImageList_Create(16, 16, 5, 1) ; Создаём список иконок
        _GUIImageList_AddIcon($g_hImgAssot, @SystemDir & '\shell32.dll', -4)
        _GUIImageList_AddIcon($g_hImgAssot, @SystemDir & '\shell32.dll', 0)
    EndIf
    _GUICtrlTreeView_SetNormalImageList($hTreeView, $g_hImgAssot)

    $aLastPath[0][1] = _GUICtrlTreeView_Add($hTreeView, 0, '0', 0, 0) ; добавляем корневой пункт
    ; $aList = _FO_FileSearch($ListFile, '*.dll', True, 125, 0)
    $aList = _FO_FileSearch($ListFile, '*', True, 125, 0)
    If @error Then Exit MsgBox(0, 'Сообщение', 'Ошибка')
    ; $aList = StringSplit(StringReplace(FileRead($ListFile), ':', ''), @CRLF, 1) ; читаем список в массив

    $sep = Opt("GUIDataSeparatorChar", "\")
    $timer = TimerInit()
    _ArraySort($aList, 0, 1) ; сортируем список, обязательно если не сортированный
    _AddFileList($aList, $aLastPath, $hTreeView)
    WinSetTitle($Gui1, '', ' ' & Round(TimerDiff($timer) / 1000, 2) & ' ')
    Opt("GUIDataSeparatorChar", $sep)
    ControlTreeView($Gui1, '', $hTreeView, 'Expand', '0') ; раскрыть корневой

    GUISetState()
    _SaveList()
EndFunc   ;==>_ViewListFiles

Func _SaveList()
    Local $sPath = FileSaveDialog('', @WorkingDir, '(*.htm)', 16, 's+', $Gui1)
    If @error Then Return

    
    Local $aLastPath[125] = [0] ; (массив = "папка | дескриптор пункта | счётчик папок")
    $sList = ''
    $hItem = _GUICtrlTreeView_GetFirstItem($hTreeView)
    If Not $hItem Then Return
    __TreeViewToText($hItem, '', $aLastPath)

    If StringRight($sPath, 4) <> '.htm' Then $sPath &= '.htm'
    Local $hFile = FileOpen($sPath, 2)
    FileWrite($hFile, $sList)
    FileClose($hFile)
    Exit
EndFunc   ;==>_SaveList

Func __TreeViewToText($hItem, $sIndent, ByRef $aLastPath)
    $hItem = _GUICtrlTreeView_GetFirstChild($hTreeView, $hItem) ; Запрашиваем первый дочерний пункт
    If Not $hItem Then Return ; Теоритически это можно не проверять, так как _GUICtrlTreeView_GetChildren не позволит проверить пункт без дочерних.
    Local $f, $fFlag, $tmp = $sIndent & $aListTree[0]
    Do
        $fFlag = _GUICtrlTreeView_GetChildren($hTreeView, $hItem) ; Также проверяет, запускать ли запрос вложенных пунктов
        If $fFlag Then
            $f = $aListTree[1]
            $aLastPath[0] += 1
        Else
            $f = $aListTree[2]
        EndIf
        $tmpPath = ''
        For $i = 1 To $aLastPath[0]
            $tmpPath &= $aLastPath[$i] & '\'
        Next
        $tmpText = _GUICtrlTreeView_GetText($hTreeView, $hItem)
        If $fFlag Then
            $sList &= $sIndent & $f & ' ' & $tmpText & '<br>' & @CRLF ; Текст пункта
        Else
            $sList &= $sIndent & $f & ' <a href="' & $tmpPath & '\' & $tmpText & '">' & $tmpText & '</a><br>' & @CRLF ; Текст пункта
        EndIf
        
        If $fFlag Then
            $aLastPath[$aLastPath[0]] = $tmpText
            __TreeViewToText($hItem, $tmp, $aLastPath)
        EndIf
        $hItem = _GUICtrlTreeView_GetNextSibling($hTreeView, $hItem) ; Запрашиваем следующий пункт
    Until Not $hItem ; Если не дескриптор, то выход
EndFunc   ;==>__TreeViewToText

Func _AddFileList($aList, ByRef $aLastPath, $hTreeView)
    Local $hItem, $i, $ind, $j, $tmp, $ext, $iExeNum = 0, $ind, $z
    For $z = 1 To $aList[0]
        $tmp = StringSplit($aList[$z], '\') ; делим путь
        For $i = 1 To $tmp[0]
            If $tmp[$i] <> $aLastPath[$i][0] Then ; ищем последнее различие в пути, то есть уровень вложения, на котором новый пункт не совпадает с предыдущим
                For $j = $i To $tmp[0]
                    $aLastPath[$j][0] = $tmp[$j] ; кэшируем новый путь в двумерный массив
                    $aLastPath[$j + 1][2] = 0 ; сбрасываем счётчик папок в 0
                Next
                ExitLoop
            EndIf
        Next
        For $i = $i To $tmp[0] ; отсчёт цикла начинается с индекса на котором было несовпадение, а значит они ещё не созданы
            If $i = $tmp[0] Then ; если последний элемент пути (то есть файл), то... (условие для определения иконки пункту)
                $ext = StringRegExpReplace($tmp[$i], '.+\.(\w+)$', '\1') ; ищем расширение
                $ind = _Get_Num_ICO($ext)
                If @error Then $ind = 0
                $aLastPath[$i][1] = _GUICtrlTreeView_AddChild($hTreeView, $aLastPath[$i - 1][1], $tmp[$i], $ind + 1, $ind + 1) ; добавляем пункт (файл) в конец списка
            Else
                $ind = 0
                ; если папка
                If $aLastPath[$i][2] Then
                    $hItem = _GUICtrlTreeView_GetItemByIndex($hTreeView, $aLastPath[$i - 1][1], $aLastPath[$i][2] - 1) ; десриптор последнего пункта папки
                    $aLastPath[$i][1] = _GUICtrlTreeView_InsertItem($hTreeView, $tmp[$i], $aLastPath[$i - 1][1], $hItem, $ind, $ind)
                Else ; иначе если индекс 0, добавляем первым в список, так как Insert не может добавить в самое начало
                    $aLastPath[$i][1] = _GUICtrlTreeView_AddChildFirst($hTreeView, $aLastPath[$i - 1][1], $tmp[$i], $ind, $ind) ; добавляем пункт
                EndIf
                $aLastPath[$i][2] += 1 ; увеличиваем счётчик папок на 1 для вставки папок оп индексу
            EndIf
        Next
    Next
EndFunc   ;==>_AddFileList

Func _GetTab($c)
    If Not $c Then Return ''
    Return StringReplace(StringFormat('%0' & $c & 'd', '0'), '0', $aListTree[0], 0, 2)
EndFunc   ;==>_GetTab

Func _Get_Num_ICO($sExt)
    Local $ind, $ico1
    $ind = _ArraySearch2($g_aExtAssot, $sExt)
    If @error Then
        $ico1 = _FileDefaultIcon('.' & $sExt)
        If @error Then
            Return SetError(1, 0, -1)
        Else
            Switch UBound($ico1)
                Case 2
                    If _ArraySearch2($g_aExtBlack, $sExt) > 0 Then ; Если в чёрном списке, тогда ошибка
                        Return SetError(1, 0, -1)
                    Else
                        _GUIImageList_AddIcon($g_hImgAssot, $ico1[1], 0)
                        If @error Then
                            _ArrayAdd2($g_aExtBlack, $sExt) ; Если ошибка, то добавляем расширение в чёрный список
                            Return SetError(1, 0, -1)
                        EndIf
                    EndIf
                Case 3
                    _GUIImageList_AddIcon($g_hImgAssot, $ico1[1], $ico1[2])
                    If @error Then
                        _ArrayAdd2($g_aExtBlack, $sExt) ; Если ошибка, то добавляем расширение в чёрный список
                        Return SetError(1, 0, -1)
                    EndIf
            EndSwitch
            _ArrayAdd2($g_aExtAssot, $sExt) ; Иначе добавляем расширение в белый список
            Return SetError(0, 0, $g_aExtAssot[0])
        EndIf
    Else
        Return SetError(0, 0, $ind)
    EndIf
EndFunc   ;==>_Get_Num_ICO

Func _ArrayAdd2(ByRef $Array, $ext)
    $Array[0] += 1
    ReDim $Array[$Array[0] + 1]
    $Array[$Array[0]] = $ext
EndFunc   ;==>_ArrayAdd2

Func _ArraySearch2(ByRef $Array, $ext)
    For $i = 1 To $Array[0]
        If $ext = $Array[$i] Then Return SetError(0, 0, $i)
    Next
    Return SetError(1, 0, -1)
EndFunc   ;==>_ArraySearch2

Func _FileDefaultIcon($sExt)
    If $sExt = '' Or StringInStr($sExt, ':') Then Return SetError(1)

    Local $aCall = DllCall("shlwapi.dll", "int", "AssocQueryStringW", _
            "dword", 0x00000040, _ ;$ASSOCF_VERIFY
            "dword", 15, _ ;$ASSOCSTR_DEFAULTICON
            "wstr", $sExt, _
            "ptr", 0, _
            "wstr", "", _
            "dword*", 65536)

    If @error Then Return SetError(1, 0, "")

    If Not $aCall[0] Then
        $sExt = StringReplace($aCall[5], '"', '')
        $sExt = StringSplit($sExt, ',')
        Opt('ExpandEnvStrings', 1)
        $sExt[1] = $sExt[1]
        Opt('ExpandEnvStrings', 0)
        Return SetError(0, 0, $sExt)
    ElseIf $aCall[0] = 0x80070002 Then
        Return SetError(1, 0, "{unknown}")
    ElseIf $aCall[0] = 0x80004005 Then
        Return SetError(1, 0, "{fail}")
    Else
        Return SetError(2, $aCall[0], "")
    EndIf
EndFunc   ;==>_FileDefaultIcon

Link to comment
Share on other sites

Xenobiologist, 

I think the code below will be about the best I can assist with. I am not very fluent in HTML5/CSS and tend to use many legacy tags, as Guinness thoughtfully pointed out. o:)

I hope this helps in some way and I look forward to seeing the final result - and learning something along the way. Best of luck!

#include <Array.au3>
#include <Resources\RecFileListToArray.au3>
Global $arrReport, $strHTMLFile, $strFilePath = @MyDocumentsDir
Global $jpgFile = @TempDir & '\icon_file.jpg', $jpgFolder = @TempDir & '\icon_folder.jpg'
FileInstall('\Resources\icon_file.jpg', $jpgFile, 1)
FileInstall('\Resources\icon_folder.jpg', $jpgFolder, 1)
$arrReport = WinFile_BuildFileArray($strFilePath)
$strHTMLFile = WinFile_BuildHTML($arrReport)
ShellExecute($strHTMLFile)
Sleep(500)
FileDelete($strHTMLFile)
FileDelete($jpgFile)
FileDelete($jpgFolder)
Func WinFile_BuildFileArray($strFilePath)
    Local $i, $intUBound, $arrFileDepth, $arrFileDate, $arrData[1][6] = [['Type', 'Depth', 'Path', 'Name', 'Modified', 'Size (KB)']]
    Local $arrPathDepth = StringSplit($strFilePath, '\')
    Local $arrFileList = _RecFileListToArray($strFilePath, "*", 0, 1, 0, 2)
    _ArraySort($arrFileList)
    For $i = 1 To (UBound($arrFileList, 1) - 1) Step 1
        $intUBound = UBound($arrData, 1)
        ReDim $arrData[$intUBound + 1][UBound($arrData, 2)]
        If StringInStr(FileGetAttrib($arrFileList[$i]), 'D', 1) = 0 Then
            $arrFileDepth = StringSplit($arrFileList[$i], '\')
            $arrFileDate = FileGetTime($arrFileList[$i], 0)
            $arrData[$intUBound][0] = 'File'
            $arrData[$intUBound][1] = $arrFileDepth[0] - $arrPathDepth[0]
            $arrData[$intUBound][2] = StringLeft($arrFileList[$i], StringInStr($arrFileList[$i], '\', 0, -1) - 1)
            $arrData[$intUBound][3] = StringMid($arrFileList[$i], StringInStr($arrFileList[$i], '\', 0, -1) + 1)
            $arrData[$intUBound][4] = $arrFileDate[0] & '/' & $arrFileDate[1] & '/' & $arrFileDate[2] & ' ' & $arrFileDate[3] & ':' & $arrFileDate[4] & ':' & $arrFileDate[5]
            $arrData[$intUBound][5] = Round(FileGetSize($arrFileList[$i]) / 1024, 2)
        Else
            $arrFileDepth = StringSplit($arrFileList[$i], '\')
            $arrData[$intUBound][0] = 'Directory'
            $arrData[$intUBound][1] = $arrFileDepth[0] - $arrPathDepth[0]
            $arrData[$intUBound][2] = $arrFileList[$i]
        EndIf
        $arrFileDepth = 0
        $arrFileDate = 0
    Next
    Return $arrData
EndFunc   ;==>WinFile_BuildFileArray
Func WinFile_BuildHTML(ByRef $arrData)
    Local $i, $hndlHTML = FileOpen(@TempDir & '\FileFold.html', 2)
    FileWriteLine($hndlHTML, '<!DOCTYPE html>')
    FileWriteLine($hndlHTML, '<html>')
    FileWriteLine($hndlHTML, '<head>')
    FileWriteLine($hndlHTML, '<meta http-equiv=Content-Type content="text/html; charset=us-ascii">')
    FileWriteLine($hndlHTML, '<title>')
    FileWriteLine($hndlHTML, 'File/Folder Directory Listing')
    FileWriteLine($hndlHTML, '</title>')
    FileWriteLine($hndlHTML, '<style type="text/css">')
    FileWriteLine($hndlHTML, 'p.Text {font-size:11.0pt;font-family:"Calibri","sans-serif";margin:0in;margin-bottom:.0001pt;}')
    FileWriteLine($hndlHTML, 'table.NoBorder {border-collapse:collapse;width:100%;}')
    FileWriteLine($hndlHTML, 'td.Text {border:none;vertical-align:bottom;white-space:nowrap;padding:0px;height:20px;}')
    FileWriteLine($hndlHTML, '</style>')
    FileWriteLine($hndlHTML, '</head>')
    FileWriteLine($hndlHTML, '<body>')
    FileWriteLine($hndlHTML, '<h1>File/Folder Directory Listing</h1>')
    FileWriteLine($hndlHTML, '<table class=NoBorder>')
    FileWriteLine($hndlHTML, '<tr>')
    FileWriteLine($hndlHTML, '<td class=Text style="background-color:lightblue;">')
    FileWriteLine($hndlHTML, '<p class=Text>')
    FileWriteLine($hndlHTML, '<span class=HeaderRow>' & $arrData[0][2] & '</span>')
    FileWriteLine($hndlHTML, '</p>')
    FileWriteLine($hndlHTML, '</td>')
    FileWriteLine($hndlHTML, '<td class=Text style="background-color:lightblue;">')
    FileWriteLine($hndlHTML, '<p class=Text>')
    FileWriteLine($hndlHTML, '<span class=HeaderRow>' & $arrData[0][3] & '</span>')
    FileWriteLine($hndlHTML, '</p>')
    FileWriteLine($hndlHTML, '</td>')
    FileWriteLine($hndlHTML, '<td class=Text style="background-color:lightblue;">')
    FileWriteLine($hndlHTML, '<p class=Text>')
    FileWriteLine($hndlHTML, '<span class=HeaderRow>' & $arrData[0][4] & '</span>')
    FileWriteLine($hndlHTML, '</p>')
    FileWriteLine($hndlHTML, '</td>')
    FileWriteLine($hndlHTML, '<td class=Text style="background-color:lightblue;">')
    FileWriteLine($hndlHTML, '<p class=Text>')
    FileWriteLine($hndlHTML, '<span class=HeaderRow>' & $arrData[0][5] & '</span>')
    FileWriteLine($hndlHTML, '</p>')
    FileWriteLine($hndlHTML, '</td>')
    FileWriteLine($hndlHTML, '</tr>')
    For $i = 1 To (UBound($arrData, 1) - 1) Step 1
        FileWriteLine($hndlHTML, '<tr>')
        FileWriteLine($hndlHTML, '<td class=Text>')
        FileWriteLine($hndlHTML, '<p class=Text>')
        If $arrData[$i][0] = 'File' Then
            FileWriteLine($hndlHTML, '<span style="margin-left:' & (10 * $arrData[$i][1]) & 'px;"><img src="' & $jpgFile & '">' & $arrData[$i][2] & '</span>')
        ElseIf $arrData[$i][0] = 'Directory' Then
            FileWriteLine($hndlHTML, '<span style="margin-left:' & (10 * $arrData[$i][1]) & 'px;"><img src="' & $jpgFolder & '">' & $arrData[$i][2] & '</span>')
        EndIf
        FileWriteLine($hndlHTML, '</p>')
        FileWriteLine($hndlHTML, '</td>')
        FileWriteLine($hndlHTML, '<td class=Text>')
        FileWriteLine($hndlHTML, '<p class=Text>')
        FileWriteLine($hndlHTML, '<span>' & $arrData[$i][3] & '</span>')
        FileWriteLine($hndlHTML, '</p>')
        FileWriteLine($hndlHTML, '</td>')
        FileWriteLine($hndlHTML, '<td class=Text>')
        FileWriteLine($hndlHTML, '<p class=Text>')
        FileWriteLine($hndlHTML, '<span>' & $arrData[$i][4] & '</span>')
        FileWriteLine($hndlHTML, '</p>')
        FileWriteLine($hndlHTML, '</td>')
        FileWriteLine($hndlHTML, '<td class=Text>')
        FileWriteLine($hndlHTML, '<p class=Text>')
        FileWriteLine($hndlHTML, '<span>' & $arrData[$i][5] & '</span>')
        FileWriteLine($hndlHTML, '</p>')
        FileWriteLine($hndlHTML, '</td>')
        FileWriteLine($hndlHTML, '</tr>')
    Next
    FileWriteLine($hndlHTML, '</table></body>')
    FileWriteLine($hndlHTML, '</html>')
    FileClose($hndlHTML)
    Return @TempDir & '\FileFold.html'
EndFunc   ;==>WinFile_BuildHTML

EDIT: Removed PC user name information from file paths

Edited by Wruck
Link to comment
Share on other sites

It's only because I have been working alot with HTML5 & CSS3 recently.

http://www.autoitscript.com/autoit3/mvps/guinness/

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

The examples are great, but what Xenobiologist wants to do is create something using >> https://github.com/jzaefferer/jquery-treeview OR http://mbraak.github.io/jqTree/ which appears to be an up to date version.

Xenobiologist,

Check out the demo, it's basically just nested unordered lists, quite easy to work from there given your level in AutoIt.

PS, your initial code is not runnable at all, hence why I went with the approach of showing pre-exisiting examples.

Edited by guinness

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

Like this >> http://mbraak.github.io/jqTree/examples/autoescape.html using JSON to create the structure.

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

Thanks everybody. Those examples are nice, but not really what I was/am looking for.

What I try to do (and going to do) is :

  1. Read file/folder structure (recursive)
  2. Write this structure to a HTML file (the way that a JQuery + a tree-plugin can work with the file)  therefore, I need to set the html-tags
  3. Start the html file (which contains static hyperlinks to all the files listed) Then the user can navigate through the hyperlinks file/folder structure via a treeview-function using the javascript

That's all.

@guinness : my initial code runs fine (with the includes). But it does only ~20 % of the task yet.

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

Your example didn't run, hence why I couldn't understand what your issue was.

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

Did you get it know, or do I have to explain something more detailed?

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

I understand, but I don't see why you can't write it as you understand AutoIt.

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

Edit : Another requirement is: Sorting the files by name or date.

 

Always create two output files linked to each other and do the sorting with AutoIt?

Edit:

And your example does really not run out of the box, as all includes seem to be missing.

Edited by KaFu
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...