osx - AppleScript mail formatting -
because filemaker pro doesn't support rtf/html formatting of emails creates have created applescript format email. works! seems format first instance of each variable encounters in script. pointers gladly accepted.
tell application "filemaker pro" set field_a cell "email::emailtext_1" of layout "email" set field_b cell "email::emailtext_2" of layout "email" set field_c cell "email::emailtext_3" of layout "email" set field_d cell "email::emailtext_4" of layout "email" set field_e cell "email::emailtext_5" of layout "email" set field_f cell "email::emailtext_6" of layout "email" set field_g cell "email::emailtext_7" of layout "email" set theattachment cell "email::attachmentpath_cleaned" end tell set the_content (field_a & field_b & field_c & " ?? " & field_d & field_e & field_f & field_b & field_g & " ?? " & field_c) tell application "mail" activate set thesignature "signature 1" set msg make new outgoing message properties {visible:true, subject:field_a & " text here " & startdate & " " & enddate, content:the_content} set message signature of msg signature thesignature tell msg make new recipient @ end of recipients properties {address:"blurred_out@blurry_text.com"} make new cc recipient @ end of cc recipients properties {address:"blurred_out@blurry_text.com"} make new attachment properties {file name:theattachment alias} set x offset of field_b in the_content set font of characters (x - 1) thru (x + (count of field_b)) of content "helvetica bold" set x offset of field_d in the_content set font of characters (x - 1) thru (x + (count of field_d)) of content "helvetica bold" set x offset of field_f in the_content set font of characters (x - 1) thru (x + (count of field_f)) of content "helvetica bold" set x offset of field_g in the_content set font of characters (x - 1) thru (x + (count of field_g)) of content "helvetica bold" set x offset of "??" in the_content set font of characters (x - 1) thru (x + (count of "??")) of content "helvetica bold" end tell end tell
i think easiest way solve defining 2 new variables second instances of field_b
, field_c
:
set field_b1 cell "email::emailtext_2" of layout "email" set field_c1 cell "email::emailtext_3" of layout "email" set the_content (field_a & field_b & field_c & " ?? " & field_d & field_e & field_f & field_b1 & field_g & " ?? " & field_c1) set x offset of field_b1 in the_content set font of characters (x - 1) thru (x + (count of field_b1)) of content "helvetica bold" set x offset of field_c1 in the_content set font of characters (x - 1) thru (x + (count of field_c1)) of content "helvetica bold"
Comments
Post a Comment