Re: Formatting selected text in a Filemaker field
Re: Formatting selected text in a Filemaker field
- Subject: Re: Formatting selected text in a Filemaker field
- From: ehsan saffari <email@hidden>
- Date: Thu, 09 Jan 2003 01:38:03 -0600
On 08/01/2003 12:20, email@hidden wrote:
>
I'm wondering if this is possible using an applescript command within
>
Filemaker...
>
I want to be able to search out text in a field (for example, all text
>
within field x which is inside quotes), and then have it appear and print in
>
bold face.
>
I know how to isolate the text within Filemaker, but it seems FM has no
>
means for me to automate its formatting.
>
Also, I would not want to change any user chosen formatting of other text
>
within the field...
>
I hope I'm being clear with this, it seems as if there should be a clearer
>
way to express it!
>
Example-
>
This is an example of the field which I want to alter and change the text
>
which is "In quotes" to bold without changing other formatting (notably size)
>
>
Would return:
>
This is an example of the field which I want to alter and change the text
>
which is "In quotes" to bold without changing other formatting (notably size)
>
>
Any help would be greatly appreciated!
Make sure you try this in a test db first.
This is possible with one notable catch...The first charcter in the cell
where the replacement is performed must be in a style OTHER THAN the
layout formatted style of the cell.
In our database we need two fields:
1- field named "Text" that contains the source text to be modified and
2- field named "Find" that contains the replacement string, styled in
Bold or whatever you want it to be.
<IMPORTANTE>
Assuming that field named "Text" is layout formatted to be Helevetica 12
plain, make sure that the first charcter in it is formatted to something
other than Helvetica 12 plain. PITA but required. Weird things will
happen to the source Text styles if you miss this.
</IMPORTANTE>
then you can do the magic with this script, run from within FMP
Perform AS, Script Text:
-----------------------------------------------
global fixedText
tell current record
set x to cell "Text" as styled text
set y to cell "Find" as styled text
set z to cell "Find" as text
my ReplaceText(z, y, x)
set cell "Text" to fixedText
end tell
to ReplaceText(sWord, rWord, sText)
try
set fixedText to ""
set TIDs to AppleScript's text item delimiters
set AppleScript's text item delimiters to {sWord}
set itemList to text items of sText as list
set AppleScript's text item delimiters to {rWord}
set fixedText to every item of itemList as string
set AppleScript's text item delimiters to TIDs
on error
set AppleScript's text item delimiters to TIDs
end try
end ReplaceText
-----------------------------------------------
cheers
ehsan
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.