Here are copies of the macro we use. It takes the filename of the idr and places it in the bottom right corner. The second macro does that same thing only it adds a white box under the text.
Macro Add_FileName
Define h As Integer
Define w As Integer
w = activeDoc.window.pageX-2
h = 2
#Message "The height is " + h
#Message "The width is " + w
#Added below command to ensure number is placed on the Illustration number layer
ACTIVATE LAYER "Illustration Number"
Select none
Text Align Left
Text font 'Calibri'
Text size 6
Create Text w h stripext(activeDoc.name)
Rotate selection w h 90
End Macro
Macro Add_FileName_White_BG
Define h AS Integer
Define w AS Integer
Define el AS Element
w = activeDoc.window.pageX-2
h = 2
#Message "The height is " + h
#Message "The width is " + w
#Added below command to ensure number is placed on the Illustration number layer
ACTIVATE LAYER "Illustration Number"
Select none
Text Align Left
Text font 'Calibri'
Text size 6
Create Text w h stripext(activeDoc.name)
el = activeDoc.firstSelectedElement
el.text.backfill_color.type = "rgbValues"
el.text.backfill_color.rgb.red = 255
el.text.backfill_color.rgb.green = 255
el.text.backfill_color.rgb.blue = 255
el = el.nextSelectedElement
Rotate selection w h 90
Select none
End Macro