FileName

<< Click to Display Table of Contents >>

Navigation:  Appendix > Macros >

FileName


 

editor.icon FileName

 


 

The FileName macro inserts the name of the source file.

 

The syntax for this macro is %[FileName:range]

 

The 'range' parameter is optional and can be used to specify a section of the filename as desired. Available options for this parameter are detailed below:

 

Character numbers separated by a comma. For example: %[FileName:1,3,5,7] outputs the first, third, fifth and seventh characters of the filename.

Character ranges (i.e. indexes in the range separated with a dash). For example: %[FileName:2-6] outputs the second to the sixth characters of the filename.

A dash followed by a character number. This outputs the characters of the filename up to the specified character. For example: %[FileName:-5] outputs the first five characters of the filename.

A character number followed by a dash. This outputs all characters of the filename from the specified character. For example: %[FileName:5-] outputs all characters from the fifth character of the filename.

 

Example

 

Follow the steps below to use the FileName macro to insert the name of the source file as the stamp title when creating a new stamp:

 

1. Click the Stamp dropdown menu in the Home tab, then click then click Stamps Palette. The Stamps Palette will open.

 

2. Click Add New, then click Add New Stamp from File:

 

add.new.stamp.macro.ribbon

Figure 1. Stamps Palette, Add New Stamp From File

 

The Open Files dialog box will open.

 

3. Select a file to use as the stamp and then click Open. The Add New Stamp dialog box will open.

 

4. Enter %[FileName] in the Stamp Title dialog box and select a target collection:

 

add.new.stamp.dialog

Figure 2. Add New Stamp Dialog Box

 

5. Click OK.

 

A new stamp will then be created and the name of the source file will be used as the title:

 

final.stamp.macro

Figure 3. New Stamp