# Image File Properties

The Camera device of Cognex Designer publishes the following $ functions and tags listed in the Toolbox when the Script Editor is open.

Function | Description
$Devices.ImageFileDevice.Acquire() | Signals the image file device to load a new image.

Tag | Description
--- | ---
$Devices.ImageFileDevice.CurrentImageFileName | String, indicating the full path and file name of the latest image loaded by the Image File device. If the Image File device is configured to use only one image, the value of this tag will always be the same.
$Devices.ImageFileDevice.CurrentIndex | Integer, indicating the update sequence number of the latest image loaded by the Image File device. Its value depends on how the Image File device is configured. If the Image File device uses a single image, the value of this tag is always 0. If the Image File device uses a folder of images, the sequence number of the first image to load will be 0, with each subsequent loaded image's index number increased by 1. The last image of the folder will have an index number that equals <Total number of images> - 1.Once all images in a directory have been loaded, the first image in the folder will be loaded again, and the index number will revert back to 0. If the Image File device uses a single file containing multiple images (such as a CDB or TIFF file), the value of this tag will be the index of the currently loaded image within that single file.
$Devices.ImageFileDevice.Filename | String, indicating the full path of the configured image source: If the Image File device was configured to use a single image, this tag indicates the full path of the file name. If the device was configured to load a directory of images, this tag indicates the full path of the selected directory.
$Devices.ImageFileDevice.Image | An image of the vproimage type, this tag shows the latest image loaded by the Image File device.
$Devices.ImageFileDevice.IsConnected | Boolean, indicating if the Image File device is connected and working correctly or not.
$Devices.ImageFileDevice.IsSimulation | Boolean, indicating if the Image File device is in simulation mode or not.
$Devices.ImageFileDevice.NextIndex | Integer, indicating the update sequence number of the next image in the image folder. If the Image File device is using a single image, the value of this tag will always be 0. If the Image File device is using a folder with multiple images, this tag indicates the index number of the next image in the folder. If the last image of the folder is currently loaded, then the value of this tag will be 0, indicating that the next image to be loaded will be the first image of the folder again. If the Image File device uses a single file with multiple images (such as a CDB or TIFF file), the value of this tag will be the index of the next image to be loaded within that single file. This tag can be set so that the next image to load will be from a different index.
$Devices.ImageFileDevice.TotalImagesCount | Integer, indicating the total number of images used by the Image File device. If the Image File device was configured to use a single image, the value of this tag is always 1. If the device was configured to load a folder of images, this tag indicates the number of images in the selected directory. If the Image File device uses a single file with multiple images (such as a CDB or TIFF file), the value of this tag is the total number of images within that single file.

Tip:

During the development of a Cognex Designer project, these tags are best used if you add them to the Watch list window, as that way, you can constantly monitor their values after each Task execution. Do this as follows:

1. Open the Script Editor to show the device's available functions and tags in the Toolbox. Alternatively, open the Tags Window to display its tags.
2. In the menu bar, click the Tools > Watch List option to open an instance of the Watch list window as well.
3. Browse the Image File device's tags by expanding the Devices > <Image File Device Name> node. In this example, the Image File device is called FileCamera.
4. Select all Image File device tags either by holding Shift and clicking the first and last tags, or by holding Ctrl and clicking each tag.
5. Hold the left mouse button on the selected tags, then drag and drop them to the Watch window. The selected tags should then appear in the window.

6. After this, you can use the Watch window to check the values of the tags after each Task execution, as shown below (right-click the GIF file and open it in a new browser tab/window to play the animation again).