DesktopX internet object

HI all,

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



Powered by SkinBrowser!
2,479 views 7 replies
Reply #1 Top
if you have the latest build of dx loading new images into objects becomes possible without the need for a web object using the new object.picture call in dxscript which dynamically assigns a new image file to an object.

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
Reply #2 Top
Cool I didn't realize that such an object existed, and thanks for the code snipit. I'll give it a try and report back on the results



Powered by SkinBrowser!
Reply #3 Top
hmm which version of dx are you using? I have 2.19a installed and object.picture is not supported yet. is it in the 2.19h version? I hd not updated yet because I had had alot of trouble with some of the eariler beta builds and so was waiting for some of the bugs to get worked out more. In any event I will still give the other code a try later on.



Powered by SkinBrowser!
Reply #4 Top
I am using 2.19h - archive your current version and give it a try, it's by far the most stable build I have used yet, not sure whether there are some bugs that may crop up, but I havent had any troubles so far
[Message Edited]
Reply #5 Top
Well I desided to first try and use the code snippit with the web browser as the holder for the image. First the code snippit worked fantastic! The problems that I had were with timming, finally got it all worked out, and now it works grea1! just point the code to a folder with images and the picture changes every 20 min and I am not using my webserver.

Thanks Tiggz for the help




Powered by SkinBrowser!
Reply #6 Top
Glad you got it working Black Knight

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 Top
Thanks for the link I just added it to my bookmarks



Powered by SkinBrowser!