Hi Carlo
Unlike find, find/replace is not taken out by edit only privileges (although
password privileges still apply with regard to modifying records) which
makes me wonder why you would ever need to script something like this.
Command-Shift-F (or equiv Windows shortcut) will bring up the find/replace
dialog and find the first instance, while Command-G (or equiv Windows
shortcut) will find the next instance (even after you have closed the dialog
box).
However, if there really is a reason why you must do it this way, why not
make use of a custom dialog in your script. Values can be entered into
global fields via the dialog, doing away with the need for extra layouts.
Also, a loop and a pause/resume script step would allow users to use the
Enter key to view each instance of the search string, instead of having to
click a button each time.
Set Field [ gText1, "" ]
Show Custom Dialog [ Title: ³SEARCH STRING²; Message: ³Enter search
string.²; Buttons: ³OK², ³Cancel², ³²; Input #1:
gText1, ³Search String² ]
If [ Status(CurrentMessageChoice) = 1 ]
Enter Find Mode
Set Field [ text, gText1 ]
Perform Find [ Replace Found Set ]
Loop
Perform Find/Replace [ Find: gText1; Replace: ; Search operation: Find Next;
Search settings: Forward; Search across: All records/requests; Search
within: All fields ]
Pause/resume []
End Loop
End If
NB: This script would be improved by error checking for no records found,
and by giving the user the choice to modify search criteria, and to replace,
constrain or extend the found set, but I have kept it simple here for the
sake of clarity.
Bridget Eley
in article 9b1b0094.0307300311.2ae8873f (AT) po...OT) google.com, Carlo at
ercar (AT) hostlcnet (DOT) it wrote on 30/7/03 9:11 PM:
Quote:
In Filemaker 6:
Define a global field named "gSearched_word" to store word that you
want to find.
Make a script to enter in find mode as below:
Script 1
Go to Layout ("mySearchLayout")
Enter Find Mode (Pause)
Set Field("gSearched_word)", "myField")
Perform Find(Replace Found Set") (or other option)
Go to Layout("myResultLayout")
Perform Find/Replace("gSearched_word", " ", "Find next") (see other
option on "Find next" parameter, ecc)
Make a new script to hilite the next occurence of word
Script 2
Perform Find/Replace("gSearched_word", " ", "Find next")
Insert a button to perform this script in "myResultLayout"
That's all.
Bye. Carlo |