Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Filemaker stripping text formatting

Featured Replies

  • Newbies

Hi, I have a script which attempts to grab the content of an email message from Apple Mail and insert it into a text field.

The problem is that Filemaker strips out all the carriage returns and paragraph breaks etc from the email contents, resulting in one big unreadable lump of text.

Copying/pasting from Apple Mail into the field does preserve the formatting.

Does anyone know of a technique to preserve this information?

I do not know Apple Mail. But when the paste wonks out for me on Windows (in a text field), I sometimes have better luck pasting into a container.

  • Author
  • Newbies

Thanks for the response, unfortunately no change.

I have worked around the issue by writing the content of the email to a file, stripping carriage returns, converting tabs to spaces and then importing the resulting file into Filemaker.

But if anyone has an easier method, I'd still be interested.

The problem is that what you get from mail.app carries a ASCII 10 as carriage return (rather linefeed) but filemaker only recognizes ASCII 13 as such.

You can do it this way:

tell application "Mail"

	set mycontent to content of message 100 of mailbox 4 as styled text

end tell

set AppleScript's text item delimiters to (ASCII character 10)

set myVar to text items of mycontent

set AppleScript's text item delimiters to (ASCII character 13)

tell application "FileMaker Pro Advanced"

	set cell 1 to myVar as string

end tell

...in a similar way do you have to question for the tabs by asking:

nn contains (ASCII character mm)

...to get esatblished what the tab is and substitute it with 29 as FM recognizes.

--sd

I'd just add that tab is (ASCII character 9), but you can also just write tab.

tell application "Mail"

set mycontent to content of message 1 of mailbox 1 as styled text

end tell

set AppleScript's text item delimiters to (ASCII character 10)

set myVar to text items of mycontent

set AppleScript's text item delimiters to (ASCII character 13)

set AppleScript's text item delimiters to tab

set newVar to text items of myVar

set AppleScript's text item delimiters to (ASCII character 29)

tell application "FileMaker Pro Advanced"

set cell 1 to newVar as string

end tell

Edited by Guest
tab is 9, not 10

I came to think of something Bruce showed us:

tell application "Mail"

       set mycontent to content of message 100 of mailbox 4 as styled text

end tell

set shellstuff to " tr 'n' 'r' "

do shell script "echo " & quoted form of (mycontent) & shellstuff

tell application "FileMaker Pro Advanced"

	copy result to cell 1

end tell

But I wonder once more how the 't' should be handled in a similar way piped into the next section???

--sd

I don't know that you really need to do the tr. I think just echo does it. Try this:

tell application "Mail"

set mycontent to content of message 1 of mailbox 1 as styled text

end tell

do shell script "echo " & quoted form of (mycontent)

tell application "FileMaker Pro Advanced"

copy result to cell 1

end tell

  • Author
  • Newbies

Thanks Fenton and Soryn,

I tried the last suggestion of just echoing the quoted form and it has worked, so since that's the simplest, that's what I'll go with.

But it was interesting to learn of the tr function, I may be able to use that in some other stuff.

So it's all good.

Thanks again.

  • 8 months later...

Hi,

This was also a lot of help to me ! Thnx ! But what about contents that has both text and pictures in the body (like company logo's)

Every picture gives me a '?' i don't quite care about pictures, but would like to get the remaining text in the body.

TIA

Create an account or sign in to comment

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.