silurian Posted December 7, 2009 Posted December 7, 2009 Hey guys i need some help here maybe alot hehe i got a folder called templates with a whole bunch of different html templates in folders soo the structure is C:\template\temp1 for example i am trying to make a script that will give a list of all the sub folders in the templates folder and then when you click preview will open the index.html in a preview box any idea on how to do this thanx http://sparticus.webhop.net
jvanegmond Posted December 7, 2009 Posted December 7, 2009 Make a GUI including one listbox and one embedded internet explorer window. Populate the listbox with folder names you find in the selected directory. On click of the listbox item: Navigate the embedded IE window to the index.html of the folder selected in the listbox. github.com/jvanegmond
silurian Posted December 7, 2009 Author Posted December 7, 2009 Make a GUI including one listbox and one embedded internet explorer window.Populate the listbox with folder names you find in the selected directory.On click of the listbox item: Navigate the embedded IE window to the index.html of the folder selected in the listbox.hey man how do i populate the listboxthats the part i am having trouble with (shoudl have said that) http://sparticus.webhop.net
jvanegmond Posted December 7, 2009 Posted December 7, 2009 Functions to search folders: FileFindFirstFile FileFindNextFile Functions to populate list box: GUICtrlSetData github.com/jvanegmond
silurian Posted December 7, 2009 Author Posted December 7, 2009 (edited) Func set_list() $prelist = _FileListToArray (@HomePath &"\Templates\") ; 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 $list1[0] ; for loop to place the files in the list. GUICtrlSetData($list1, (StringTrimRight($prelist[$x], 4)) & "|", 1) ; string trim the last 4 characters ( .txt ) Next EndFunc i tried that but i get the message no files/folder all the time Edited December 7, 2009 by silurian http://sparticus.webhop.net
jvanegmond Posted December 7, 2009 Posted December 7, 2009 The directory @HomeDrive & "\Templates\" does not exist. github.com/jvanegmond
silurian Posted December 7, 2009 Author Posted December 7, 2009 (edited) i checked again and yup it doesbut the directory C:\Templates is full of sub foldersnot sure if theat causes a problem with _FileListToArray or noti am also trying to do it with the findfisrtfile thing but not sure how to use that lolbtw thanx for the help so farheres a link to the full code so far maybe that will help toohttp://pastebin.com/m443f2126also have changed line 44 to $prelist = _FileListToArray (@HomePath &"\Templates") ; list files to an array. Edited December 7, 2009 by silurian http://sparticus.webhop.net
skyboy Posted December 7, 2009 Posted December 7, 2009 no, the director @HomePath & "\Templates\" does not exist, he got confused and used @HomePath imstead of @HomeDrive, which is the change to make the script work, except this: For $x = 1 To $list1[0] ; for loop to place the files in the list. GUICtrlSetData($list1, (StringTrimRight($prelist[$x], 4)) & "|", 1) ; string trim the last 4 characters ( .txt ) Next should be For $x = 1 To $prelist[0] ; for loop to place the files in the list. GUICtrlSetData($list1, (StringTrimRight($prelist[$x], 4)) & "|", 1) ; string trim the last 4 characters ( .txt ) Next
silurian Posted December 7, 2009 Author Posted December 7, 2009 (edited) Another UpdateFinal CodeYAY finished and workingsee code attachedcan anyone help me with adding a option to change pathi have done the menus but not sure on how to go about setting the pathalso if i added this option i would need to add an INI file to save and read the path fromany help would be awsome thanx again guys Edited December 7, 2009 by silurian http://sparticus.webhop.net
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now