Gibbo Posted September 15, 2010 Posted September 15, 2010 We have the Lifechannel system here. Its quite boring to log in daily and change the date in the ticker. Noseying around the file structure, we see that the text comes from a file called ticker.txt How easy would it be to write a batch file that's called at, say, 6am every day that overwrites the existing ticker.txt with a fresh one that says "Welcome to our school. Today is "? TIA
glennda Posted September 15, 2010 Posted September 15, 2010 I use a html webpage with java script - not sure if the system will let you do that - code below. Time and date <br /> <!-- Begin<br /> <br /> // Get today's current date.<br /> var now = new Date();<br /> <br /> // Array list of days.<br /> var days = new Array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday');<br /> <br /> // Array list of months.<br /> var months = new Array('January','February','March','April','May','June','July','August','September','October','November','December');<br /> <br /> // Calculate the number of the current day in the week.<br /> var date = ((now.getDate()<10) ? "0" : "")+ now.getDate();<br /> <br /> // Calculate four digit year.<br /> function fourdigits(number) {<br /> return (number < 1000) ? number + 1900 : number;<br /> }<br /> <br /> // Join it all together<br /> today = days[now.getDay()] + ", " +<br /> months[now.getMonth()]+ " " +<br /> date + ", " +<br /> (fourdigits(now.getYear())) ;<br /> <br /> // Print out the data.<br /> document.write(today);<br /> <br /> // End --><br /> 1
LosOjos Posted September 15, 2010 Posted September 15, 2010 Create a batch file (.bat) that contains something along the lines of: echo Welcome to our school. Today is %date% > C:\your\path\ticker.txt NOTE: That will overwrite the file so that it will only contain that line, so bare that in mind before you try it 1
Gibbo Posted September 15, 2010 Author Posted September 15, 2010 Thanks everyone, far simpler than I imagined!
Gibbo Posted September 15, 2010 Author Posted September 15, 2010 Had some great fun developing this today. Here's our current release: 'Open up the path to save the information into a text file Dim Stuff, myFSO, WriteStuff, dateStamp dateStamp = Date() Const ForWriting = 2 Set objFSO = CreateObject("Scripting.FileSystemObject") Set objFile = objFSO.OpenTextFile("E:\media\ticker\ticker.txt", ForWriting) ' Blank the text file before creating todays data objFile.Write "" objFile.Close 'Get todays date DIM iDay iDay = DatePart("w", Date()) SELECT CASE iDay Case "1" strDayName = "Sunday" Case "2" strDayName = "Monday" Case "3" strDayName = "Tuesday" Case "4" strDayName = "Wednesday" Case "5" strDayName = "Thursday" Case "6" strDayName = "Friday" Case "7" strDayName = "Saturday" END SELECT 'Write information to Text File Stuff = "Good morning and welcome to our school. Today is " localDate = FormatDateTime(date(), 1) joinedup = Stuff + strDayName + " " + localdate + "." Set myFSO = CreateObject("Scripting.FileSystemObject") Set WriteStuff = myFSO.OpenTextFile("E:\media\ticker\ticker.txt", 8, True) 'WriteStuff.WriteLine(Stuff) 'WriteStuff.WriteLine(localdate) WriteStuff.WriteLine(joinedup) WriteStuff.Close SET WriteStuff = NOTHING SET myFSO = NOTHING Assuming anyone else with Lifechannel has their system set up the same way this should work.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now