March 23, 200520 yr Hi, I have a pdf file in a container field (not just a file reference). Can I generate a script (maybe through a send event) to print the pdf file?
March 23, 200520 yr sure, here is a way to do it. you need two things, A-filemaker script B-visual basic script part a filemaker script Send Message [Program: VBScript File, Event Class: aevt, Event ID: odoc, Filename: "your visual basic file name.vbs", Bring application to forground] Comment "you can't run the VB script after the field is open without closing it but can delay the vb script from doing anything until it is" Go to Field [your container field][select/perform] pause [00:00:00] comment "the pause for 0 sec does pause the script while the container field is open" goto layout (org layout) Part 2 - Visual Basic script (easy) (in notepad create this and save it with a .vbs in a location that anyone using the database has access to) Set WshShell = WScript.CreateObject("WScript.Shell") WScript.Sleep 1000 'pauses this script to allow container field to open WshShell.AppActivate "Name of program as seen on task list" WshShell.SendKeys "^p" ' the ^ is the ctrl key + p ajust this to whatever command prints the document WScript.Sleep 1000 'adjust this value to allow time for the program to spool the print document WshShell.AppActivate "Filemaker Pro" ' returns you to filemaker which should close container field and continue the fm script Well that should do it, you may need to play with the values in the WScript.Sleep script step. Timing is everything when you do something like this.
May 17, 201510 yr Newbies Thank you for your quick response. I started setting this up but do not know where to put this part of the script, Send Message [Program: VBScript File, Event Class: aevt, Event ID: odoc, Filename: "your visual basic file name.vbs", Bring application to forground] This is what it looks like so far...
Create an account or sign in to comment