Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.
Juggernaut

File info for Contents of Container Field

Featured Replies

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!

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.

  • 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

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

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 by Guest

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.