April 5, 200718 yr I have a container field that stores references to files of any type. I have three other fields that store the file name, modification date, and file path. Right now I just have users typing in this information, but I'd like to automate it. Is there some way in FileMaker (preferrably not AppleScript) to extract this information and place it in these fields? I'll use an AppleScript if it's the only way, but I'd prefer not to for simplicity of maintaining the system. Thanks in advance!
April 5, 200718 yr You can get some information if you use GetAsText( container field ). It has the name and the path to the file. You'll need to use something else to get the last modification date though.
April 5, 200718 yr Author Fantastic! That's just what I was looking for but couldn't seem to figure out. I can live without the modification date, or continue to enter that manually. Thanks! Ken
April 5, 200718 yr I very much doubt you can get the modification date without using either AppleScript or a plug-in. On the plus side I do not think you need to worry much about "maintaining" the AppleScript. I don't think the basics are going to change in the forseable future. (They updated the ability to address parts of the "current date" a few years ago; it is as simple as it's going to get I think.) You have to do a little messing about to convert an AppleScript "date" (which is actually a timestamp, including the name of the day) into FileMaker Timestamp syntax. I've included a little subroutine to do that. Copy/paste the below into a FileMaker Perform AppleScript step. You can ignore the commented lines (--). The: tell application "FileMaker Pro" is only need outside FileMaker, like in Script Editor; useful for troubleshooting. -- tell application "FileMaker Pro Advanced" set fileTxt to cell "_cMacFile" of current record -- calculated from GetAsText ( container field ) tell application "Finder" set theSize to size of file fileTxt set modDate to modification date of file fileTxt as string end tell set theTS to my FM_TS(modDate) set cell "FileSize" of current record to theSize set cell "FileMod_TS" of current record to theTS -- end tell on FM_TS(theDate) set curDate to (current date) set Yr to year of curDate set Mn to month of curDate as number set Dy to day of curDate set dateTxt to (Mn & "/" & Dy & "/" & Yr) as string set theDate to (current date) as string set Hr to word -4 of theDate set Mn to word -3 of theDate set Sc to word -2 of theDate set amPM to word -1 of theDate set timeTxt to Hr & ":" & Mn & ":" & Sc & " " & amPM set TS to dateTxt & " " & timeTxt end FM_TS
April 5, 200718 yr To get the Mac filepath, using FileMaker 7 (it's easier in 8), calculation, result text. This is for an inserted "file", for an image use "imagemac" instead. Let ( line = Right ( GetAsText(Contain); Length ( GetAsText(Contain) ) - Position ( GetAsText(Contain) ; "¶" ; 2 ; 2 ) ) ; Substitute ( line; ["filemac:/"; ""]; ["/"; ":"] ) ) Edited April 5, 200718 yr by Guest
Create an account or sign in to comment