Thank you for your post.
FileMaker Pro needs to write the file somewhere. One possible solution is to create a script with the script step:
Save Records as PDF [ No dialog ; "Test.pdf" ; Records being browsed ]
Then, execute this script whenever you want to save the information as PDF. That way, you know the PDF file will be written to the same location each time.
Is is possible to use the save as PDF to generate a file that doesn't have but a temp location?
You can use a variable as your export path. Before you save the pdf, add a SetVariable step in your script and set the variable $Path to something like:
Get ( TemporaryPath ) & "NameYourPDF" & ".pdf"
Then, use $Path as the export location in the Save Records As PDF script step. You can use a variable like this (instead of a hard coded path) in lots of script steps like Send Mail, Export Field Contents, and Export Records.
The temporary directory is deleted when FileMaker Pro is quit, so it only persists for the session.
If you want the user to "see" the file, of course, you can use Get ( DesktopPath ) instead of TemporaryPath in your variable.
John, this seems to be what I was looking for. Thanks very much! I will try this out.
This works fabulously on my mac.
I thought it would be a piece of cake and went blathering all over my company telling everyone it "worked".
When I tried it on any windows computer I could get my hands on, it simply does nothing.
My first test debug consisted of this:
$location = Get ( TemporaryPath) & filename & ".pdf";
Then putting: "file: $location" in the save as dialog. This works on a mac, but not on windows. So I then tried this:
original = final_product::fp_name;
filtered = Filter ( original ; "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" );
sub = Substitute ( filtered ; " " ; "_" )
If(Get ( SystemPlatform ) = -1 or Get ( SystemPlatform ) = 1;
"filemac:" & Get ( TemporaryPath ) & "CofA_" & sub & "_" & final_product::fp_lot_no & ".pdf";
"filewin:" & Get ( TemporaryPath ) & "CofA_" & sub & "_" & final_product::fp_lot_no & ".pdf"
Again, this works on a mac but not on windows. The part that drives me mad is that NOTHING happens. I usually get that annoying dialog that says the file could not be created on the specified. But it just shows the hourglass dialog from windows 3.11 and then disappears.
To complicate the matter, I discovered that the Get(TemporaryPath) function is not available in FM server 8, which is what everyone else is using. I have 9.0v3 adv myself.
So now I am in a rut. Any ideas, before I incinerate my FM server?
By the way, I tested the windows part on a Windows 9.0 version to confirm it wasn't just the missing functions in 8, but it still didn't work.
Thank you for your posts.
The calculation you have definitely works in FileMaker Pro on the local machine. Try this out:
1. Create a new table with one field: Name (Text)
2. Create a script that executes:
Set Field [ Name ; Get (TemporaryPath)
3. Execute the script, and the current record will show the temporary path name.
4. Create a second script with:
Set Variable [ $path ; "filewin:" & Get (TemporaryPath) & "abcdefg.pdf" ]
Save Records as PDF [ $path ; Records being brwosed ]
(NOTE: leave "Perform without dialog" unchecked"
5. Now, run the second script, and you will see the file written to the temporary path.
Next, you mention FileMaker Server 8, so the files are not local to your machine. Still, the same scripts above will write the file to your local machine since you are using FileMaker Pro 9.0v3. If other users have FileMaker Pro 8, they should be able to specify a path on their computer when specifying a file.
Thanks. But I failed to mention that this is running on a Windows Terminal Server when it isn't working.
The whole point is that I don't want any kind of dialog to appear. I am trying to seamlessly make a button that when clicked creates a temp pdf file, attaches it to a new email that the person only has to type the message in and click send. Then the file is erased from the universe altogether.
Since the terminal server has version 8.0 running, the GetTempPath function isn't available. I guess I will have to create a directory for temp junk and delete it every so often [what I was trying to avoid.]
Unfortunately, I don't have access to Terminal Server here.
My assumption was that you couldn't get this working on a local machine. Showing the dialog was only for testing purposes.
If you try specifying the path instead of Get (TemporaryPath), what occurs? That is, instead of using a calculation, what if you specify:
Actually, it doesn't work on a local machine or on the terminal server, when using windows. It only works on the mac.
I can't use Get(Temporarypath) because that function is not available on version 8. See, I have version 9.0 Advanced but the company only has Server version 8. So I have to only use the functions available to them.