- Katılım
- 17 Ara 2008
- Mesajlar
- 42
- Puanları
- 1
- Yaş
- 41
Şimdi arkadaşlar bu forum sitesinde yapılmış ollan bazı vb.scriptleri wincc de yaptım. Örnek olarak
Option Explicit
Function action
Dim STARTT
Set STARTT = HMIRuntime.Tags.Item("START").Read
If STARTT=1 Then
Dim DEGER_2
Set DEGER_2 = HMIRuntime.Tags("DEGER_2")
Dim DEGER
Set DEGER =HMIRuntime.Tags("DEGER")
Dim ExcelNesne
Set ExcelNesne = CreateObject ("Excel.Application")
ExcelNesne.Workbooks.Open ("C:\Documents and Settings\atıskan\Desktop\bahadır.xls")
X = 1
Do Until ExcelNesne.CELLS(X,1)=False
X = X + 1
Loop
ExcelNesne.Cells(X,1).value = Time
ExcelNesne.Cells(X,2).value = Date
ExcelNesne.Cells(X,3).value = DEGER.Read
ExcelNesne.Cells(X,4).value = DEGER_2.Read
ExcelNesne.ActiveWorkbook.Save
excelnesne.Workbooks.close
excelnesne.Quit
End If
End Function
Bir başka örnek olarak da
Option Explicit
Function action
Dim okunan_tag
okunan_tag = HMIRuntime.Tags.Item ("START").Read
If okunan_tag = 1 Then
HMIRuntime.Tags.Item ("DEGER").Write 1
Else
HMIRuntime.Tags.Item ("DEGER").Write 0
End If
End Function.
Bu scriptleri Global Script-->VBscript-->Action kısmına yazıyorum. kaydediyorum.Wincc yi Runtime yapıyorum.PLCden Gelen sinyalle "start"ı ilişkilendiriyorum. Ama PLCden gelen start=1 olduğu halde bu scriptler çalışmıyor. Nerede yanlış yapılıyor. Bu global scripte yazılanlar nezaman çalışıyor.Wincc ye koyduğum butonların eventrine yazmış olduğum aynı scriptler çalışıyor.Global Scriptte yazmış olduklrım neden çalışmıyor.
Option Explicit
Function action
Dim STARTT
Set STARTT = HMIRuntime.Tags.Item("START").Read
If STARTT=1 Then
Dim DEGER_2
Set DEGER_2 = HMIRuntime.Tags("DEGER_2")
Dim DEGER
Set DEGER =HMIRuntime.Tags("DEGER")
Dim ExcelNesne
Set ExcelNesne = CreateObject ("Excel.Application")
ExcelNesne.Workbooks.Open ("C:\Documents and Settings\atıskan\Desktop\bahadır.xls")
X = 1
Do Until ExcelNesne.CELLS(X,1)=False
X = X + 1
Loop
ExcelNesne.Cells(X,1).value = Time
ExcelNesne.Cells(X,2).value = Date
ExcelNesne.Cells(X,3).value = DEGER.Read
ExcelNesne.Cells(X,4).value = DEGER_2.Read
ExcelNesne.ActiveWorkbook.Save
excelnesne.Workbooks.close
excelnesne.Quit
End If
End Function
Bir başka örnek olarak da
Option Explicit
Function action
Dim okunan_tag
okunan_tag = HMIRuntime.Tags.Item ("START").Read
If okunan_tag = 1 Then
HMIRuntime.Tags.Item ("DEGER").Write 1
Else
HMIRuntime.Tags.Item ("DEGER").Write 0
End If
End Function.
Bu scriptleri Global Script-->VBscript-->Action kısmına yazıyorum. kaydediyorum.Wincc yi Runtime yapıyorum.PLCden Gelen sinyalle "start"ı ilişkilendiriyorum. Ama PLCden gelen start=1 olduğu halde bu scriptler çalışmıyor. Nerede yanlış yapılıyor. Bu global scripte yazılanlar nezaman çalışıyor.Wincc ye koyduğum butonların eventrine yazmış olduğum aynı scriptler çalışıyor.Global Scriptte yazmış olduklrım neden çalışmıyor.