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

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

Recommended Posts

Posted

I have a field that contains Exif Data from photos and I would like to be able to create a script that extracts just certain lines of text.

Example:

Maker: Panasonic

Model: DMC-GH2

Software: Adobe Photoshop CS5 Macintosh

Exposure Time: 0.04 sec. = 1/25 sec.

f-number: f 5.3

ISO Speed Rating: 400

I would like to extract line 1, 2, 4 and 5 and insert each line into separate fields.

How would I do this?

Thanks in advance for your help - Sam

Posted

Hi Sam! Welcome to FM Forums!!

Set new field with:

GetValue ( that sample field ; 1 )

... to get the first line. Change to 2 for the second and so on ...

added: and then to set the fields, you can use script something like:

Show All Records

Go To Record/Request/Page [ first ]

Loop

Set Field [ first field ; GetValue ( string ; 1 ) ]

Set Field [ second field ; GetValue ( string ; 2 ) ]

...etc

Go to Record/Request/Page [ next ; exit after last ] ... critical you include this checkbox

End Loop

... and if being served, include error trap. You can also use Replace Field Contents[] but it is slower if you have more than two fields. And you might also want to wrap the calculation in Trim() in case there are any leading or trailing spaces as: Trim ( GetValue ( string ; 2 ) )

Posted

The solution you gave me worked like a charm. Unfortunately, I have discovered that the data I want to extract from the Exif Data will vary from line to line depending of the photo file. What I mean is it the line it is on will change, so the solution will not work.

What I need now is a formula that will find some text in the Exif Data file and extract that line of text.

Examples would be:

tiff:Make=

aux:Lens=

Again, Thanks in advance for your help - Sam

Posted

Hi Sam, your first example data doesn't look like the second? You can use Set Field By Name[] to loop through the lines in the text field and, if the left side of the colon is the exact field name, then you can set the field with the right side of the colon. And you can loop the records as well as loop the text within.

Is this what you need? Please explain why your second sample is different, especially why no space after colon and the equal at the end. :^)

Posted

Wow. Thanks for this question because finding the answer to the largest possible way you could mean was really fun!

SO, basically, what I've read about EXIF data loosely means that it's stored as binary data in the file and the parsed out to string values from whatever EXIF reader you're using. I really have no idea how you're pulling the data out from your example but the gist of what I'm reading is that if you're pulling it out from the same place every time, the format should be consistent, hence I have no idea why "tiff:Make=" and "Maker: Panasonic" should be different as it'd be the same code ("271") in the file's metadata.

That said, to solve your issue, you COULD just have a table of mappings. So, you make a table with the text values that you want to map on one column and the name of the target field in the other column. You can load those into a couple of variables (outside the scope of this tip) and simply loop through them, matching as you go along. If you want to post two files (I'd hope low res with large watermarking), I could probably give you an example. Overall this is kind of a medium high level kind of problem but if your mapping changes dynamically, I can't really think of another way.

Posted

What I need now is a formula that will find some text in the Exif Data file and extract that line of text.

See if this helps:

http://fmforums.com/forum/topic/79176-parse-email-data-into-multiple-fields/page__p__369332#entry369332

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