Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 7883 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

Hi all! I think I know the answer to this question, but I thought I would see if anyone as found a way to do this. Basically, I have a text field that I allow people to enter a short key(#123#) and then I replace that key with stored text from a related file based on the short key using a script. This is pretty simple using the Substitute function. The problem with using the Substitute function, much like using the SetField function, is that any formatting(bold, italics,etc) that was done to the stored text in the related file gets removed.

The only way I know how to preserve the formatting is by using copy and paste. The problem with that is that to paste into a field you either have to select all contents of the field or you have to have an insertion point which requires the user to grab the mouse and click the button. This is a problem since the whole concept of my solution is to speed up data entry in this field. To my knowledge, there is no way to automatically go to a position in a string of text. If there was then my problems would be solved. I could automatically go to the insertion point and then paste.

Anyone have a solution to my problem?

Posted

The only way to do it is by AppleScript:

set x to cell "log text" of current record as styled text

set y to myReplace("#123"", "Substitute Text", x)

set cell "log text" of current record to y

on myReplace(search, replace, theString) -- Parameters: search, replace, the String

set olddelis to my text item delimiters

set my text item delimiters to (search)

tell me to set theList to (every text item of theString)

set my text item delimiters to (replace)

set theString to theList as string

set my text item delimiters to olddelis

return theString

end myReplace

Posted

then you will need a system wide macro recorder or a prog that intercepts text input.

There are some that replace any occurrence of "###123###" with

"hello there" .

Maybe you will find one at tucows.com.

Most utilities like this store their substitutions in a simple text fie.

You could easily update that from within FileMaker by export script step.

This topic is 7883 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

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