Click or drag to resize
Remarks

This method returns the object AlarmItems of the alarming module. In this collection all existing alarms are listed. With the method Item you can access single alarms. The single alarm entries contain information on the alarms.Filter String:If the string is not "*", then the string should represent the name (case sensitive) of a zenon function.If a function with the given name exists, the filter settings within this function will be used.--> only version 6.51 and above.

Datatype
IAlarmItems

Availability

Environment

Availability

Editor

Unused

Runtime

Readonly

VBA

Available

VSTA

Available

Parameters
strFilter as BSTR

Example
C#
public void MacroGetAlarmItems()
{
    IAlarm zenonAlarm = this.Alarm();
    IAlarmItems zenonAlarmItems = zenonAlarm.AlarmItems("*");
    for (int i = 0; i < zenonAlarmItems.Count; ++i)
    {
        IAlarmItem zenonAlarmItem = zenonAlarmItems.Item(i);
        PrintAlarm(zenonAlarmItem);
    }
}
private void PrintAlarm(IAlarmItem alarm)
{
    Debug.Print("TimeComes : " + alarm.Timecomes);
    Debug.Print("TimeGoes : " + alarm.Timegoes);
    Debug.Print("TimeAcknowledged : " + alarm.TimeAcknowledged);
    Debug.Print("Text : " + alarm.Text);
    Debug.Print("Variable : " + alarm.Variable().Name);
    Debug.Print("Value : " + alarm.Value);
}
VB.NET
'  Displays the amount of alarms currently in memory and
' *  the alarm text of all the different alarms.

Public Sub MacroGetAlarmItems()
    'Get alarm object(s) from active project
    Dim zenonAlarm As IAlarm = Me.Alarm()
    Dim zenonAlarmItems As IAlarmItems = zenonAlarm.AlarmItems("*")
    MessageBox.Show(String.Format("{0} Alarms in memory...", zenonAlarmItems.Count))
    'get text of active alarms...
    For i As Integer = 0 To zenonAlarmItems.Count - 1
        Dim zenonAlarmItem As IAlarmItem = zenonAlarmItems.Item(i)
        Debug.Print(zenonAlarmItem.Text)
    Next
End Sub
VBA
Public Sub GetAlarmItems()
Dim zAML As Alarm
Dim zAML_Items As AlarmItems
Dim zAML_Item As AlarmItem
Dim i As Integer
'set alarm objects
Set zAML = thisProject.Alarm
   'get all items
Set zAML_Items = zAML.AlarmItems("*")
   'get specific item using the screen switch function as filter
   '
Set zAML_Items = zAML.AlarmItems("myFunction")
'get count of active alarms...
MsgBox zAML_Items.Count & " Alarms in memory..."
'get text of active alarms...
For i = 0 To zAML_Items.Count - 1

Set zAML_Item = zAML_Items.Item(i)

Debug.Print zAML_Item.Text
Next i
End Sub