Automatically Mail PDF Script

  • Follow


If someone has any suggestions to this question I would greatly
appreciate it.

First off I am running Mac OS X 10.3.5, FileMaker PRO 7 and Mail 1.3.9
(v619).

Since this question pertains to both AppleScript and FileMaker I have
posted the message to both groups.

I modified the MailAsPDF script (see below) and linked it to the pdf
services folder.

I have a FMP7 database with a button that runs the following FMP
Script

Copy (Field Contents) copies the date from a date field
Print Setup (Sets the page setup to portrait)
Print (Opens the print dialoug box)
Adjust Window (Minimize) minimizes the filemaker pro window.

Everyting works great.  All I have to do is select the PDF button then
the correct PDF Script from the Print window and the script does the
rest.  Converts the current filemaker record to pdf, closes the
filemaker window, opens mail, attaches the pdf and inserts the text
into the new email.

So here is the question:  Can I automate the task even more by telling
the Print window to activate the AttachAsPDF script automatically.  I
know it is only saving two button clicks, but in the end I will modify
more MailPDF scripts and add to the PDF Services folder.  And this may
get confusing for users of the database as to what PDF service to
select.

I have attempted to create a Perform Applscript Script in FMP that
does the "button click".  I also did the same using applescript
utilizing UIElementInspector.  I tried to run the AttachAsPDF script
from withing FMP, but when ran it creates a window with a bunch of
text and numbers (had to forcequit FMP).

Just a note I am not an expert in either FileMaker or AppleScript.  I
know just enough to modify existing scripts and by trial and error
create what I need and want.

Any help will be appreciated.

Thanks in advance.

MAIL PDF SCRIPT
on open these_items
try
set this_file to item 1 of these_items
tell application "Finder"
set the file_name to the name of this_file
set the parent_folder to (the container of this_file) as alias
end tell
tell application (path to frontmost application as string)
repeat
clipboard info
set clipboard_text to the clipboard
display dialog "Enter a name for file:" default answer "Text" & " " &
clipboard_text & ".pdf"
set this_name to the text returned of the result
if this_name is not "" then exit repeat
end repeat
end tell
tell application "Finder"
set the name of this_file to this_name
set the target_file to (document file this_name of the parent_folder)
as alias
end tell
tell application "Mail"
set clipboard_text to the clipboard
set the new_message to �
     (make new outgoing message with properties �
     {visible:true, content:" ", subject:"EOD" & " " &
clipboard_text})
tell the new_message
--Where the email is going. You can add as many email addresses to the
email.
make new to recipient at end of to recipients with properties
{name:"Name", address:"name@domain.com"}
tell content
make new attachment with properties �
     {file name:target_file} at �
     before the first character
end tell
end tell
end tell
on error error_message number error_number
if the error_number is not -128 then
tell application (path to frontmost application as string)
display dialog error_message buttons {"OK"} default button 1
end tell
else
tell application "Finder" to delete parent_folder
end if
end try
end open
0
Reply duceswild 10/28/2004 5:34:57 PM

Just to let all of you know I have been given the soulution to the problem.  thanks

duceswild@austin.rr.com (Allen) wrote in message news:<8126abf1.0410280934.64fbee01@posting.google.com>...
> If someone has any suggestions to this question I would greatly
> appreciate it.
> 
> First off I am running Mac OS X 10.3.5, FileMaker PRO 7 and Mail 1.3.9
> (v619).
> 
> Since this question pertains to both AppleScript and FileMaker I have
> posted the message to both groups.
> 
> I modified the MailAsPDF script (see below) and linked it to the pdf
> services folder.
> 
> I have a FMP7 database with a button that runs the following FMP
> Script
> 
> Copy (Field Contents) copies the date from a date field
> Print Setup (Sets the page setup to portrait)
> Print (Opens the print dialoug box)
> Adjust Window (Minimize) minimizes the filemaker pro window.
> 
> Everyting works great.  All I have to do is select the PDF button then
> the correct PDF Script from the Print window and the script does the
> rest.  Converts the current filemaker record to pdf, closes the
> filemaker window, opens mail, attaches the pdf and inserts the text
> into the new email.
> 
> So here is the question:  Can I automate the task even more by telling
> the Print window to activate the AttachAsPDF script automatically.  I
> know it is only saving two button clicks, but in the end I will modify
> more MailPDF scripts and add to the PDF Services folder.  And this may
> get confusing for users of the database as to what PDF service to
> select.
> 
> I have attempted to create a Perform Applscript Script in FMP that
> does the "button click".  I also did the same using applescript
> utilizing UIElementInspector.  I tried to run the AttachAsPDF script
> from withing FMP, but when ran it creates a window with a bunch of
> text and numbers (had to forcequit FMP).
> 
> Just a note I am not an expert in either FileMaker or AppleScript.  I
> know just enough to modify existing scripts and by trial and error
> create what I need and want.
> 
> Any help will be appreciated.
> 
> Thanks in advance.
> 
> MAIL PDF SCRIPT
> on open these_items
> try
> set this_file to item 1 of these_items
> tell application "Finder"
> set the file_name to the name of this_file
> set the parent_folder to (the container of this_file) as alias
> end tell
> tell application (path to frontmost application as string)
> repeat
> clipboard info
> set clipboard_text to the clipboard
> display dialog "Enter a name for file:" default answer "Text" & " " &
> clipboard_text & ".pdf"
> set this_name to the text returned of the result
> if this_name is not "" then exit repeat
> end repeat
> end tell
> tell application "Finder"
> set the name of this_file to this_name
> set the target_file to (document file this_name of the parent_folder)
> as alias
> end tell
> tell application "Mail"
> set clipboard_text to the clipboard
> set the new_message to �
>      (make new outgoing message with properties �
>      {visible:true, content:" ", subject:"EOD" & " " &
> clipboard_text})
> tell the new_message
> --Where the email is going. You can add as many email addresses to the
> email.
> make new to recipient at end of to recipients with properties
> {name:"Name", address:"name@domain.com"}
> tell content
> make new attachment with properties �
>      {file name:target_file} at �
>      before the first character
> end tell
> end tell
> end tell
> on error error_message number error_number
> if the error_number is not -128 then
> tell application (path to frontmost application as string)
> display dialog error_message buttons {"OK"} default button 1
> end tell
> else
> tell application "Finder" to delete parent_folder
> end if
> end try
> end open
0
Reply duceswild 10/31/2004 7:54:47 AM


1 Replies
424 Views

(page loaded in 0.077 seconds)

Similiar Articles:













7/20/2012 7:21:22 PM


Reply: