Page 1 of 1

script movicon manipolare file csv o txt

Posted: 26/07/2023, 10:22
by angelisrl
Buongiorno,
ho un interfaccia creata su movicon a cui dovrei aggiungere tramite script la possibilità di manipolare un file .csv
il programma gira su un TD410

Sub Main()

Dim fo
Dim mode
Const NEU=0
Const delimiter=";"
Const gap=""
Const path = "\My Documents\log_4.csv"

mode=8

Set fo= CreateObject("FileCtl.Filesystem")
fo.Open path,mode


If fo.LOF = NEU Then
fo.LinePrint("intestazione")
End If

fo.LinePrint("test record")
fo.Close
Set fo = Nothing

End Sub

l'avvio dello script mi genera l'errore seguente:

line 12, offset 0
ActiveX automation: server could not be found

ho testato anche il seguente script:

Sub Main()

Dim filePath As String
Dim contentToWrite As String
filePath = "\My Documents\log_114.csv"
contentToWrite = "prova"


' Apri il file per la scrittura
Open filePath For Output As #1

' Scrivi il contenuto nel file
Print #1, contentToWrite

' Chiudi il file
Close #1


End Sub

in questo secondo caso non ho nessun errore visualizzato, ma il file mi rimane comunque vuoto

Re: script movicon manipolare file csv o txt

Posted: 02/08/2023, 9:55
by Pixsys tecnico 1
Salve,
se il suo scopo è di scrivere alcune righe in un file di testo, in allegato uno script di esempio.
Scrivere su file.zip