dynamitemedia Posted March 27, 2015 Posted March 27, 2015 i know this is simple but i cant seem to figure it out... here is my code : For $s_idx = 1 To $search_things[0] If StringInStr(FileGetAttrib($search_root & $search_things[$s_idx]), 'D', 0, 1) Then $href = StringEncrypt(1, 'SandelPerieanu|' & StringLeft($search_root, StringInStr($search_root, '\', 0, -1) - 1) & '|' & $search_root & $search_things[$s_idx], $pass_encrypt) $s_dirs &= '<a class="padding1" href="folder-' & $href & '"><img align="middle" hspace="10" border=0 height="28px" width="28px" src="filefolder.png"><b>' & $search_things[$s_idx] & '</b></a><br>' & @CRLF Else $files = $search_things[$s_idx] Local $folder2check = $search_root Local $vidType = "*.flv" Local $FileList = _FileListToArray($folder2check , $vidType, $FLTA_FILES, True) If @error Then ; display nothing Else For $i = 1 To $FileList[0] $okFiles = GetFileName($FileList[$i]) ConsoleWrite("this is the files allowed : " & $okFiles & @CRLF) $href = StringEncrypt(1, 'SandelPerieanu|' & $search_root & $okFiles, $pass_encrypt) $s_files &= '<a class="padding1" href="file-' & $href & '"><img align="middle" hspace="10" border=0 height="28px" width="28px" src="file.png"><b>' & $okFiles & '</b></a><br>' & @CRLF Next WEnd EndIf EndIf Next Just trying to only show certain files NOT all file extension, no need to show windows files etc... well it works BUT because of the for loop it is showing the files more than once, i have been stuck on this for a few hours and not sure how else to get the correct files with out a for loop inside the other loop. any ideas? Obvisously only want to display the files once this code starts about line 360 this code is from here:
javiwhite Posted March 27, 2015 Posted March 27, 2015 Hey DynamiteMedia, You could always add a stringInStr check to your code, prior to adding the data to the $s_Files var (I assume this is the one that's showing the files multiple times?) Something like this if StringInStr($s_files,$okfiles) = 0 then $s_files &= '<a class="padding1" href="file-' & $href & '"><img align="middle" hspace="10" border=0 height="28px" width="28px" src="file.png"><b>' & $okFiles & '</b></a><br>' & @CRLF The above checks whether the filename is contained in the main string, and if it's not, Add it. It's not the most sophisticated way of resolving the issue, But it's a quick fix that should help you achieve what you're trying to do. Hope this helps Javi give a man an application, and he'll be frustrated for the day, Teach him how to program applications and he'll be frustrated for a lifetime.
Solution dynamitemedia Posted March 27, 2015 Author Solution Posted March 27, 2015 that worked great actually thanks!
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