How can Function Keys (F1 thru F12) be defined differently for DeltaV workstations in the same system?

I have successfully defined F1 through F10 to call up 12 unique graphics displays for 12 different reactors. (This plant just happens to have 12 reactors.) Modifications were made to the scripts in the Globals/ User.fxg file without issue. I now realize that in the next phase of this project we will be adding additional workstations where F1 -F12 may be re-defined or perhaps not even used. How do I add a script filter in the User.fxg based on the workstation name. I have tried the scripts format I used in the Usersettings file for determining the initial opening display based on workstation name. An excerpt is shown below. This is not working.

END IF
       

  • In the script check for the computer name before opening the graphic:

    If StrComp(frsGetComputerName, "OP_WS1", vbTextCompare) = 0 Then

    ...

    Or probably the better solution:

    Create Variables on User that each of the hot keys script will use to open (if something other than "") and then in User settings update these variables to the display name that should be opened when that key is pressed for each workstation (either by the method above or indivudual workstation UserSettings files).

  • In reply to Matt Stoner:

    Matt,
    Thanks for your help. I was heading in the direction pointed to by your first suggestion. This seems to work without issue.

    Public Sub FixGlobals_F1()
    On Error GoTo ErrorHandler
    If (StrComp(frsGetComputerName, "B32_WS1_FLR2", vbTextCompare) = 0) Or (StrComp(frsGetComputerName, "B32_WS1_FLR3", vbTextCompare) = 0) Then
    frszExpertReplacePic 2, "R_3201.grf"
    End If
    Exit Sub
    ErrorHandler:
    frsHandleError
    End Sub
    Public Sub FixGlobals_F2()
    On Error GoTo ErrorHandler
    If (StrComp(frsGetComputerName, "B32_WS1_FLR2", vbTextCompare) = 0) Or (StrComp(frsGetComputerName, "B32_WS1_FLR3", vbTextCompare) = 0) Then
    frszExpertReplacePic 2, "R_3202.grf"
    End If
    Exit Sub
    ErrorHandler:
    frsHandleError
    End Sub
    (and so on, for the other 10 F keys...)
  • May I suggest (slightly) different code?

    Public Sub FixGlobals_F1()
           On Error GoTo ErrorHandler

            Select Case UCase$(frsGetComputerName)
           Case "B32_WS1_FLR2", "B32_WS1_FLR3"
                   frszExpertReplacePic 2, "R_3201.grf"
           Case "WS_X"
                   frszExpertReplacePic 2, "X_3201.grf"
           Case Else
                   ' Whatever you want to do for non-listed workstations
           End Select
           Exit Sub
    ErrorHandler:
           frsHandleError
    End Sub

    Public Sub FixGlobals_F2()
           On Error GoTo ErrorHandler

            Select Case ucase$(frsGetComputerName)
           Case "B32_WS1_FLR2", "B32_WS1_FLR3"
                   frszExpertReplacePic 2, "R_3202.grf"
           Case "WS_X"
                   frszExpertReplacePic 2, "X_3202.grf"
           Case Else
                   ' Whatever you want to do for non-listed workstations
           End Select
           Exit Sub
    ErrorHandler:
           frsHandleError
    End Sub

    (and so on, for the other 10 F keys...)

    Using Select Case...Case...End Select instead of If...Then...End If makes it much easier to add to your list of workstations. The "UCase$(...)" makes it case insensitve (as long as your Case's are uppercase).