Per scrivere un file usando BasicScript

Dim fso, MyFile
Set fso = CreateObject(“Scripting.FileSystemObject”)
Set MyFile = fso.CreateTextFile(“c:\testfile.txt”, True)

MyFile.WriteLine(CStr(Time)&” , “&CStr(HMIRuntime.Tags(“Tag1″).Read))
MyFile.Close

Diversamente in cScript si possono usare le funzioni standard

{
FILE * fp;
DWORD dw;
float fl;

fp = fopen(“C:\\variables.txt”,”w”);
if (fp!=NULL)
{
dw=GetTagDouble(“DwordTag”);
fl=GetTagFloat(“FloatTag”);
fprintf(fp,”%d\r\n”,dw);
fprintf(fp,”%f\r\n”,fl);
fclose(fp);
}
else printf(“%s”,”File failed”);
}

     Leave a Reply

    (required)

    (required)

    You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>