Set Variable [ $path ; Value: Get ( DesktopPath ) & table::fileName & ".pdf" ]
This, of course, assumes the file is located on your desktop. But use the $path variable (or whatever you want to call it) in the Insert script step.
Hi Mike sorry for not understanding, I'm not a developer. the pdf's are stored in F:records, under file names like REC1011.pdf, the field: record number entry is REC1011. the table is: records, Taking this into consideration then:
1 Insert PDF [Reference; "$Variable"]
2 Set Variable 
Value: Get ( F:records ) & records::record number & ".pdf"
is there something I'm missing
Um … yeah, couple of things.
1) The Set Variable script step has to come before the Insert step.
2) Your $path variable should look something like this:
“F:\records\” & records::record number & “.pdf"
Yeah, thanks, Andy. I rarely use explicit file paths. The Get functions are more flexible and cross-platform.
But I’ve had trouble getting the whole “fillwin:/“ thing to work. Does it work reliably for you?
We use this all the time as our solutions run on Windows servers on cloud based VMs, so we have to create an easy way for users to import/export outside of the server running FMP.
As we run both Citrix and RemoteApp we have to account for the different network paths each uses, such as including tsclient or $tsclient in our path names. Drive letters are much easier!
We set a global variable upon startup that is a default location all saving and importing refers to, which has been set by the user. We offer around a dozen different locations to each user that are checked by the startup script (small VB script exports base 64 file and returns success or failure) that allows each user to access the system from different computers (with different home folder names).
As we use Dacons MailIt on all our SaleFaith solutions we have the use of alternative open/save dialogue windows, which is useful (particularly before the introduction of get directory).
All in all, building the filewin:/ path has worked very well.
Hm. Well, I believe you. Maybe I was trying to use the “fillwin:/“ in combination with the Get functions. I’ll play with it when I get back to a PC machine.
1 Set Variable [Path; Value: "Filewin:/F:/records/" & Records::Record Number & ".pdf"]
2 Insert PDF [Reference; "$Variable"]
I have set the script triggers on object enter to the Record Number field.
When I run here is the messages I get:
The File "$variable" could not be found and is required to complete this operation.
The previous script step, "Insert PDF, could not be completed because od an erroe. Do you wish to continue script?
I recommend you do a test using the Get Directory script step. Set up a temporary script, enter a test variable in the 'Variable' option, don't worry about the other 2 entries. Add another script step after this, so you can check the result of the test variable.
Debug the script and use the dialogue box to navigate to your F:/records/ folder. Click OK and the variable will provide you with the correct prefix. As you have an 'F' drive, it may be using something like //client if it is a network share, or one of the other options offered by FileMaker.
Once you've got this, enter this into your variable path with the Records:Record Number & ".pdf" and it should work.
Your variable name in Set Variable needs to match the variable name in Insert PDF.
1 Get Directory [$test]
2 Go to Field 
When I run the debug I pick my way through to the records file, but it doesn't build a path.
I also did as Mike requested and changed the variable names to match.
When the script runs in the debugger, the Get Directory provides an 'open file' type dialogue box, where you can navigate through your disks and folders. If you navigate to the f:/records/ folder and click 'OK', the Data Viewer should display $test with the directory path, including all the prefix info you need.
This $test should enable you to then build the correct path for your main script.
I have just checked it on a Windows PC here and it has worked as described.
All the best