Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×
The Claris Museum: The Vault of FileMaker Antiquities at Claris Engage 2025! ×

This topic is 6503 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

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!

Posted

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

Posted

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

Posted (edited)

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

This topic is 6503 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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

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