Imagine Photo capture date

I am trying to get the capture date of an image using Imagine Photo, but I must be missing something.

I have tried to alter codes on this site and using the authors examples, with no luck.

I would like the date to place it in a FileMaker field.

What I have here will return all the data, but when I try to use “resultVal” it says it is not defined
(I have been working on this for 2 days and my brain is fried!)


tell application "iMagine Photo"
	set theItem to choose file without invisables
	set thisImporter to import graphic theItem
	set exifInfo to the exif data of thisImporter
	close thisImporter
	set projectInfo to my GetExifUnicodeFromExifType(capture date, exifInfo)
	quit
end tell

on GetExifUnicodeFromExifType(exifType, exifData)
	set resultVal to missing value
	using terms from application "iMagine Photo"
		repeat with theItem in exifData
			if the exif type of theItem is equal to exifType then
				set resultVal to exif unicode of theItem as string
				exit repeat
			else
				set resultVal to ""
			end if
		end repeat
	end using terms from
	return resultVal
end GetExifUnicodeFromExifType


Thanks for the help
higashijoe

Hi,

I’ve tried your script and it works fine for me.

Assuming capture date is the same as creation date you can use built-in Image Events alternatively

set theFile to (choose file)
tell application "Image Events"
	launch
	try
		open theFile
		tell image 1
			set projectInfo to value of metadata tag "creation"
			close
		end tell
	on error
		set projectInfo to missing value
		try
			close image 1
		end try
	end try
end tell

Hi StefanK,

Thanks for the time.

What I do not understand is how do I get the date and put it into something?

To make it simple for me to understand, could you make one of these scripts to make and name a folder on the desktop, using the creation or capture dates as its name.

Sorry but I am new to scripting.

Thanks

The date will be stored into the variable projectInfo
The problem is, the dates contain colons, which are not allowed in file oder folder names.
The text item delimiters part changes the colons to underlines

set theFile to (choose file)
tell application "Image Events"
	launch
	try
		open theFile
		tell image 1
			set projectInfo to value of metadata tag "creation"
			close
		end tell
	on error
		set projectInfo to missing value
		try
			close image 1
		end try
	end try
end tell
set {TID, text item delimiters} to {text item delimiters, ":"}
set projectInfo to text items of projectInfo
set text item delimiters to "_"
set projectInfo to projectInfo as Unicode text
set text item delimiters to TID
tell application "Finder" to make new folder at desktop with properties {name:projectInfo}

Thanks again StefanK,

I can be a rock at times (as I said brain frie).

But when I see it work, I can analize it.

higashijoe!

You’re welcome :slight_smile: