Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 3477 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

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?

Posted

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.

  • 10 years later...
  • Newbies
Posted

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...

 

 

Screen Shot 2015-05-17 at 1.36.27 PM.png

Posted

 

​I deleted your duplicate post. 

Please do not double post your questions.

This topic is 3477 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.