Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Open a folder "play" the photos close folder open onother in a loop

Status
Not open for further replies.

FISKO

Technical User
Aug 30, 2005
113
GB
Hi In our school we have a few stand alone machines that we use to play loops of photos of sporting events, science projects, etc. What I would like to do is have some method of selecting a set of folders to play, then have them play in turn, opening the folders I specify,playing the contents, closing opening the next folder and so on, any pointers or help would be appreciated.
 
i wrote a screensaver something similar to what you describe.

you might need something like:

1. read in ini file of folders to 'play'
2. script then loops through folders
3. script then loops through all .jog/.bmp files inthis currnet folder
4. some sort of timer function to display pic for certain time
5. display pic

i think step 5 is important.
i just had a vbForm which filled the whole screen with an image control on it. if you dont have access to VB then you might want to consider creating an Appliction.IE object yo ucan then just do an IE.Naviagate to the new .jpg or .gif etc when you need to.

you can get rid of step one and forget about the ini file if you decide to have a root folder containing folders of all your pics...that way you can just do a recursive folder pass on it



 
'this is pretty messy and i havent tried it, there is a lot i dont like about it. not sure if the IE stuff will update, perhaps there is a .Refresh method that needs to be called after the .Navigate. hopefully it will give you somewhere to start, or perhaps more questions...oh, i think this will only work on an RM machine ;-)

Set FSO = WScript.CreateObject("Scripting.FileSystemObject")
Set dicFolders = CreateObject("Scripting.Dictionary")

'get folders in memory
Set tsINI = FSO.OpenTextFile("c:\folderlist.txt", 1, False)
Do While Not tsINI.AtEndOfStream
sLine = ""
sLine = UCase(Trim(tsINI.ReadLine))
If sLine <> "" Then
If Not dicFolders.Exists(sLine) Then
dicFolders.Add sLine, "1"
End If
End If
Loop
tsINI.Close
Set tsINI = Nothing

'setup IE???
Set appIE = CreateObject("InternetExplorer.Application")
appIE.ToolBar = False
appIE.StatusBar = False
appIE.Visible = True
appIE.FullScreen = true
appIE.Height = Me.Height
appIE.Width = Me.Width
appIE.Left = 50
appIE.Top = 50



Call sDisplay(dicFolders)

Sub sDisplay(ByVal dicPassed)
Dim aFolder, aFile, objFolder
For Each aFolder In dicPassed
If FSO.FolderExists(aFolder) Then
Set objFolder = FSO.GetFolder(aFolder)
For Each aFile In objFolder.Files
If LCase(Right(aFile.Name, 4)) = ".jpg" Then
'hmm do something now
Call displayPic(aFile)
Wscript.Sleep 5000
End If
Next
Set objFolder = Nothing
End If
Next

Call sDisplay(dicPassed)

End Sub


Sub displayPic(ByRef aFile)
appIE.Navigate aFile.Path
End Sub
 
as i say, a recursive folder/file manip would really make things simpler......
 
Set FSO = WScript.CreateObject("Scripting.FileSystemObject")
'setup IE???
Set appIE = CreateObject("InternetExplorer.Application")
appIE.ToolBar = False
appIE.StatusBar = False
appIE.Visible = True
appIE.FullScreen = true
appIE.Height = Me.Height
appIE.Width = Me.Width
appIE.Left = 50
appIE.Top = 50

'when will it all end???
Do
checkFiles FSO.GetFolder("C:\pictures")
Loop


Sub checkFiles(oFolder)
Dim oSubFolder, oFile
For Each oFile In oFolder.Files
If LCase(Right(oFile.Name, 4)) = ".jpg" Then
Call displayPic(oFile)
Wscript.Sleep 5000
End If
Next
For Each oSubFolder In oFolder.SubFolders
checkFiles oSubFolder
Next
End Sub


Sub displayPic(ByRef aFile)
appIE.Navigate aFile.Path
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top