Or is it not possible?
Your UI seems problematic to me though. What happens if the term that gets typed in doesn't have a target of the same file name?... or they type in "cat" instead of "Cat". You may want to redesign the source document so that you use a listbox that can have multiple selections and those selections are limited to the files in the directory.
In addition to what Joel already said, the script will have to be installed on the user's local machine for it to work.
True... though, now that I think this through a bit, you could solve three problems by attaching the targets to the source file rather than have them floating about in the same folder.
1) You wouldn't need a trusted function in a separate .js file to open the attachment
2) You'd know which files were available to open
3) The documents wouldn't need to be disclosed. (Not sure on that one... I have the memory of a gold fish... but it's easy enough to test)
If this gets resolved the input is actually going to be done by scanning barcodes into the "search" PDF so there would be no need to worry about the appropriate syntax being used as it would already be established and not rely on user input.
A drop down menu would not be good to use as there will be 100+ options and it would take longer to search for the correct attribute from the drop down menu. I am attempting to automate a series of handwritten forms to speed up the process of issuing devices. The search file is for capturing the device and the cat and dog files are for tracking the individual device usage.
I can easily add a script on the local machine as you mentioned but the scripting to make these forms communicate back and forth is where I am getting stumped. If you can point me to a resource or provide an example I would be very appreciative