January 12, 200619 yr I'm a newbie at Filemaker, but oldtime computer user. I want to automate some data entry. I want to have a script do the import. The Filename to be imported has to become a field in the table the file is imported to. For example Filename = FOO with records aaa bbb ccc ddd eee fff when the import is done I want to have four fields with aaa bbb ccc FOO ddd eee fff FOO I've been looking at the various functions and scripting commands, but can't figure out which to use. Can someone please point me in the right direction? Thanks in advance. Edited January 12, 200619 yr by Guest
January 13, 200619 yr If you can use a little AppleScript in a FileMaker 8 script: Perform AppleScript step: set theFile to (choose file) set cell "_gFile" to theFile as string tell application "Finder" set theName to name of theFile end tell set cell "_gFileName" to theName Then, set a Script Variable, $FileToImport (or whatever) to: "filemac:/" & Substitute ( Data:_gFile; ":"; "/" ) Then Import, with $FileToImport as the path, with [x] Allow auto-enter calculations The field FileName can auto-enter _gFileName Import_wFilename.zip
January 16, 200619 yr That is part of the problem i was trying to solve over here. 3 fields plus the file name, exactly. post from applescript forum I have only Filemaker 7 to work with tho' and needed to use applescript to perform a few other functions along the way. JA
January 16, 200619 yr Author Eureka! I've done it, I can now import the filename into a table along with the data in the file and all in Filemaker. ------------ The Problem: ----------- I have a folder with multiple files. The data in each file is similar (this is for a pottery business. Each file represents a kiln firing and each line in the file has the name and dimensions of each piece in the kiln) All the lines in each file have to become rows in just one table and then need to contain the name of the file it came from. example FIRING FOLDER SKUTT_20060105 (file 1) Sue 2 4 5 (line 1) Sue 3 2 3 (line 2) Paul 2 5 5 (line 3) Paul 3 9 9 (line 4) Karen 7 8 8 (line 5) BAILEY_20060106 (file 2) Sue 12 4 5 (line 1) Paul 2 6 6 (line 2) Paul 13 9 9 (line 3) SKUTT_20060109 (file 3) Sue 2 14 5 (line 1) Sue 3 2 13 (line 2) Karen 17 8 8 (line 3) End result needs to look like this: Filemaker table +--------------------------------------------------+ + Name + Height + Width + Depth + Filename + +--------------------------------------------------+ + Sue + 2 + 4 + 5 + SKUTT_20060105 + + Sue + 3 + 2 + 3 + SKUTT_20060105 + + Paul + 2 + 5 + 5 + SKUTT_20060105 + + Paul + 3 + 9 + 9 + SKUTT_20060105 + + Karen + 7 + 8 + 8 + SKUTT_20060105 + + Sue + 12 + 4 + 5 + BAILEY_20060106 + + Paul + 2 + 6 + 6 + BAILEY_20060106 + + Paul + 13 + 9 + 9 + BAILEY_20060106 + + Sue + 2 + 14 + 5 + SKUTT_20060109 + + Sue + 3 + 2 + 13 + SKUTT_20060109 + + Karen + 17 + 8 + 8 + SKUTT_20060109 + +--------------------------------------------------+ --------- Solution: --------- 1) Define a table to hold the file names temporarily File Names temp Field Name Field Tpe Formula/ Entry Option ----------------------------------------------------- Text Coontains Text File Name Text File Path Text 2) Create your data table Firing Slips Field Name Field Tpe Formula/ Entry Option ---------------------------------------------------------- Name Text Height Number Width Number Depth Number Filename Calculation (Text) = $file 3) create a Script to get the filenames: GET FILE NAMES -------------- Go to Layout ["File Names temp" (File Names temp)] Import Records [Folder Name: Your data folder name here; File Type: Picture and movie files; Import only a reference; Target: "File Names temp"; Method: Add; Character Set: "Mac Roman"; Field Mapping: Source field 2 import to File Names temp::File Name Source field 3 import to File Names temp::File Path] [No dialog; Data contains column names] Show All Records 4) Create a script to do the import IMPORT DATA ----------- Go to Layout ["File Names temp" (File Names temp)] Go to Record/Request/Page Loop Set Variable [$path; Value:File Names temp::File Path] Set Variable [$file; Value:File Names temp::File Name] Set Variable [$PathToFile; Value:Right ( $path ; Length ( $path ) -6)] Import Records [No dialog: "$PathToFile"; Add; Mac Roman] Go to Record/Request/Page [Next; Exit after last] End Loop Show All Records Exit Script [] 5) Create a script to cleanup the temp table CLEAN UP FILE NAMES ------------------ Go to Layout ["File Names temp" (File Names temp)] Show All records Delete All records {No dialog] That's it Have fun with it.
Create an account or sign in to comment