Solved

ASP FSO and Javascript Slideshow

Posted on 2011-03-04
8
398 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
  • 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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

In my daily work (mainly using ASP.net), I need to write a lot of JavaScript code. One of the most repetitive tasks I do are the jQuery Ajax calls. You know: (CODE) I don't know if for you it's the same, but for me is soooo tedious to write the …
In Part 1 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7849-Hex-Maze.html) we covered the hexagonal maze basics -- how the cells are represented in a JavaScript array and how the maze is displayed.  In this part, we'…
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…

759 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now