Hi! I've got 2 scripts here. For this widget you simply drag and drop either a single image, or a folder (if the folder has sub-folders it will get pics from there too). The coding is a bit advanced but if you want to know more I created a slideshow tutorial a while back. Here's a link (scroll down for all three parts)--
sViz articles1. Create an object and set the size to 200 x 200 (or whatever, just make sure the size is set). Name the object "picture".
2. Create another object. It will be the play/stop button
Insert this script into the button object:
Sub Object_OnLbuttonUp(x,y,d)
If Not d Then
Select Case Desktopx.Object("picture").state
Case "play"
state= "stop"
Case "stop"
state= "play"
End Select
Desktopx.Object("picture").state = state
Desktopx.ScriptObject("picture").Object_OnStateChange(state)
End If
End Sub
Insert this script into the "picture" object:
Dim files, picscount, grpofpics, numofpics
Dim foldercheck, fs, f, f1, fc, sf, subfld, fldpics, subfld2
'Called when the script is executed
Sub Object_OnScriptEnter
picscount = 0
End Sub
Sub Object_OnDropFiles(files)
'Stop timer, clear variables
object.KillTimer 1
grpofpics = ""
subfld2 = ""
subfld = ""
fldpics = ""
subcount = 0
'Files have extensions (.bmp), a folder does not
'We search the string to see if it contains a period
foldercheck = Instr(1, files, ".")
'If user drops a folder, get files within folder
If foldercheck = 0 Then
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFolder(files)
Set fc = f.Files
Set sf = f.SubFolders
'In the main folder....
For Each f1 In fc
'Check file extensions for valid images
checkext = Instr(f1.name, ".")
If checkext > 0 Then
checkext = Split(f1.name,".")
extension = LCase(checkext(1))
End If
'Create a variable, listing only valid image files in folder
If extension = "bmp" Or extension = "png" _
Or extension = "ico" Or extension = "jpg" _
Or extension = "tga" Then
fldpics= fldpics & f & "\" & f1.name & "|"
End If
Next
'Check if folder contains subfolders
For Each f1 In sf
subcount = subcount + 1
Next
'If folder contains subfolder get subfolder name,
'call function to get files from subfolder
If subcount >0 Then
For Each f1 In sf
subfld = f & "\" & f1.name
searchSubfolders
Next
'If there are subfolders within subfolder
If subfld2 <> "" Then
subfld2 = Left(subfld2, Len(subfld2)- 1)
subfldgrp = Split(subfld2, "|")
'Search sub-subfolders for images
For Each elem In subfldgrp
subfld = elem
searchSubfolders
Next
End If
If grpofpics <> "" Then grpofpics = Left(grpofpics, Len(grpofpics)-1)
End If
'Create variable listing both files from main folder
'and files from subfolder
If grpofpics = "" And fldpics <> "" Then fldpics = Left(fldpics, Len(fldpics)-1)
allpics = fldpics & grpofpics
'If there are images found, create array and count images
If allpics <> "" Then
grpofpics = Split(allpics, "|")
numofpics = UBound(grpofpics)
End If
'If user drops files
ElseIf foldercheck > 0 Then
grpofpics= Split(files, "|")
For Each elem In grpofpics
'Check file extensions for valid images
checkext = Split(elem,".")
extension = LCase(checkext(1))
'Create a variable, listing only valid image files in folder
If extension = "bmp" Or extension = "png" _
Or extension = "ico" Or extension = "jpg" _
Or extension = "tga" Then
validpics= validpics & elem & "|"
End If
Next
'If there are images found, create array and count images
If validpics <> "" Then
validpics = Left(validpics, Len(validpics)-1)
grpofpics = Split(validpics, "|")
numofpics = UBound(grpofpics)
Else
grpofpics = ""
End If
End If
'If grpofpics contains images, set first picture on drop and add to picscount
If IsArray(grpofpics) = True Then
Object.Picture = grpofpics(0)
picscount = 1
Else
msgbox "No images found"
End If
'If there is more than one image start timer on drop
If numofpics > 0 Then
object.SetTimer 1, 2000
object.state = "play"
End If
End Sub
'---Function to search subfolder for images---
Sub searchSubfolders
Set f2 = fs.GetFolder(subfld)
Set fc2 = f2.Files
Set sf2 = f2.SubFolders
For Each f1 In fc2
'Check file extensions for valid images
checkext = Instr(f1.name, ".")
If checkext > 0 Then
checkext = Split(f1.name,".")
extension = LCase(checkext(1))
End If
'Create a variable, listing only valid image files in folder
If extension = "bmp" Or extension = "png" _
Or extension = "ico" Or extension = "jpg" _
Or extension = "tga" Then
grpofpics= grpofpics & f2 & "\" & f1.name & "|"
End If
Next
'Get names of subfolder subfolders, if any
For Each f1 In sf2
subfld2 = subfld2 & subfld & "\" & f1.name & "|"
Next
End Sub
Sub Object_Ontimer1
'If count is higher than number of pics then reset count
If picscount > numofpics Then picscount = 0
'Set picture
Desktopx.Object("picture").states("").Picture = grpofpics(picscount)
'Add to count
picscount = picscount + 1
End Sub
Sub Object_OnstateChange(state)
If state = "play" And numofpics <> 0 Then
object.settimer 1, 2000
ElseIf state = "stop" Then
object.KillTimer 1
End If
End Sub
Hope this helps.