henrik_ahlgren Posted March 18, 2002 Posted March 18, 2002 I have a database tha have had three different developers before me. Unfortunately all of them has had their own standards regarding field names and none the strength to change old parts. What I want to do is give these fields new names and set a standard. In many of these fields I only want to change the first part of the name. Is there any easy way to do this to many fields at the same time? In a earlier post in the this forum I read about a external program, AUtoIT, that could give some help. But I would love if there was a way in FM to do this. I'm using FM 5 Pro and server, where the server is a WIN NT 4 and the clients both PC and MAC.
Chuck Posted March 19, 2002 Posted March 19, 2002 There's no way with FileMaker alone to change the names of fields en masse. I also don't know of any third party tool that would help with this, but if you find AUtoIT useful, let us know. Chuck
henrik_ahlgren Posted March 19, 2002 Author Posted March 19, 2002 Thanks for the answer Chuck. I will try this AutoIT and be back with feedback. //Henkan
henrik_ahlgren Posted March 19, 2002 Author Posted March 19, 2002 AutoIt did realy solve my problem. Big thanks to Thom who posted the suggestion and a example script back in november last year Thoms post . I did create a script that asks for what you want to change in a field name and what you want to replace it with. Then it check in the Define fields list for matches and replace if there is. There must be more than I who want to change more than one fieldname at a time so I can recommend AutoIt to all Windows users. You find it at AutoIt and it is free. Here are my code as a example. Remember to save a copy of your database before using it. code: ; Script to change part of field names in FileMaker ; ================================================= ; ; OS: Windows 9x/NT ; Author: Henrik Ahlgren ([email protected]) ; ; This script was written to change search for fieldnames and change it if there is any ; match. ; MsgBox, 4, Change field names, This script is to search for part of fieldnames and change that part if there is any match. Make sure that you have the right FileMaker file open! Make sure the Define fields dialog has the option "custom order" chosen for sorting the fields! Do you want to proceed? IfMsgBox, No, Goto, stop ; Asks for wich values should be changed and with what. variables: InputBox, OldFieldName, Fieldname contains, Please enter what part in the fieldname you want to change. InputBox, NewFieldName, New fieldname, Please enter what you want to change to. MsgBox, 4, Criterias, You want to change %OldFieldName% to %NewFieldName%. Is this correct? IfMsgBox, NO, Goto, change ; Rename the fields ; ; Go fast SetKeyDelay, 1 SetWinDelay, 1 ; Get FileMaker's attention attention: WinActivate, FileMaker Pro WinMaximize, FileMaker Pro IfWinNotActive, FileMaker Pro,, Goto, attention ; Open define fields Send, +^d ; Get first field name Send, +{TAB}{SPACE}{TAB}^c rename: ; Exit rename when the last fieldname has been renamed. IfEqual, check, %clipboard%, Goto, confirmation ; Counter SetEnv, temp, 0 SetEnv, counter, %temp%+1 ; Search for value to change SetEnv, input, %clipboard% StringReplace, output, input, %OldFieldName%, %NewFieldName% ; Sets variable for loopexit SetEnv, check, %output% ; Goes to next field if there is no match IfEqual, input, %output%, Goto, copyname ; Set new fieldname and save SetEnv, clipboard, %output% Send, ^v{TAB}{TAB}{TAB}{ENTER} ; Get next fieldname copyname: Send, +{TAB}{DOWN}{TAB}^c IfEqual, clipboard, AutoIt Clipboard owerflow, Goto, copyname Goto, rename ;Gives a confirmation when it the names has been changed. confirmation: Send, {TAB}^k MsgBox, 0, Comfirmation, %OldFieldName% has now changed to %NewFieldName% in %counter% fieldnames! Goto, change ; Run again with new values or exit change: MsgBox, 4, Change, Do you want to put in new values? IfMsgBox, YES, Goto, variables Goto, stop ; Exit the script stop: MsgBox, 4, Quit, Do you want to exit this script? IfMsgBox, NO, Goto, variables Exit This forum is GREAT! //Henkan
Recommended Posts
This topic is 8356 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 accountSign in
Already have an account? Sign in here.
Sign In Now