You might want to consider installing a plug in for handling files. Many of these plug ins can list the contents of a directory for you and you thus can extract the actual file name of each file in the directory for using with the web viewer.
What plug in should I look into using? Also, I need the webviewer to change which pdf it is looking at based on the record I have open. It sounds like these plug ins would force me to look at a list of files and pick from the file I need from this list. Is there one that can manipulate file names or something?
There are several plug ins that can do this. I suggest doing a web search for file plugin Filemaker and see what pops up. There's quite a difference in cost and features so you'll need to pick the one that works for you. (one mooPlug, was free last time I checked.) Some of these plug ins can also manipulate file names and, I think, move files around.
I wasn't suggesting that you set this up so that the user has to select a file from a list. Instead, I'm suggesting that you write a script that uses the plug in to get the list of files from a specified folder and then uses that list to make the selection automatically. If there is only one file in the folder this is easy. If there are multiple files, you'd have to figure out a way for the script to identify the correct file at which to point the web viewer.
Also, AppleScript can do all this "file/folder stuff," if you're on a Mac. The MooPlug is good for this on Windows. Of, if you require cross-platform capability, and only want to code once, 360Works' ScriptMaster can do the same. These are all free; they can all list files of a folder, and move or delete files.
Basically, what Phil was suggesting (and I'm kind of repeating) was that since you no longer know the file name directly any more, you could put the relevant files in a known folder, and get the list of file names, then set them into a field or script Variable in FileMaker. Then there are more possibilities.
Such as looping thru the file names until you found the one you wanted. You could use FileMaker Text functions to remove whatever you wanted to from the name, or test for whatever would identify that file (with PatternCount). You would then use the original path of that file to show it in the Web Viewer.
P.S. It would also be possible, if the external tool you use supports "grep" (pattern matching), to just Find the file, as you could use "wildcard" characters to match their additional characters. But that's a bit geekier.
Let me know if this is basically what I should do
Use the get(filename) function te create a list in FMP with the name of each pdf in the folder I'm looking in
then make a calculation for the webviewer file path that basically says, (if (x_field from database 1=left(13,filename list value) then webviewer address is "desktop/mtr/"&filename list value&".pdf"
I realize the way I wrote the script is wrong but would that be the basic idea?
More or less. These are the commands for the various tools. You'd need to pick one; on Windows MooPlug is simplest. I could tell you the AppleScript ones (which would need to set a FileMaker field; the plug-ins automatically set a FileMaker field).
MooPlug: Moo_FolderList(Windows OS folder syntax)
AppleScript: listfolder(Mac OS folder syntax), you'd want to set a FileMaker field to results
Unix, via AppleScript: do shell script "ls " & unix_folder
ScriptMaster: listfiles (but it's Java, with lots more stuff, so copy their example)
Yes, Left (filename; 13). You'd want to use the Set Web Viewer script step (at the bottom, in the Miscellaneous section) to actually set the Web Viewer, since you're doing this via a script.
Let's say you've set a FileMaker script Variable named $file_list to the files list (variable is easiest to type here, but a global field is fine also). You'd Loop thru the files you gathered, and test. The Loop is not moving thru records; it is very fast.
Set Variable [$count; ValueCount ($file_list)]
Set Variable [$counter; $counter + 1]
Exit Loop if [$counter > $count]
Set Variable [$file_name; GetValue ($file_list; $counter]
Set Variable [$file13; Left ($file_name; 13)]
If [x_field = $file13]
Set Web Viewer [ URL syntax path to file, you'd have to calculate ]
Set Variable [$success; 1]
Exit Loop If 
// it found the file
// it didn't
Thanks for all the help. I seemd to have gotten everything to work using some scripts from MooPlug and the original filename listing idea.