Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

Mac OSX "file info" data extraction and import?


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

Recommended Posts

  • Newbies
Posted

Is there a way to extract the data from a documents "get info" and import into FMP?

FileMaker Version: 7

Platform: Mac OS X Jaguar

Posted

If on Mac, type the following into AS Script Editor:

set theInfo to info for (choose file)

It returns a "record," which is a series of named pieces of date: name, name extension, file type, etc.. Each item can be accessed via its label.

Then it's just a question of setting them into corresponding FM fields. The simplest example, in a Perform AppleScript step:

set theInfo to info for (choose file)

tell current record of document 1

Posted

I also discovered that getting the "kind" from the info kicks up an error when run in a FileMaker Perform AppleScript step; but not in Script Editor. So just put all whole "info for" block inside a tell "Finder" call.*

That's probably 'cause "kind" is a command to get the "class" of an object in FileMaker; sometimes command keywords conflict. You've also got the file type, creator and extension; but sometimes those are missing these days, so kind is more reliable, if a little verbose.

*The FileMaker commands don't need to be in a tell "FileMaker Pro" block, unless when testing scripts in Script Editor. FileMaker knows who it is. I put them outside, then remove them.

Posted

And, while I'm at it :-), the default application returns an alias, which you have to coerce "to text" or "to Unicode text" to put into FileMaker. The dates are a date|time stamp, so they also benefit from a "to string." I also coerced size, since I divided it by 1024 for K.

This topic is 7538 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.