Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Option Explicit
- ' Author: Twily 2015
- ' Description: Generate a list of images from a specific path to use with
- ' the homepage-sidebar.html (this includes subdirectories).
- ' Website: http://twily.info/
- Dim strPath,strData,tmpList,objFSO,objTS,objShell
- Set objFSO=CreateObject("Scripting.FileSystemObject")
- tmpList="C:\imagelist.txt"
- strPath=objFSO.GetAbsolutePathName(".")
- Sub Recurse(objFolder)
- Dim strName,objFile,objSubFolder,objExt
- For Each objFile In objFolder.Files
- objExt=LCase(objFSO.GetExtensionName(objFile.Name))
- If objExt="jpg" or objExt="jpeg" or objExt="png" Then
- strName=Replace(objFile.Path,strPath,"")
- strName=Replace(strName,"\","/")
- strName=Replace(strName,"%","%25")
- 'objTS.Write("""" & strName & """,")
- objTS.WriteLine("""" & strName & """,")
- End If
- Next
- For Each objSubFolder In objFolder.SubFolders
- Recurse objSubFolder
- Next
- End Sub
- Do
- strPath=InputBox("Enter path to images: ","Imagelist-generator",strPath)
- If objFSO.FolderExists(strPath) Then
- Set objTS=objFSO.OpenTextFile(tmpList,2,True)
- Recurse objFSO.GetFolder(strPath)
- objTS.Close()
- Set objShell=WScript.CreateObject("WScript.Shell")
- objShell.Run "notepad.exe " & tmpList
- strPath=Replace(strPath,"\","/")
- strPath=Replace(strPath,"%","%25")
- InputBox "Path to use with imagelist: ","Imagelist-generator","file:///" & strPath
- objFSO.DeleteFile tmpList,True
- Exit Do
- ElseIf Len(strPath) Then
- MsgBox "Error: Invalid path.",vbCritical,"Error"
- Else
- Exit Do
- End If
- Loop
- WScript.Quit
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement