Automating tasks with scripts > Creating and editing scripts > Importing scripts from other FileMaker files
 

Importing scripts from other FileMaker files

You can import scripts from other FileMaker files. You can also copy and paste scripts between files. See Copying and pasting scripts.

You must have access privileges in the source file that allow you to modify the script.

Many scripts refer to files, fields, layouts, records, and other scripts. In addition, some script steps, such as Set Field, Insert Calculated Result, Replace Field Contents, may have field references embedded in calculations. While these references may be valid in the original file, it is possible that they will be invalid in the file into which they are being imported.

When you import a script, FileMaker Pro Advanced attempts to map fields, layouts, tables (including those used in relationships), and so on based on their names. Fields and layouts are mapped using their fully qualified names, and these must match exactly or the reference will not be imported. If the referenced object cannot be found, FileMaker Pro Advanced flags it as missing.

To import a script:

1. Open the file into which the script will be imported.

2. Choose Scripts menu > Script Workspace.

Or, choose File menu > Manage > Scripts.

3. In the Script Workspace, choose File menu > Import (Windows) or Scripts menu > Import (macOS).

Note  You can import scripts into a folder by selecting the folder, then importing the scripts.

4. Open the file that contains the script(s) you want to import.

5. In the Import Scripts dialog box, select the script(s) you want to import.

If one or more of the scripts you're importing refer to other scripts, make sure you select and import all the referenced scripts at the same time.

6. Click OK.

The Import Summary dialog box appears. To view the import log file, click Open Log File. Then click OK and view the script in the editing pane. Known problem steps are highlighted.

7. After you import a script, edit the script to make sure all references are valid and appear as intended.

If FileMaker Pro Advanced reports errors, follow the steps in Creating and editing scripts to correct the <unknown> references in each script. During the script import, FileMaker Pro Advanced checks all references to fields, layouts, other scripts, files, and so on, in each imported script. References must match exactly to be included in the import. If a referenced object is not found, FileMaker Pro Advanced flags it as <unknown>.

Notes 

The match for field names is not case sensitive.

After you import a script that references a related field, the fully qualified field names must match identically, including the names of the tables as they appear in the relationships graph.

When importing script steps that contain calculations (for example, If, Set Field, and Insert Calculated Result), if FileMaker Pro Advanced cannot match all items referenced in the calculation (tables, fields, or custom functions), the calculation is commented out. See Adding comments to a formula.

When importing script steps that contain more complex information (for example, find requests, sort order, import field order, and export field order), FileMaker Pro Advanced discards any missing field references.

If the user performing the import does not have full access privileges, imported scripts will not be set to run with full access privileges.

The Import.log file is normally located in the folder with your destination file. If you've opened the destination file remotely or do not have write access to that folder, check the Documents folder.

Related topics 

Automating tasks with scripts