All
I am still trying (without success) to get a simple slideshow on my local PC that will work on an HTML page but get the images from a folder on my hard drive.
I have got the following code in VB Script to access my files and add them to an array which works on my local Computer
******************************************
GetFileList "C:\Documents and Settings\HP_Owner\Desktop\Slideshow\pics\"
Function GetFileList(folder)
intcount = 0
Dim fileArray()
Set fso = CreateObject("Scripting.fileSystemObject")
Set fold = fso.getFolder(folder)
For Each file in fold.files
ReDim Preserve fileArray(intcount)
fileArray(intcount)=file.Name
'Get Title from File Name Left(fileArray(intCount),Len(fileArray(intCount)-4))
intCount = intCount + 1
Next
Set fold = nothing: set fso = nothing
End Function
********************************************
I also found a really cool simple slide show script searching this forum which uses an array to populate the slide show,
My question is how can I merge the two scripts together so the array is populated from my chosen directory or can I translate the code above into javascript that will work on my computer (No Server)
I would really appreciate some help with this as although I am learning a lot I am getting nowhere
thanks
Gibbo
**********************************
<form><input type="button" value="<- Back" onclick="clearInterval(slideshow); clickphoto(-1);"> <input type="button" value="Resume Slideshow" onclick="slideshow=setInterval('swapimage()', 1000);"> <input type="button" value="Next ->" onclick="clearInterval(slideshow); clickphoto(1);"></form>
<div id="caption" style="font-family:arial; font-size:13;"></div><br>
<img name="photo">
<script language="javascript">
function clickphoto(direction)
{
pi += direction;
pi %= photo.length;
if (pi ==-1) pi = photo.length - 1;
displayphoto(pi);
}
function swapimage()
{
pi++;
pi %= photo.length;
displayphoto(pi);
}
function displayphoto(photonum)
{
document.images['photo'].src=photo[photonum].name;
caption.innerHTML=(photonum + 1) + ' of ' + photo.length + '<br> ';
if (photo[photonum].caption.length > 0)
{
caption.innerHTML+='<b>' + photo[photonum].caption + '</b>';
}
caption.innerHTML+=' ';
}
function Photo(name, caption)
{
this.name=name;
this.caption=caption;
return this;
}
var photo=new Array(), pi=0;
photo[pi++]=new Photo('./pics/pic01.jpg'
,'Caption1');
photo[pi++]=new Photo('./pics/pic02.jpg','Caption2');
photo[pi++]=new Photo('./pics/pic03.jpg','Caption3');
pi=0;
var caption=document.getElementById('caption');
displayphoto(pi);
var images=new Array();
for (var ii=0;ii<photo.length;ii++)
{
images[ii]=new Image();
images[ii].src=photo[ii].name;
}
var slideshow=setInterval('swapimage()', 10000);
</script>
*************************
I am still trying (without success) to get a simple slideshow on my local PC that will work on an HTML page but get the images from a folder on my hard drive.
I have got the following code in VB Script to access my files and add them to an array which works on my local Computer
******************************************
GetFileList "C:\Documents and Settings\HP_Owner\Desktop\Slideshow\pics\"
Function GetFileList(folder)
intcount = 0
Dim fileArray()
Set fso = CreateObject("Scripting.fileSystemObject")
Set fold = fso.getFolder(folder)
For Each file in fold.files
ReDim Preserve fileArray(intcount)
fileArray(intcount)=file.Name
'Get Title from File Name Left(fileArray(intCount),Len(fileArray(intCount)-4))
intCount = intCount + 1
Next
Set fold = nothing: set fso = nothing
End Function
********************************************
I also found a really cool simple slide show script searching this forum which uses an array to populate the slide show,
My question is how can I merge the two scripts together so the array is populated from my chosen directory or can I translate the code above into javascript that will work on my computer (No Server)
I would really appreciate some help with this as although I am learning a lot I am getting nowhere
thanks
Gibbo
**********************************
<form><input type="button" value="<- Back" onclick="clearInterval(slideshow); clickphoto(-1);"> <input type="button" value="Resume Slideshow" onclick="slideshow=setInterval('swapimage()', 1000);"> <input type="button" value="Next ->" onclick="clearInterval(slideshow); clickphoto(1);"></form>
<div id="caption" style="font-family:arial; font-size:13;"></div><br>
<img name="photo">
<script language="javascript">
function clickphoto(direction)
{
pi += direction;
pi %= photo.length;
if (pi ==-1) pi = photo.length - 1;
displayphoto(pi);
}
function swapimage()
{
pi++;
pi %= photo.length;
displayphoto(pi);
}
function displayphoto(photonum)
{
document.images['photo'].src=photo[photonum].name;
caption.innerHTML=(photonum + 1) + ' of ' + photo.length + '<br> ';
if (photo[photonum].caption.length > 0)
{
caption.innerHTML+='<b>' + photo[photonum].caption + '</b>';
}
caption.innerHTML+=' ';
}
function Photo(name, caption)
{
this.name=name;
this.caption=caption;
return this;
}
var photo=new Array(), pi=0;
photo[pi++]=new Photo('./pics/pic01.jpg'
,'Caption1');
photo[pi++]=new Photo('./pics/pic02.jpg','Caption2');
photo[pi++]=new Photo('./pics/pic03.jpg','Caption3');
pi=0;
var caption=document.getElementById('caption');
displayphoto(pi);
var images=new Array();
for (var ii=0;ii<photo.length;ii++)
{
images[ii]=new Image();
images[ii].src=photo[ii].name;
}
var slideshow=setInterval('swapimage()', 10000);
</script>
*************************