Jump to content
Salesforce and other SMB Solutions are coming soon. ×

Automated script to generate a PDF / PDF's


Recommended Posts


I’m trying to write a script that will automatically run a few reports at a given time and then save them as separate PDF’s under specific names.



At 12am each day I’d like the following reports to be generated…


Sales = Joes_Sales_5.4.12.PFD (current date)

Inventory = XYZ_Inventory_5.4.12.PDF (current date)


Any ideas?


Thank you!


Link to comment
Share on other sites

In FileMaker 5.5?


** checks forum. YES, you not only have FM Version in your profile as 5.5, you also posted specifically in the FileMaker 5/6 Forum **


Controlling such things under FileMaker Pro 5.5 = not a lot of fun.


First off, there's no built in Save Records as PDF. You would have to install a printer that can print to PDF, which the computer sees as a printer like any other.


Second of all, Filemaker of that era (anything before FileMaker 7) is awfully glitchy about retaining any sense of "print to THIS printer in THIS script; print to THAT printer instead in these other scripts".



There is no way to have FileMaker SERVER automatically generate PDFs; it's an unsupported script step for Server-side execution even under FileMaker Server 12. Forget doing it automatically on Server 5. So for "automatic" you are looking at a workstation running plain-vanilla FileMaker 5.x running a script that runs in a perpetual loop with timed pauses. Since this ties up that workstation, you may as well install Adobe's printer driver and make it the DEFAULT printer on that computer. That handles how the heck to print to PDF. All printouts will be to PDF.


Print [no dialog] will save PDF files under such a setup to the Desktop, I believe, with a filename that, at least back in the era when I worked in FileMaker 5/6 regularly, was the FileMaker databse filename dot PDF: YourFile.pdf


So then to set the files to the name you want them to have, you need to get the operating system to do it for you. You're a Windows user it says: you would use Send Message (now called Send Event but back then, Send Message) specifying the message is to "cmd" and then issuing DOS commands to rename the file. Since you are constructing the MSDOS command you're sending (it can be the contents of a global field instead of a hardwired command text), which you populate first with the relevant string that constitutes a command line instruction that changes YourFile.pdf to Joes_Sales_5.4.12.PDF.


Send Message: You set up the script step options to use the open document/application message, leave the file type "", and you specify a field value as your choice of commands to send.


DOS Command: I'm a Mac-centric person but something akin to "cmd /k mv " & C:\Path\To\Your\Desktop.YourFile.pdf " E:\PDFDocuments\From_FileMaker\Or_Whatever" & ClientName & "_Sales_" & Month (Status(CurrentDate)) & "." & Day (Status (CurrentDate)) & "." & Year (Status (CurrentDate)) & ".PDF"


(you'll have to experiment to get the DOS right)



Looping script: first make the PDF driver the default printer, then print once manually with the page set up correct (legal or letter, portrait or landscape, etc) and print current rec or recs being browsed (whichever is appropriate). THEN create this script



..Enter Find Mode []

..Set Field [DoneAlready, "="]

..Set Field [AnyOtherRelevantField, "Value that means you want it included in the report"]

..Set Error Capture [On]

..Perform Find []

..If [(Status (CurrentFoundCount) > 0]

....Page Setup [restore, no dialog]

.... Print [no dialog]

..Pause [for however long you want to pause, measured in seconds]

End Loop

Link to comment
Share on other sites

This thread is quite old. Please start a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...

Important Information

Terms of Use