Solved

ASP FSO and Javascript Slideshow

Posted on 2011-03-04
8
403 Views
Last Modified: 2012-05-11
Some EE wizard wrote the attached. It renders our the image but does not switch images. I have no thumbs, just 10 jpegs in a folder.

These are images taken of the first hole of our golf course.  I'm using an X10 camera and software to automagically take and upload the pics to our web server.

I need then to somehow manage the uploaded images by periodically deleting all but the 10 most recent. I've heard Powershell is in order for this kind of work, but I'm not familiar with it. I have full control of the web server.  Any help or other ideas welcome.
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Slideshow</title>          
<%
 response.write  "<scri" & "pt language=javascript>"    &  vbcrlf
 response.write  "var delta = 10;"   &  vbcrlf
 response.write  "var picno = 1;"   &  vbcrlf
 response.write "var  pictures  = new Array();"   &  vbcrlf
 response.write "var  titles    = new Array();"   &  vbcrlf

thumbFilePath = "http://www.jennco.com/avgcwebcam/"
imageFilePath = "http://www.jennco.com/avgcwebcam/"
strPhysicalPath="E:\web\users\jennco\avgcwebcam\"

Set fso = CreateObject("Scripting.FileSystemObject")
set mainfolder=fso.GetFolder(strPhysicalPath)
Set filecollection = mainfolder.Files
intTotPics = 0
For Each file In filecollection
      response.write "pictures[" & cstr(intTotPics) & " ] = '" & file.name  & "';"  &  vbcrlf
      response.write "titles[" & cstr(intTotPics) & " ] = '" & fso.getbasename(strPhysicalPath & file.name)  & "';"  &  vbcrlf
      if intTotPics = 0 then
        sFirstPic = file.name
        sFirstTitle = fso.getbasename(strPhysicalPath & file.name)
      End If
  intTotPics = intTotPics + 1
Next
%>                                              

function init()  {
    setInterval("FadeInOut(MyTable);", 10)
}  

function FadeInOut(obj)  {                  
    if ((obj.filters.alpha.opacity + delta > 100)
    ||  (obj.filters.alpha.opacity + delta < 0))  {
         if(obj.filters.alpha.opacity  + delta <= 0) {  
      // faded out, now change it      
    document.images("PicImg").src = "<%=imageFilePath%>" + pictures[picno];
    document.all.item("PicTitle").innerText = titles[picno];
          if (picno == pictures.length - 1) picno = 0;
          else picno++;        
    }    
        delta = - delta;                                            
    }
    obj.filters.alpha.opacity += delta;
}
</script>
</head>

<body onLoad="init()">  
<center>
<%Response.Write Ucase(mainfolder.Name)%>
<span id=MyTable  style="width:100%; filter:alpha(opacity=100); text-align:center;" >
<table border='0' cellpadding='4'>
<tr>
<td align="center">
<img id="PicImg" src='<%=imageFilePath & sFirstPic%>'>
</td>
</tr>
<tr>
 <td align="center">
<div id="PicTitle">
<%response.write sFirstTitle%>
</div>
</td>
</tr>
</table>
</span>
</body>

</html>

Open in new window

0
Comment
Question by:webdork
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
8 Comments
 
LVL 58

Expert Comment

by:amit_g
ID: 35106267
Post the rendered code i.e. run it in the browser and do View Source and post that.
0
 
LVL 58

Expert Comment

by:amit_g
ID: 35112681
How come that is a solution :) If you resolved it yourself, post the solution here and accept that as an answer.
0
 

Author Comment

by:webdork
ID: 35112730
Didn't know i could.  
0
Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

 

Author Comment

by:webdork
ID: 35112744
I was just so grateful that someone finally responded after 6 days.
0
 

Accepted Solution

by:
webdork earned 0 total points
ID: 35117796
I simplified to just show the most recent image.
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<style type="text/css">
img
{
position:absolute;
left:0px;
top:0px;
z-index:-1;
border-style:solid;
border-width:1px;
}
</style>

<title>AVGC WebCam</title>          
<%
set oFolder=createobject("scripting.filesystemobject").getfolder("E:\web\users\******\******")
For Each aFile In oFolder.Files
    If sNewest = "" Then
        Set fNewest = aFile
        sNewest = aFile.Name
    Else
        If fNewest.DateCreated < aFile.DateCreated Then
            Set fNewest = aFile
        End If
    End If
Next


%>                                              

</head>

<body>  

<div>
<img src="http://www.******.com/******/<%response.write fNewest.Name%>">
<div style="padding-left:15px;padding-top:200px;color:#FFFFFF; font-weight:bold;">
<%response.write DATEADD("h",-3,fNewest.DateCreated) 
%>


</div>
</div>

</body>

</html>

Open in new window

0
 

Author Closing Comment

by:webdork
ID: 35154526
simplified
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Article by: DanRollins
This article describes a JavaScript program that creates a maze made of hexagonal cells.  In Part 2 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7850-Hex-Maze-Part-2.html), we'll extend the program by adding a depth-…
This article discusses how to implement server side field validation and display customized error messages to the client.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question