Opening files in Gadgets

Hello,

I want to open a file in a Gadget. Is there any possibility to do that I tried it with a File Object in JavaScript but this it seems that this isn't included into the API. After that I tried it with VBScript:

Sub readFile(ByVal filename)
Set fileObj = CreateObject("Scripting.FileSystemObject")
set file = fileObj.OpenTextFile(filename,ForReading)
set text = file.readAll
file.close
set file = nothing

return text
End Sub

But this also doesn't work.

Is there any possibility to do that without an ActiveX Object JavaScript is preffered.



Answer this question

Opening files in Gadgets

  • dmkp231

    Code looks okay, are you definately passing the full path and filename

    If you want to do it in JavaScript:

    function readFile(sFile) {
    var fTmp = oFSO.OpenTextFile(sFile, 1);
    var sText = fTmp.ReadAll();
    fTmp.Close();

    return sText;
    }

  • TomWardill

    Thank you very much!
    That's exactly what I searched!

    Works perfect

  • Opening files in Gadgets