#include #include #include #include #include #include #include #Region ### START Koda GUI section ### Form=C:\Users\Administrator\Documents\Form1.kxf If Not FileExists (@HomeDrive & "\path.ini") then Set_path() $oIE = _IECreateEmbedded () $Form1 = GUICreate("Template Previewer", 1024, 800, 192, 124) $GUIActiveX = GUICtrlCreateObj($oIE, 180, 32, 835, 700) $List1 = GUICtrlCreateList("", 0, 32, 177, 700) $Label1 = GUICtrlCreateLabel("Templates", 56, 8, 53, 17) $Label2 = GUICtrlCreateLabel("Preview", 600, 8, 53, 17) $Btnexit = GUICtrlCreateButton("Exit", 600, 750, 75, 25, $WS_GROUP) $btnList = GUICtrlCreateButton("List Files", 5, 750, 80, 25, $WS_GROUP) $btnview = GUICtrlCreateButton("View Selection", 90, 750, 80, 25, $WS_GROUP) $Mfile = GUICtrlCreateMenu("File") $Mcpath = GUICtrlCreateMenuItem("Change Path", $Mfile) $Mexit = GUICtrlCreateMenuItem("Exit", $Mfile) Global $spath = IniRead("C:\path.ini", "Path", "key", "") GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### _IENavigate ($oIE, "") While 1 $nMsg = GUIGetMsg() Select Case $nMsg = $GUI_EVENT_CLOSE Exit Case $nMsg = $btnexit Exit Case $nMsg = $btnList Set_list() Case $nMsg = $btnview Set_view() Case $nMsg = $Mexit Exit Case $nMsg = $Mcpath Set_path() EndSelect WEnd Func set_list() $prelist = _FileListToArray ($spath) ; list files to an array. If (Not IsArray($prelist)) Or (@error = 1) Then MsgBox(262208, "Preview Error", "No Files\Folders Found. ", 5) Return EndIf GUICtrlSetData($list1, "") ; set list to empty. For $x = 1 To $prelist[0] ; for loop to place the files in the list. GUICtrlSetData($list1,$prelist[$x] & "|", 1) ; string trim the last 4 characters ( .txt ) Next EndFunc Func Set_view() $s_text = GUICtrlRead($list1) ; read the selected file to a variable. If $s_text = "" Then Return _IENavigate ($oIE, $spath & "\" & $s_text & "/index.html") EndFunc Func Set_path() $spath = InputBox("Change Templates Path", "Enter Full path to Templates folder.", "") IniWriteSection("C:\path.ini", "path", "Key=" & $spath, 0) EndFunc