Skip 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.

Automating Text input

Featured Replies

I am storing some word doc files and some text files in container fields to keep them part of a larger project. I would like to write a script or something that would automatically open up that file, and copy the text and put it into another field so that I can run some scripts on the acutal text. I have the scripts working to sort and pull data from the text, but I want to eliminate the manual process of opening the file, copying the text, and then pasting it into the other field. Any thoughts out there?

  • Author

thanks for that. i'll check them out.

cheers

AppleScript can do this, using the shell command "textutil" (which can read and convert lots of things, incl. html). Most of the below code is to do with getting the file paths and/or converting them from Mac to Unix. For what you want to do, you would have to convert your FileMaker export path to Unix, which is actually easier; especially since you could do the calculations within FileMaker for the path and file name(s); in unstored fields (no bloat :)-).

It will write the file into FileMaker as text. It will not do Word tables as tables, just text. (There was a post here a while back which shows how to get Word tables using Linux, but not Mac, AFAIK.)

I'll do an example of export/convert/read Word file in a FileMaker container later. But right now I've got to do some real work. Sigh.

set Mac_file to choose file with prompt "Choose a Word or rtf file"



tell application "Finder"

	set file_name to name of Mac_file

	set theExt to ("." & name extension of Mac_file)

	set name_only to my nameOnly(file_name, theExt)

end tell



set txt_file to quoted form of name_only & ".txt"

set Unix_file to quoted form of (POSIX path of Mac_file)

set fold to quoted form of (do shell script "dirname " & Unix_file)



set txt to do shell script "cd " & fold & "; textutil -convert txt " & Unix_file & "; cat " & txt_file

-- Will create new converted file, with extension ".txt" at location, then read it



tell application "FileMaker Pro Advanced"

	set cell "txt" of current record to txt

	save record

end tell



on nameOnly(fileName, ext)

	set {TID, AppleScript's text item delimiters} to {AppleScript's text item delimiters, ext}

	set theName to first text item of fileName as string

	set AppleScript's text item delimiters to TID

	return theName

end nameOnly

Word_as_Txt.fp7.zip

Edited by Guest
Sigh

Create an account or sign in to comment

Important Information

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

Account

Navigation

Search

Search

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.