3 public const cnRefreshTime = 5 ' refresh time in seconds
5 ' filename for file with all pictures and file containing the name of the current picture
6 public const csFilePicture= "picture.txt"
7 public const csFileCurrent= "currpic.txt"
9 ' constants for file-access
14 Dim FILE_LINE_DELIMITER
15 FILE_LINE_DELIMITER = vbCRLF
18 ' * Get data from file using a given separator.
20 function File_getDataVirtual( sFilename, sServerPath, sSeperator )
23 Dim aFSObject, sServerFileName
25 Set aFSObject = CreateObject("Scripting.FileSystemObject")
26 sServerFileName = aFSObject.BuildPath( Server.MapPath( sServerPath ), sFileName )
28 File_getDataVirtual = ""
29 if Err.Number = 0 then
30 File_getDataVirtual = File_read( sServerFileName )
31 If Not IsNull(File_getDataVirtual) Then
32 File_getDataVirtual = Replace( File_getDataVirtual, FILE_LINE_DELIMITER, sSeperator)
33 File_getDataVirtual = Split( File_getDataVirtual, sSeperator)
39 ' * Get data from a file
41 function File_read( sFilename )
44 Dim aFSObject, aStream
46 Set aFSObject = CreateObject( "Scripting.FileSystemObject" )
47 Set aStream = aFSObject.OpenTextFile( sFilename, ForReading )
49 while not aStream.AtEndOfStream
50 File_read = File_read + aStream.ReadLine + FILE_LINE_DELIMITER
57 ' * Get data from a file given by filename and virtual pathname
59 Function File_readVirtual(sFileName, sServerPath)
62 Dim aFSObject, sServerFileName
64 Set aFSObject = CreateObject("Scripting.FileSystemObject")
65 sServerFileName = aFSObject.BuildPath( Server.MapPath( sServerPath ), sFileName )
68 if Err.Number = 0 then
69 File_readVirtual = File_read( sServerFileName )
74 ' * Write data to a file
76 function File_write( sFileName, sText )
81 Set aFSObject = CreateObject( "Scripting.FileSystemObject" )
82 if Err.Number = 0 then
83 Set aFile = aFSObject.CreateTextFile( sFileName, TRUE )
84 if Err.Number = 0 then
90 File_write = ( Err.Number = 0 )
94 ' * Write data to a file given by filename and virtual pathname
96 function File_writeVirtual( sFileName, sServerPath, sText )
99 Dim aFSObject, aServerFile
101 Set aFSObject = CreateObject( "Scripting.FileSystemObject" )
102 aServerFile = aFSObject.BuildPath( Server.MapPath( sServerPath ), sFileName )
104 If Err.Number = 0 Then
105 File_writeVirtual = File_write( aServerFile, sText )
107 File_writeVirtual = false