• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: How to parse a block of text
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to parse a block of text


  • Subject: Re: How to parse a block of text
  • From: Shane Stanley <email@hidden>
  • Date: Fri, 16 May 2014 12:05:47 +1000


On 9 May 2014, at 11:00 am, Martin Orpen <email@hidden> wrote:

On 9 May 2014, at 00:34, Shane Stanley <email@hidden> wrote:

I'm not sure from your post whether you want only the EXIF values, or the other stuff as well. If only the EXIF values, and you're running Mavericks, you can get it directly as an AppleScript record via a script library, without having to bother with EXIFTools.

[snip]

Shane

That’s very useful.

Is Mavericks able to grab IPTC data from images using a similar method?

Coming back to this topic, you can now gather all the metadata if you have the ASObjCExtras framework installed. The library script would be like this:

use framework "Foundation"
use framework "ASObjCExtras"

on metadataFrom:imageFile
set {theRecord, theError} to current application's SMSFord's metadataFromImage:imageFile |error|:(reference)
if theRecord = missing value then -- there was a problem, so extract the error description
error (theError's localizedDescription() as text) -- number (theError's code())
else
return theRecord as record
end if
end metadataFrom:

And you'd call it like this:

tell script "<lib name>"
set theMetadata to its metadataFrom:(choose file)
end tell

The result will naturally depend on the image and the camera it was shot on, but this is from a sample taken on an iPhone:

--> {|{tiff}|:{ResolutionUnit:2, Software:"iPhoto 9.4.3", DateTime:"2013:04:24 13:54:01", XResolution:72.0, Orientation:1, YResolution:72.0, Model:"iPhone 5", |make|:"Apple"}, Depth:8, |{exif}|:{DateTimeOriginal:"2013:04:24 13:54:01", ComponentsConfiguration:{1, 2, 3, 0}, BrightnessValue:9.038889884949, FNumber:2.400000095367, FocalLength:4.130000114441, ShutterSpeedValue:10.111389160156, SubjectArea:{1631, 1223, 881, 881}, ApertureValue:2.526068925858, SceneCaptureType:0, ColorSpace:1, PixelYDimension:3264, WhiteBalance:0, FlashPixVersion:{1, 0}, DateTimeDigitized:"2013:04:24 13:54:01", ISOSpeedRatings:{50}, ExposureMode:0, PixelXDimension:2448, ExifVersion:{2, 2, 1}, ExposureProgram:2, ExposureTime:9.04159154742956E-4, Flash:16, SensingMethod:2, FocalLenIn35mmFilm:33, MeteringMode:5}, PixelHeight:3264, |{jfif}|:{DensityUnit:1, YDensity:72, JFIFVersion:{1, 1}, XDensity:72}, ProfileName:"sRGB IEC61966-2.1", DPIWidth:72.0, DPIHeight:72.0, ColorModel:"RGB", Orientation:1, PixelWidth:2448}

-- 
Shane Stanley <email@hidden>
<www.macosxautomation.com/applescript/apps/>

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

References: 
 >How to parse a block of text (From: email@hidden)
 >Re: How to parse a block of text (From: Shane Stanley <email@hidden>)
 >Re: How to parse a block of text (From: Martin Orpen <email@hidden>)

  • Prev by Date: My WWDC/birthday wish
  • Next by Date: Re: My WWDC/birthday wish
  • Previous by thread: Re: How to parse a block of text
  • Next by thread: Re: Mavericks and UI
  • Index(es):
    • Date
    • Thread