Iris _

Pixsys Forum

everybody's effort for the same goal

script movicon manipolare file csv o txt

Post Reply
angelisrl
Posts: 14
Joined: 23/03/2022, 8:54

script movicon manipolare file csv o txt

Post 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
Pixsys tecnico 1
Moderatore
Posts: 1662
Joined: 29/10/2010, 10:09
Contact:

Re: script movicon manipolare file csv o txt

Post 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
You do not have the required permissions to view the files attached to this post.
Post Reply