Storage of data in local folder

0

People have this script that was created by a colleague who is no longer active. The problem though it seems that everything is right there is something wrong and I can not find what it is. Its purpose is to store a small amount of data from a form in a folder created when it is filled out. In case the script should besides create a folder should allow editing and deletion of the content. This script was made for internet explorer but if anyone has an idea of a script that works in firefox it would be better.

//Cria Objeto ActiveX
var dados = new ActiveXObject("Scripting.FileSystemObject");

//Função para gravar o arquivo
function GravarArquivo (arq,texto){
//pasta a ser salvo o arquivo
var pasta = "C:\Users\Convidado\Desktop\teste";

//se o parametro arq que é o nome do arquivo vier vazio ele salvará o arquivo com o nome “Sem Titulo”
if(arq==""){arq="Sem Titulo";}
//carrega o txt
var esc = dados.CreateTextFile(pasta+arq+".txt", false);
//escreve o que foi passado no parametro texto que é o texto contido no TextArea
esc.WriteLine(texto);
//fecha o txt
esc.Colose();
}
//Função para abrir o arquivo
fuction AbreArquivo (arq){
//o parametro arq é o endereço do txt
//carrega o txt
var arquivo = dados.OpenTextFile(arq, 1, true);
//varre o arquivo
while(!arquivo.AtEndOfStream){
//escreve o txt no TextArea
document.getElementById("texto").value = arquivo.ReadAll();
}
//fecha o txt
arquivo.Close();
}
    
asked by anonymous 22.08.2015 / 05:26

0 answers