Fortinet white logo
Fortinet white logo

User Guide

7.2.0

Script examples

Script examples

Below are instructions and examples how to create scripts with different methods to trigger an action:

Event listener

Event listeners are scripts that trigger when an event such as an alarm or a VIP detection occurs. Event listeners use the same set of events as the event manager.

This example script displays the camera and all nearby cameras whenever it detects movement. It displays them in a second window.

  1. Click the Settings button in the top right corner.
  2. Go to Settings > Scripts.
  3. In the Name field, enter a unique name for your script, such as “Example alarm management”.
  4. In the Trigger dropdown list, select Event Listener.
  5. Click the Event Filter button and then select Camera Detection. Deselect all other events.
  6. Click the Device Filter button and then select the cameras which can trigger the event.
  7. Click the New button.
  8. In the actions area, from the Action dropdown list, select AlarmManagement.
  9. Click the plus ( + ) button on the right side of the row to add parameters.
  10. In the parameters area:
    1. In the Target Arearow:
      1. From Type, select Panes.
      2. In Value, enter W2 (this means all view panes in window number 2).
    2. In the Include Nearby Camerasrow:
      1. In Value, enter True.
    3. In the Ordering and Cycling rows, keep the default values.
  11. At the top right corner of the parameters area, select the checkbox.

    In the actions area, in the Primary Parameter column, it should now display W2.

  12. Click Apply.
  13. Click OK.
  14. Click the Settings button in the top right corner.
  15. Go to Add Window.

    A second window appears.

  16. In the second window, on the top two view panes, click the Settings button and select Receive Alarms. For all view panes below them, select Scratch Pad.

    When an alarm occurs, it appears in the view pane at the top left. Older alarms will be shifted right, the live video stream from the camera will appear in the view pane below it, and any scratch panes below will contain any cameras nearby to the one that triggered the alarm.

Periodic

Periodic scripts activate repeatedly at specific times. For example, an hourly periodic script will trigger at the start of every hour. It does not consider the time interval since the script was created, so hourly scripts created at 6:00 and 6:15 will both run at 7:00, 8:00, etc.

This example script creates a reminder to do a building perimeter check.

  1. Click the Settings button in the top right corner.
  2. Go to Settings > Scripts.
  3. In the Name field, enter a unique name for your script, such as “Example periodic perimeter check”.
  4. In the Trigger dropdown list, select Periodic.
  5. In the next dropdown, select 1 hour(s).
  6. Click the New button.
  7. In the actions area, from the Action dropdown list, select PlayAudio.
  8. Click the plus ( + ) button on the right side of the row to add parameters.

    Keep the defaults.

  9. At the top right corner of the parameters area, click the checkmark ( ✓ ) button to apply the parameters to the action.
  10. Click the Apply button.

    Every hour, an alarm sound will remind the security guard to walk around the building.

Manual

Unlike other scripts, manual scripts are not triggered automatically. They are used to quickly perform many actions on demand.

This example script clears all alarms and scratch pad view panes in a second FortiCentral window.

  1. Click the Settings button in the top right corner.
  2. Go to Settings > Scripts.
  3. In the Name field, enter a unique name for your script, such as “Example clear alarms”.
  4. In the Trigger dropdown list, select Manual.
  5. Select the Show in Main Window checkbox.
  6. Click the New button.
  7. In the actions area, from the Action dropdown list, select ClearPaneSet.
  8. Click the plus ( + ) button on the right side of the row to add parameters.
  9. In the parameters area, in the Pane/Panesrow, in Value, enter W2 (this means all view panes in window number 2).
  10. At the top right corner of the parameters area, click the checkmark ( ✓ ) button to apply the parameters to the action.

    In the actions area, in the Primary Parameter column, it should now display W2.

  11. Click Apply.
  12. Click OK.

    A new button with an abbreviation of the script's name now appears in the toolbar at the top of the first ("main") window, between the layouts and the gauges for network (N), memory (M), and rendering (R).

    In this example, the button has the label "Eca" ("Example clear alarms").

  13. Click the Settings button in the top right corner.
  14. Go to Add Window.

    A second window appears.

  15. On the first window, click the new "Eca" button.

    All view panes in the second window are emptied.

Using manual scripts with 3D maps

Similar to using a button on FortiCentral to manually trigger your script, you can also use a 3D map of your building.

  1. Click the Settings button in the top right corner.
  2. Go to Settings >Scripts.
  3. In the Name field, enter a unique name for your script, such as “Example door buzz”.
  4. In the Trigger dropdown list, select Manual.
  5. Click the New button.
  6. In the actions area, from the Action dropdown list, select ControlAccess.
  7. Click the plus ( + ) button on the right side of the row to add parameters.
  8. In the parameters area:
    1. In the ACS Devicerow, from Value, select Front Door (or whatever name the door has).
    2. In the State row, from Value, select Buzz.
    3. In the Buzz row. In Value, enter 30(that is, 30 seconds).
  9. At the top right corner of the parameters area, click the checkmark ( ✓ ) button to apply the parameters to the action.

    In the actions area, in the Primary Parameter column, it should now display ControlAccess.

  10. Click Apply.
  11. Click OK.
  12. From the 3D Maps panel, drag the floor plan that you want to use with the script into a view pane.
  13. In the view pane where your 3D map is displayed, click the Settings button.
  14. Go to Enable Edit Mode.
  15. Click the Edit Cameras & Elements button.
  16. If you already have a button on the 3D map, click to select it.

    Otherwise drag a button from the Models toolbar area at the bottom of the view pane onto the 3D map near the door. In the Name field, enter "Front Door Button".

  17. In the Scripts dropdown list on the right side, select the script that you created, "Example door buzz".
  18. Click the Save Changes button.
  19. Click the Settings button on the view pane, and then deselect Enable Edit Mode.
  20. On the 3D map, click Front Door Button.

    The front door should unlock for 30 seconds before it locks again.

Script examples

Script examples

Below are instructions and examples how to create scripts with different methods to trigger an action:

Event listener

Event listeners are scripts that trigger when an event such as an alarm or a VIP detection occurs. Event listeners use the same set of events as the event manager.

This example script displays the camera and all nearby cameras whenever it detects movement. It displays them in a second window.

  1. Click the Settings button in the top right corner.
  2. Go to Settings > Scripts.
  3. In the Name field, enter a unique name for your script, such as “Example alarm management”.
  4. In the Trigger dropdown list, select Event Listener.
  5. Click the Event Filter button and then select Camera Detection. Deselect all other events.
  6. Click the Device Filter button and then select the cameras which can trigger the event.
  7. Click the New button.
  8. In the actions area, from the Action dropdown list, select AlarmManagement.
  9. Click the plus ( + ) button on the right side of the row to add parameters.
  10. In the parameters area:
    1. In the Target Arearow:
      1. From Type, select Panes.
      2. In Value, enter W2 (this means all view panes in window number 2).
    2. In the Include Nearby Camerasrow:
      1. In Value, enter True.
    3. In the Ordering and Cycling rows, keep the default values.
  11. At the top right corner of the parameters area, select the checkbox.

    In the actions area, in the Primary Parameter column, it should now display W2.

  12. Click Apply.
  13. Click OK.
  14. Click the Settings button in the top right corner.
  15. Go to Add Window.

    A second window appears.

  16. In the second window, on the top two view panes, click the Settings button and select Receive Alarms. For all view panes below them, select Scratch Pad.

    When an alarm occurs, it appears in the view pane at the top left. Older alarms will be shifted right, the live video stream from the camera will appear in the view pane below it, and any scratch panes below will contain any cameras nearby to the one that triggered the alarm.

Periodic

Periodic scripts activate repeatedly at specific times. For example, an hourly periodic script will trigger at the start of every hour. It does not consider the time interval since the script was created, so hourly scripts created at 6:00 and 6:15 will both run at 7:00, 8:00, etc.

This example script creates a reminder to do a building perimeter check.

  1. Click the Settings button in the top right corner.
  2. Go to Settings > Scripts.
  3. In the Name field, enter a unique name for your script, such as “Example periodic perimeter check”.
  4. In the Trigger dropdown list, select Periodic.
  5. In the next dropdown, select 1 hour(s).
  6. Click the New button.
  7. In the actions area, from the Action dropdown list, select PlayAudio.
  8. Click the plus ( + ) button on the right side of the row to add parameters.

    Keep the defaults.

  9. At the top right corner of the parameters area, click the checkmark ( ✓ ) button to apply the parameters to the action.
  10. Click the Apply button.

    Every hour, an alarm sound will remind the security guard to walk around the building.

Manual

Unlike other scripts, manual scripts are not triggered automatically. They are used to quickly perform many actions on demand.

This example script clears all alarms and scratch pad view panes in a second FortiCentral window.

  1. Click the Settings button in the top right corner.
  2. Go to Settings > Scripts.
  3. In the Name field, enter a unique name for your script, such as “Example clear alarms”.
  4. In the Trigger dropdown list, select Manual.
  5. Select the Show in Main Window checkbox.
  6. Click the New button.
  7. In the actions area, from the Action dropdown list, select ClearPaneSet.
  8. Click the plus ( + ) button on the right side of the row to add parameters.
  9. In the parameters area, in the Pane/Panesrow, in Value, enter W2 (this means all view panes in window number 2).
  10. At the top right corner of the parameters area, click the checkmark ( ✓ ) button to apply the parameters to the action.

    In the actions area, in the Primary Parameter column, it should now display W2.

  11. Click Apply.
  12. Click OK.

    A new button with an abbreviation of the script's name now appears in the toolbar at the top of the first ("main") window, between the layouts and the gauges for network (N), memory (M), and rendering (R).

    In this example, the button has the label "Eca" ("Example clear alarms").

  13. Click the Settings button in the top right corner.
  14. Go to Add Window.

    A second window appears.

  15. On the first window, click the new "Eca" button.

    All view panes in the second window are emptied.

Using manual scripts with 3D maps

Similar to using a button on FortiCentral to manually trigger your script, you can also use a 3D map of your building.

  1. Click the Settings button in the top right corner.
  2. Go to Settings >Scripts.
  3. In the Name field, enter a unique name for your script, such as “Example door buzz”.
  4. In the Trigger dropdown list, select Manual.
  5. Click the New button.
  6. In the actions area, from the Action dropdown list, select ControlAccess.
  7. Click the plus ( + ) button on the right side of the row to add parameters.
  8. In the parameters area:
    1. In the ACS Devicerow, from Value, select Front Door (or whatever name the door has).
    2. In the State row, from Value, select Buzz.
    3. In the Buzz row. In Value, enter 30(that is, 30 seconds).
  9. At the top right corner of the parameters area, click the checkmark ( ✓ ) button to apply the parameters to the action.

    In the actions area, in the Primary Parameter column, it should now display ControlAccess.

  10. Click Apply.
  11. Click OK.
  12. From the 3D Maps panel, drag the floor plan that you want to use with the script into a view pane.
  13. In the view pane where your 3D map is displayed, click the Settings button.
  14. Go to Enable Edit Mode.
  15. Click the Edit Cameras & Elements button.
  16. If you already have a button on the 3D map, click to select it.

    Otherwise drag a button from the Models toolbar area at the bottom of the view pane onto the 3D map near the door. In the Name field, enter "Front Door Button".

  17. In the Scripts dropdown list on the right side, select the script that you created, "Example door buzz".
  18. Click the Save Changes button.
  19. Click the Settings button on the view pane, and then deselect Enable Edit Mode.
  20. On the 3D map, click Front Door Button.

    The front door should unlock for 30 seconds before it locks again.