I would like to create a button which opens a PDF file with changing index numbers. For example, the file name is TEST_01.PDF and changes to TEST_xx.PDF from time to time. Obviously a normal link won't work here.
Do you want to open the pdf file from a particular folder, or do you want a button which finds the pdf file below the current directory and opens that?
After adding the button, edit it to change the line specifying the folder you want it to look in.
The script inside the button looks like this:
Option Explicit
Function OnClick(ByRef clickData)
Dim cmd, folderEnum, folderItem, folderPath
folderPath = "C:\Folder Path\With\A PDF In It"
Set cmd = clickData.func.command
cmd.deselect = false
cmd.ClearFiles
Set folderEnum = DOpus.FSUtil.ReadDir(folderPath, False)
Do While (Not folderEnum.complete)
Set folderItem = folderEnum.Next
If (UCase(folderItem.ext) = ".PDF") Then
cmd.RunCommand folderItem.RealPath
Exit Do
End If
Loop
End Function