Close File Action

image\Actions_Storage_Close_File.jpg

The Close File action will close a file you have opened using one of the Read actions in the Storage menu.

Note:
When a file is opened using one of the Read actions in the Storage menu it remains open so that you can use other Read actions, such as the Read next line from file action, to get information and store it in a variable. However, a file that is open is using some of the computer’s memory to remain open. Once you have finished reading a disk file you should close the file using the Close File action to free the memory for other activities.

Setting up the Close File Action:

  1. Add the Close File action to your trigger, as described in adding actions. The Close File tab will automatically appear when you add the action.

  2. Click on the down arrow to the right of the Filename option, to select the name of the disk file you want to close. Alternatively, use the Browse… button to locate the file on a disk. The full pathname of the file you enter in this box is shown in the Filename field.

Note:
You can enter variables into the Filename field – the variable should contain a valid pathname for the file (see Using variables to create pathnames for more information).

The file can be on a hard disk, a networked drive or floppy disk. If the network or floppy disk is not available when the publication is run, no warning message will appear and the data is not read.

  1. Tick the Get from Windows TEMP directory option if you originally saved the text during the Write action to the windows Temp directory. By default this checkbox is not ticked.

Note:
If you use this option, the Filename field should only contain the name of the text file and not a pathname e.g. results.txt is correct while c:\studentFolder\results.txt would be incorrect.

  1. Click on the Apply button to save your changes.

Note:
This action will only work for publications that you have published using the Create a Standalone Publication option in the Publish Wizard.

Related Topics:

Introducing the Storage Actions

Restrictions Reading and Writing Disk Files

Using Variables to Create Pathnames

Disk Files vs Windows Registry