View Single Post
Old March 6th, 2012, 03:49 AM   #1
JElder
Member
Scotland

JElder is offline
 
Join Date: Apr 2011
Location: Aberdeen
Posts: 23
Fix32 v6.1 -> iFIX v5.5 VBA Problem Scripts

Good Morning,

This is my first post and my first real exposure to GE and the Fix/iFIX environments so please bear with me.

I am currently in the process of migrating a Fix32 v6.1 system (WinNT) to iFIX v5.5 on Windows 7 32 bit / Professional.

I have converted the database (PDB) over and imported it in to iFIX.

I have changed the driver from ABR to IGS.

I have configured IGS with the IP addresses of the 2x PLC's it will be talking to.

I have converted all the graphics from the old ".odf" format to the new ".grf".

And thanks to the Migration Tool suite I have converted MOST of the VBA script associated with the pictures over to the new iFIX syntax.

However (and there always is a however), there are just a few scripts that need ironing out and I'm hoping this is where the e-Forum will help me


I ran through all 303 graphics to see what code was causing issues and I now have a record of it so here goes. Apologies for the length of this post.: -

--------------------------------------------------------------------------------------------------------
Shell "HTD" + " " + -CG, 1 'RUNTASK HTD -CG "Aeration Blowers"
Exit Sub
ErrorHandler:
HandleError

--------------------------------------------------------------------------------------------------------

Shell "WORDPAD" + " " + "SINGLE", 1 'RUNTASK WORDPAD SINGLE
Exit Sub
ErrorHandler:
HandleError
--------------------------------------------------------------------------------------------------------

'iFIX Global Variable Object Created 'DECLARE #TASK STRING GLOBAL
'
'User.g_varTASK.CurrentValue = ""C:\PROGRAM FILES\VERITAS SOFTWARE\BACKUP EXEC"" '#TASK = "C:\PROGRAM FILES\VERITAS SOFTWARE\BACKUP EXEC"
'
'User.g_varTASK.CurrentValue = User.g_varTASK.CurrentValue + "\SYSTEM\BESTART.EXE" 'STRCAT #TASK "\SYSTEM\BESTART.EXE"
'
Shell User.g_varTASK.CurrentValue + " " + "SINGLE", 1 'RUNTASK #TASK SINGLE
Exit Sub
ErrorHandler:
HandleError

--------------------------------------------------------------------------------------------------------

On Error GoTo ErrorHandler
'DataEntry Type = Numeric
'DataEntry OPRLO = 0.
'WizardName=DataEntry
Dim vntLow As Variant
Dim vntHigh As Variant
Dim intReturn As Integer
Dim blnFetch As Boolean
If blnDataEntryFrmFlag = True Then
Exit Sub
End If
GetFormNumeric
FetchLimits "Fix32.FIX.H3_MD00X_SBYSP_SAI.F_CV", vntHigh, vntLow, intReturn
Numeric.GetTheLimits H:=vntHigh, L:=vntLow
blnFetch = True
Numeric.IsAlpha A:=False
Numeric.GetTheVars A:=1, B:="Fix32.FIX.H3_MD00X_SBYSP_SAI.F_CV"
Numeric.Show 'DataEntry OPRHI = 0.
Exit Sub
ErrorHandler:
HandleError

--------------------------------------------------------------------------------------------------------

'NO CONVERSION CURRENTLY AVAILABLE ---> 'DataEntry Type = MenuItems
'DataEntry MenuItem1 =
'DataEntry MenuItem2 =
'DataEntry MenuItem3 =
'DataEntry MenuItem4 =
Exit Sub
ErrorHandler:
HandleError
--------------------------------------------------------------------------------------------------------
Dim varCHK As Single 'DECLARE #CHK NUMERIC
ConvertRT_CheckRights "SL DRYER SPT ENTRY", CInt(varCHK) 'CHECKRIGHTS "SL DRYER SPT ENTRY" #CHK
If varCHK = 1# Then 'IF #CHK == 1.0
AcknowledgeAllAlarms ' ALARMACKALL
Else 'ELSE
MsgBox "Login As Operator Or Above" ' NOTE "Login As Operator Or Above"
End If 'ENDIF

Exit Sub
ErrorHandler:
HandleError

--------------------------------------------------------------------------------------------------------

Private Sub BUTTON13_MouseUp(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Double, ByVal Y As Double)
On Error GoTo ErrorHandler

'RUN WORDPAD SINGLE
Exit Sub
ErrorHandler:
HandleError
End Sub

--------------------------------------------------------------------------------------------------------

';Script for While Down follows
';HINT: Use timer events for WhileDown functionality
'
varUP001 = 1 '#UP001 = 1
'NO CONVERSION CURRENTLY AVAILABLE ---> 'CRITICAL
Dim varSTORE As Single 'DECLARE #STORE NUMERIC SCRIPT
Dim varHIGHL As Single 'DECLARE #HIGHL NUMERIC SCRIPT
Dim varLOWL As Single 'DECLARE #LOWL NUMERIC SCRIPT
Dim varCOUNT As Single 'DECLARE #COUNT NUMERIC SCRIPT
Dim varSTEP As Single 'DECLARE #STEP NUMERIC SCRIPT
varCOUNT = 0 '#COUNT = 0
varSTORE = ReadValue("Fix32.FIX.G-MIT700-SETPOINT.F_CV") 'GETVAL FIX:G-MIT700-SETPOINT.F_CV #STORE
varHIGHL = 8# '#HIGHL = 8.00
varLOWL = 0# '#LOWL = 0.00
varSTEP = 0.01 '#STEP = 0.01
L1: '&L1
If varCOUNT < 10 Then 'IF #COUNT < 10
If varSTORE + varSTEP <= varHIGHL Then ' IF #STORE + #STEP <= #HIGHL
varSTORE = varSTORE + varSTEP ' #STORE = #STORE + #STEP
Else ' ELSE
varSTORE = varHIGHL ' #STORE = #HIGHL
End If ' ENDIF
Else 'ELSE
If varCOUNT < 19 Then ' IF #COUNT <19
If varSTORE + (varSTEP * 10) <= varHIGHL Then ' IF #STORE + (#STEP * 10) <= #HIGHL
varSTORE = varSTORE + (varSTEP * 10) ' #STORE = #STORE + (#STEP * 10)
Else ' ELSE
varSTORE = varHIGHL ' #STORE = #HIGHL
End If ' ENDIF
Else ' ELSE
If varCOUNT < 28 Then ' IF #COUNT <28
If varSTORE + (varSTEP * 100) <= varHIGHL Then ' IF #STORE + (#STEP * 100) <= #HIGHL
varSTORE = varSTORE + (varSTEP * 100) ' #STORE = #STORE + (#STEP * 100)
Else ' ELSE
varSTORE = varHIGHL ' #STORE = #HIGHL
End If ' ENDIF
Else ' ELSE
If varSTORE + (varSTEP * 1000) <= varHIGHL Then ' IF #STORE + (#STEP * 1000) <= #HIGHL
varSTORE = varSTORE + (varSTEP * 1000) ' #STORE = #STORE + (#STEP * 1000)
Else ' ELSE
varSTORE = varHIGHL ' #STORE = #HIGHL
End If ' ENDIF
End If ' ENDIF
End If ' ENDIF
End If 'ENDIF
varCOUNT = varCOUNT + 1 '#COUNT = #COUNT + 1
Call WriteValue(CStr(varSTORE), "Fix32.FIX.G-MIT700-SETPOINT.F_CV") 'SETVAL FIX:G-MIT700-SETPOINT.F_CV #STORE
'NO CONVERSION CURRENTLY AVAILABLE ---> 'ENDCRITICAL
'Goto L1 'GOTO L1
';On Down Script; DECLARE #UP001 NUMERIC PICTURE
varUP001 = 0 '#UP001 = 0
Exit Sub
ErrorHandler:
HandleError
--------------------------------------------------------------------------------------------------------
CloseDigitalPoint varNAME_S 'CLOSEDIG #NAME_S
ClosePicture "DM_YESNO"
Exit Sub
ErrorHandler:
HandleError

--------------------------------------------------------------------------------------------------------

Shell "HTD.EXE" + " " + "-cg 'CHART8'", 1 'RUNTASK HTD.EXE "-cg 'CHART8'"
Exit Sub
ErrorHandler:
HandleError

--------------------------------------------------------------------------------------------------------

ClosePicture "PC_33" 'CLOSEPIC PC-33
ClosePicture "CC_33" 'CLOSEPIC CC-33
Dim varCHK As Single 'DECLARE #CHK NUMERIC
ConvertRT_CheckRights "SL DRYER SPT ENTRY", CInt(varCHK) 'CHECKRIGHTS "SL DRYER SPT ENTRY" #CHK
If varCHK = 1# Then 'IF #CHK == 1.0
OpenPicture "CC_33" ' OPENPIC CC-33
Else 'ELSE
OpenPicture "PC_33" ' OPENPIC PC-33
End If 'ENDIF
Exit Sub
ErrorHandler:
HandleError

--------------------------------------------------------------------------------------------------------
  Reply With Quote