# OnStartup Script

The OnStartup script will be used to initialize tag values and Properties of Page elements, which ensures that any values modified while testing will be reset to their original settings at startup.

1. Double-click the OnStartup script under the Scripting > Application node in the Project Explorer.

2. Enter the following script:

       $myRect = null;
       $Pages.Page.Checkbox.State = false;
       $Tasks.BufferImage.Run();
       $Tasks.CopyRegion.Run();

3. In the Properties, add using statements to the Code property.

4. Press the drop-down button, and in the blank text field, enter "Cognex.VisionPro" and "Cognex.VisionPro.Display".

5. Press the browse button of the References property, using the Script References dialog, from the Discovered References pane, add Cognex.VisionPro.dll, Cognex.VisionPro.Core.dll and Cognex.VisionPro.Display.Controls.dll to the Local References, and press the Accept button.

6. Press the Compile button to ensure the script correctly compiles.