• 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, 09 May 2014 09:34:32 +1000

On 8 May 2014, at 10:59 pm, email@hidden wrote:

trying to extract 20+ Exif-fields from a picture

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.

Save this as a Cocoa AppleScript library:

use framework "Foundation"
use framework "AppKit" -- for image stuff

on readEXIFFromJpeg:POSIXPath
set theImageRep to current application's NSBitmapImageRep's imageRepWithContentsOfFile:POSIXPath
set theEXIFData to theImageRep's valueForProperty:(current application's NSImageEXIFData)
return theEXIFData as record
end readEXIFFromJpeg:

Then call it like this:

set POSIXPath to "/Users/shane/Desktop/IMG_0436.jpg"
tell script "<name of script>"
set theRecord to its readEXIFFromJpeg:POSIXPath
end tell
--> {DateTimeOriginal:"2014:04:24 13:48:02", ComponentsConfiguration:{1, 2, 3, 0}, FocalLenIn35mmFilm:33, BrightnessValue:4.377906799316, LensMake:"Apple", FNumber:2.400000095367, FocalLength:4.119999885559, ShutterSpeedValue:5.321985721588, SubjectArea:{1631, 1223, 1795, 1077}, ApertureValue:2.526068925858, SceneType:1, SceneCaptureType:0, ColorSpace:1, LensSpecification:{4.119999885559, 4.119999885559, 2.400000095367, 2.400000095367}, PixelYDimension:3264, WhiteBalance:0, FlashPixVersion:{1, 0}, DateTimeDigitized:"2014:04:24 13:48:02", ISOSpeedRatings:{64}, ExposureMode:0, ExifVersion:{2, 2, 1}, PixelXDimension:2448, LensModel:"iPhone 5 back camera 4.12mm f/2.4", ExposureProgram:2, ExposureTime:0.025000000373, SubsecTimeDigitized:"926", Flash:16, SubsecTimeOriginal:"926", SensingMethod:2, MeteringMode:5}

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

  • Follow-Ups:
    • Re: How to parse a block of text
      • From: Martin Orpen <email@hidden>
References: 
 >How to parse a block of text (From: email@hidden)

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