Re: Print current record from FileMaker?
Re: Print current record from FileMaker?
- Subject: Re: Print current record from FileMaker?
- From: "Gary (Lists)" <email@hidden>
- Date: Sun, 27 Mar 2005 15:30:16 -0500
Erkki Pennanen wrote [3/27/05 8:10 AM]:
> Hi,
>
> 1) Does some of you know how to print the current record or
> 2) even know how to create PDF file from current
> record which could be mailed as an attachment
> file?
>
> HereĀ“s my script:
>
> tell application "FileMaker Pro"
> open "OS X:Users:Me:Desktop:test.fp7"
> set the current record to record 2 of database "test.fp7"
> print current record of current layout of
> database "OS X:Users:Me:Desktop:test.fp7"
> end tell
>
> I am getting this error message:
> "Unable to coerce the data to the desired type."
>
> Hoping to get solution to this!
> Erkki
Erkki,
Rather than go through your script, I think it easier to point you to the
'Do Script' command of FileMaker's AppleScript dictionary.
Ex: do script FileMaker script _string_name_
The real advantage when doing print jobs is that FileMaker scripts can
"remember" all the print settings that were in effect when the script was
made (Page Set-up, Layout, etc.) and record them into the script.
Your FM script can automatically pause at Preview mode, wait for the user to
continue or cancel, do the printing and return the user to Browse mode.
Much easier. And all with a few clicks to make the script in FM.
So...
1. Set-up your desired print job in FM. Do a Sort, do whatever you need to
do to generate the desired found set (even if it is a single record.) Go to
the printing layout that you want and switch to Preview mode.
2. Do any Page Set-up adjusting now. Change to landscape, do whatever you
need to do to get it to print the way you want.
3. Go to ScriptMaker and make a new script. Add your desired script steps,
such as 'Sort...'.
When you add any Sort or similar script steps, you can choose to 'Keep' or
'Replace' any current settings for the Sort. If you make your script right
after you do your whole print job, then you will be able to just check 'Keep
current settings' when you save your script and all that will be repeated
each time the script is executed. (See the FM Help, which is very good,
about creating Scripts and all the Script Steps available...that is
off-topic here.)
3. Save and Name your script. (I will use 'Print My Record' here.)
Okay, now in your AppleScript, all you need to do is say:
tell app "FileMaker Pro" to do script FileMaker script "Print My Record"
You may need an "...of database 1" or similar if you have more than one file
open, or you want to target a file that is not frontmost.
HTH
--
Gary
Oh. As for making a PDF. Well, that depends on your PDF-making software. I
use PDFWriter, which is just a printer driver, so I do a normal Print (when
that printer is selected) and I get a PDF file. Some use Acrobat, some use
PHP or other *nix-style goodies in OSX.
YMMV, obviously.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden