• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Print current record from FileMaker?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Print current record from FileMaker?


  • Subject: Re: Print current record from FileMaker?
  • From: Mark Walsh <email@hidden>
  • Date: Mon, 28 Mar 2005 20:28:21 -0500

On 3/27/05 8:10 AM, "Erkki Pennanen" <email@hidden>
wrote:

> 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
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL:
> http://lists.apple.com/mailman/private/applescript-users/attachments/20050327/

This is a script that was posted to the Filemaker list about a year ago. It
uses the "PDF Services" function of OSX.

Someone else had posted a script which was to be saved into the "PDF
Services" folder in OSX,  I made some additions to the script originally
sent, which will save the script to the "PDF Services" directory  (create it
if it doesn't already exist) with all of the properties in the script. The
following script is to email the PDF  Microsoft Entourage. You can modify it
to do whatever you want with the PDF generated. Create a sript in Filemaker
which performs the following Applescript (change the cell names as per your
needs)

 As always, beware of line breaks from the email.

 ----------- Perform Applescript


 -- This will be the script saved to the user's directory
 script ScriptFile
     property TargetFolder : path to desktop folder
     property FileName : ""
     property EmailAddressTo : ""
     property EmailAddressCC : ""
     property EmailAddressBCC : ""
     property EmailSubject : ""
     property EmailText : ""
     property EmailAttachment : ""
     
     on open TheItems
         repeat with TheItem in TheItems
             set TheName to FileName & ".pdf"
             tell application "Finder"
                 set name of TheItem to TheName
                 --duplicate TheItem to folder TargetFolder with replacing
             end tell
             set EmailAttachment to TheItem
             -- script steps to email theFile go here
             my MakeEmail()
         end repeat
         my clearProperties()
     end open
     
     on MakeEmail()
         tell application "Microsoft Entourage"
             set theMessage to make new outgoing message with properties
 {subject:EmailSubject, to recipients:EmailAddressTo, CC
 recipients:EmailAddressCC, BCC recipients:EmailAddressBCC,
 content:EmailText, attachment:EmailAttachment}
             try
                 open theMessage
             end try
             activate
         end tell
     end MakeEmail
     
     on clearProperties()
         set TargetFolder to path to desktop folder
         set FileName to ""
         set EmailAddressTo to ""
         set EmailAddressCC to ""
         set EmailAddressBCC to ""
         set EmailSubject to ""
         set EmailText to ""
         set EmailAttachment to ""
     end clearProperties
 end script

 -- This part of the script creates the "PDF Services" folder and sets the
 name for the script
 tell application "Finder"
     try
         make new folder at (path to library folder) with properties
 {name:"PDF Services"}
     end try
 end tell

 set TheFile to (path to library folder) & "PDF Services:EmailPDF.scpt" as
 string

 -- Set variables from Filemaker

     try
         set FileName to "Invoice_" & cell
 "PurchaseOrders_PurchaseOrderKey::jobnumber" of current record
         set FileName of ScriptFile to FileName
     on error
         set FileName of ScriptFile to "Invoice"
     end try
     
 try
 set EmailSubject to "Invoice - "& cell
 "PurchaseOrders_PurchaseOrderKey::jobnumber" of current record & " " & cell
 "PurchaseOrders_PurchaseOrderKey::DateOrdered" of current record
 set EmailSubject of ScriptFile to EmailSubject
 on error
 set EmailSubject of ScriptFile to "Invoice"
 end

 try
 set EmailText of ScriptFile to ""
 on error
 set EmailText of ScriptFile to ""
 end

 try
 set EmailAddressTo to cell
 "PurchaseOrders_PurchaseOrderKey::CompanyPersonEmail" of current record
 set EmailAddressTo of ScriptFile to EmailAddressTo
 on error
 set EmailAddressTo of ScriptFile to ""
 end try

 try
 set EmailAddressCC  to cell
 "PurchaseOrders_PurchaseOrderKey::Coordinatoremail" of current record
 set EmailAddressCC of ScriptFile to EmailAddressCC
 on error
 set EmailAddressCC of ScriptFile to ""
 end try

 try
 set EmailAddressBCC  to "" -- cell "People_Coordinator::email" of current
 record
 set EmailAddressBCC of ScriptFile to EmailAddressBCC
 on error
 set EmailAddressBCC of ScriptFile to ""
 end try


 -- This part of the script saves the script inito the "PDF Services"
folder.

 store script ScriptFile in file TheFile replacing yes


 ----------- End Perform Applescript

 _______________________________________________
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

References: 
 >Print current record from FileMaker? (From: Erkki Pennanen <email@hidden>)

  • Prev by Date: Re: Safari and getting Netscape bookmarks into it
  • Next by Date: Re: Print current record from FileMaker?
  • Previous by thread: Re: Print current record from FileMaker?
  • Next by thread: Re: Print current record from FileMaker?
  • Index(es):
    • Date
    • Thread