DesktopX internet object
Saturday, July 3, 2004 by Black Knight | Discussion: WinCustomize Talk
I made my own "picture frame" after lookint at "newlandframes" and realizing that what he was doing was using IE and rendering a webpage on the fly to hold the reference to the image. Really very cool. But what I wanted was a picture frame that would load pictures at random from a folder. Well what I ended up with does just that, you point it to a folder and every 20 minutes it will load a new image from the list of images.
Here is my problem, To do this I took advantage of the fact that I am running a webserver on my computer and just wrote a dynamic site in python that loads a new image every time the page is updated. I then just pointed my web object to my own URL and update it every 20 minutes with a timer. Now I know that this should be doable without a webserver using just vbscript, but I'm not all that good with VBscript. So how do you get the contents of a folder into an array, and then how do you randomly get one if the items from the array?
Any and all help would be great
Jose
Reply #2 Saturday, July 3, 2004 9:30 PM
Reply #3 Saturday, July 3, 2004 9:41 PM

Reply #4 Saturday, July 3, 2004 10:19 PM
[Message Edited]
Reply #5 Sunday, July 4, 2004 1:25 AM
Thanks Tiggz for the help

Reply #6 Sunday, July 4, 2004 11:04 AM

plug: if you have any more dx questions try posting them at the DesktopX Project forum http://joedoug.com/dxforums/index.php There are a few people there, including myself, who are usually willing to help out and/or say "hmmmmm, tricky..." consolingly
[Message Edited]
Reply #7 Monday, July 5, 2004 1:11 AM
Please login to comment and/or vote for this skin.
Welcome Guest! Please take the time to register with us.
There are many great features available to you once you register, including:
- Richer content, access to many features that are disabled for guests like commenting on the forums and downloading skins.
- Access to a great community, with a massive database of many, many areas of interest.
- Access to contests & subscription offers like exclusive emails.
- It's simple, and FREE!







Reply #1 Saturday, July 3, 2004 8:21 PM
this is a subroutine to load all jpg files from a folder into an array (filelist):
Dim filelist()
Sub listfiles(path)
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder(path)
Set colFiles = objFolder.Files
If colFiles.Count > 0 Then
ReDim filelist(colFiles.Count)
i=0
For Each objFile In colFiles
ext=instrrev(objFile.Name,".")
ext=mid(objFile.Name,ext+1,len(objFile.Name)-ext)
If ext="jpg" Then
filelist(i) = path&"\"&objFile.Name
i = i + 1
End If
Next
ReDim Preserve filelist(i-1)
End If
End Sub
to get a random file from the array you would need to use something like:
randomfile=filelist(Cint(rnd*Ubound(filelist))
not sure if that last bit works, haven't tested it, but I know the sub works because I was working on a dx slideshow type thing which I may go back to at some point