I have used all the variables and funtions of jscripts to read a local txt file and show it on a tile (1 line)
what is the proper code ?
I use this:
function ReadFile()
{
var FileOpener = new ActiveXObject(“Scripting.FileSystemObject”);
var FilePointer = FileOpener.OpenTextFile(“C:Zeeshan.txt”, 1, true);
FileContents = FilePointer.ReadAll(); // we can use FilePointer.ReadAll() to read all the lines
alert(FileContents);
FilePointer.Close();
}
Two answers have been given that explain what you need. You must have the function RETURN something. This is usually the last line of the script.
function nowplaying(filepath) {
var artist = file.ReadFromFile(filepath+'\\Snip_Artist.txt');
var song = file.ReadFromFile(filepath+'\\Snip_Track.txt');
if (song=='') {
return '<size 14>Click here to start Music</size>';
}
return '<italic>' + song + '</italic><linebreak/>' + artist;
}