Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Mac OS X > AppleScript question for Sal

AppleScript question for Sal
Thread Tools
Dedicated MacNNer
Join Date: Nov 1999
Status: Offline
Reply With Quote
Mar 22, 2003, 02:18 PM
 
Hello Sal--

I was wondering if you could help me with an assue ive come across. the problem: i have a slew of photos in iPhoto which have incorrect creation dates in the photo metadata due to incorrect date/time settings on my digital camera. the incorrect dates fungle the order of my albums when i sort by date.

the solution: i downloaded a few of the iPhoto scripts and hacked out a few modifications to remedy this issue. however, after banging my head against the wall because my script "should work" i re-read the iPhoto AppleScript class descriptions and discovered that the date property of photo is read only--as are many of the photo properties. sometimes, it really pays to read the docs before you bang your head

first: why are these props r/o? this limitation severly limits the utility of applescript in iPhoto. btw: most of these props are writable in the iPhoto UI, so at least one interface allows modification of these values.

second: can you suggest any workarounds?

thanks and best regards,
ppmax

here is my applescript (again, to give credit where credit is due, it is based on one that apple supplies)
=================
try
tell application "iPhoto"
activate
set the view to organize
copy (my selected_images()) to the selected_photos
if the selected_photos is false then error "Please select some images."

select ""
repeat with i from 1 to the count of the selected_photos
set this_photo to item i of the selected_photos
set this_file to ((image path of item i of selected_photos) as POSIX file) as alias
tell application "Finder"
set this_date to the creation date of this_file as date
end tell

select ""
select {this_photo}
set the date of this_photo to this_date
end repeat
select the selected_photos
end tell

on error error_message number error_number
tell application "iPhoto"
activate
if the error_number is not -128 then
display dialog error_message buttons {"OK"} default button 1
end if
end tell
end try

on selected_images()
tell application "iPhoto"
try
-- get selection
set these_items to the selection
-- check for single album selected
if the class of item 1 of these_items is album then error
-- return the list of selected photos
return these_items
on error
return false
end try
end tell
end selected_images

=====================
     
Mac Elite
Join Date: May 1999
Location: San Jose, CA
Status: Offline
Reply With Quote
Mar 22, 2003, 07:46 PM
 
First, why are you asking this question in the Mac OS X forum - 'Software' would appear to be far more relevant.

Secondly, why are you addressing the question to Sal?

Sal may well be the AppleScript guy, but he doesn't know every issue of every AppleScript implementation of every app.

This problem is clearly an iPhoto issue, not an AppleScript one.

IMHO, the appropriate place for this question is Apple's Bug Reporter, filed against iPhoto.
Gods don't kill people - people with Gods kill people.
     
Mac Elite
Join Date: Jan 2001
Location: L.A., CA
Status: Offline
Reply With Quote
Mar 22, 2003, 08:23 PM
 
Originally posted by Camelot:
First, why are you asking this question in the Mac OS X forum - 'Software' would appear to be far more relevant.

Secondly, why are you addressing the question to Sal?

Sal may well be the AppleScript guy, but he doesn't know every issue of every AppleScript implementation of every app.

This problem is clearly an iPhoto issue, not an AppleScript one.

IMHO, the appropriate place for this question is Apple's Bug Reporter, filed against iPhoto.
That's not terribly helpful. He was looking for a solution, or a benignant suggestion, not an obtuse criticism of his form.

ppmax Sadly I'm no expert on iPhoto or ApplScript. There are some knowledgable ones around here, including Sal, and I'm sure you'll find something that will help you back on your way. Good luck.

Camelot I suggest regular aerobic exercise, niacin, and vitamin C.
     
Mac Elite
Join Date: May 1999
Location: San Jose, CA
Status: Offline
Reply With Quote
Mar 22, 2003, 09:04 PM
 
Originally posted by JB72:
That's not terribly helpful. He was looking for a solution, or a benignant suggestion, not an obtuse criticism of his form.

ppmax Sadly I'm no expert on iPhoto or ApplScript. There are some knowledgable ones around here, including Sal, and I'm sure you'll find something that will help you back on your way. Good luck.

Camelot I suggest regular aerobic exercise, niacin, and vitamin C.
JB, the fact is that iPhoto marks the date of a photo as read-only.

There's nothing Sal can do about this.

There's nothing any AppleScript user can do about it.

The only possible solution is to hope that Apple engineers change this attribute in a future version. The best chance for this is to file a bug report with Apple and wait.
Gods don't kill people - people with Gods kill people.
     
Mac Elite
Join Date: Jan 2001
Location: L.A., CA
Status: Offline
Reply With Quote
Mar 22, 2003, 09:13 PM
 
Originally posted by Camelot:
JB, the fact is that iPhoto marks the date of a photo as read-only.

There's nothing Sal can do about this.

There's nothing any AppleScript user can do about it.

The only possible solution is to hope that Apple engineers change this attribute in a future version. The best chance for this is to file a bug report with Apple and wait.
Thank you. That is actually helpful, as you shared more specific knowledge of why you don't see any possible workaround. Other users may benefit from that.
     
Mac Elite
Join Date: Jan 2001
Location: L.A., CA
Status: Offline
Reply With Quote
Mar 22, 2003, 09:37 PM
 
These might be of some help:

http://iphoto.tidbits.com/iPhoto

Q:
I know how to change the date of a photo in the iPhoto interface for one individual image, but how do I change the date for a group of photos within some specific directory (changing all to the same date). I have changed the file creation and modification date but this seems to be separate from the data of the image that shows up in the iPhoto interface.
A:
iPhoto lets you change the date and time for a single photo at a time, unfortunately. The created and modified dates, as you noticed, are separate from the date stored with the photo's EXIF information. A few thoughts... First, do you really want to change the date for all the photos - does it really matter? Instead what about changing the date for the film roll that contains the photos? That date generally matches the date of import, and if you change it, the film roll sorts appropriately. I've done that a lot when importing old photos so they arrange correctly. Second, iPhoto 2 supports AppleScript now, and looking at the AppleScript dictionary for iPhoto, it appears you can at least read the date via AppleScript (it's marked as r/o, which might mean you can't set it via AppleScript). It might be worth investigating that more. Third and finally, the approach I'd probably use is CE Software's QuicKeys or another macro utility that could cycle through each photo in iPhoto, clicking and typing as though you were doing it. (01-Feb-03)
-------------------

http://www.macosxhints.com/article.p...20108204912427

touch, a terminal command, is a useful utility for changing the create dates on files before importing to iPhoto. By changing the create/modified date, you can change the date information that will display in iPhoto and where it will put the photo once imported. Open a terminal and type:
touch -t [[CC]YY]MMDDhhmm[.SS]] FILENAME
Used in conjunction with wildcards such as * or *.jpg for example this can make it easy to get photos imported with the proper dates.

This can be quite useful for changing the file dates on files that were burned to CD at a date much different than when they were shot. Fine tweaking of the time will impact the way the photos sort if you sort by date.

From my experience you can't simply move photos within iPhoto's structure. If you get them in with the wrong date you'll have to copy them out to another folder and then re-import them.
--------------------

http://www.osxfaq.com/man/1/SetFile.ws

SetFile - sets file attributes


SYNOPSIS

SetFile file1 [file2]... [ -a attributes ] [ -c creator ]
[ -d date ] [ -l h , v ] [ -m date ] [ -noResolve ] [ -t
type ]



DESCRIPTION

The SetFile command sets attributes for one or more files.
The options apply to all files listed.

(CON'T)
     
ppmax  (op)
Dedicated MacNNer
Join Date: Nov 1999
Status: Offline
Reply With Quote
Mar 23, 2003, 12:44 AM
 
camelot: i know the war is wearing heavily on all of us, but was that really necessary? it's behavior like this that keeps me away from these forums: its so...petulant

reply 1. i know sal frequents these forums; before i posted i searched for sal and most of the questions posed to him are indeed in the mac osx thread. please see:
http://forums.macnn.com/search.php?s...der=descending
since you've ostensibly participated on this board since 1999, you may remember that sal's origanal posts were to the mac osx board

reply 2. im addressing the question to sal because in his position he may know why the props in iPhoto are r/o. considering his responsibilities this is not an unwarranted assumption--and--not unlikely

reply 3. while we both have made assumptions about sal's skillset and awareness of applescript errata, i was merely asking a question, whereas you imply that he does not know the answer. im not clear why you choose to speak for sal...unless you are sal

reply 4. while the essence of my question does indeed revolve around an iphoto applescript class prop, which in your view may not be "up sal's alley," please note that my assumption that sal does indeed know more than you credit him offers sal the opportunity to comment on any known workarounds or unpublished interfaces--which was clearly intent of my post

reply 5. i can see no reason why you would suggest that this issue is a bug/defect. clearly the intended and observed behavior of the referenced read only property is consistent. this would indicate that the feature is working as designed--which i have acknowledged, but take issue with. thus this would be a feature request

back to more constructive comments...
JB72: thanks for the pointers.

ppmax
     
Mac Elite
Join Date: May 1999
Location: San Jose, CA
Status: Offline
Reply With Quote
Mar 23, 2003, 02:42 AM
 
Originally posted by ppmax:
camelot: i know the war is wearing heavily on all of us, but was that really necessary? it's behavior like this that keeps me away from these forums: its so...petulant
I don't believe the war has any reflection on my position here. The answers were the same before the war as they are now, and they'll be the same next year when the war is a distant memory.

reply 1. i know sal frequents these forums; before i posted i searched for sal and most of the questions posed to him are indeed in the mac osx thread. please see:
http://forums.macnn.com/search.php?s...der=descending
since you've ostensibly participated on this board since 1999, you may remember that sal's origanal posts were to the mac osx board
I know Sal frequents these boards (as well as several other boards). My original comment was that the question was clearly more of a software question than a Mac OS X question. If you were specifically targetting Sal, the 'Coder's Corner" would have been a better target since that's where AppleScript-specific questions (and, I'm guessing) Sal are most likely to be found.

reply 2. im addressing the question to sal because in his position he may know why the props in iPhoto are r/o. considering his responsibilities this is not an unwarranted assumption--and--not unlikely
Actually, I find the concept that Sal (AppleScript Product Manager for Apple) knows the whys and wherefores of iPhoto's AppleScript implementation quite bizarre.
I'm sure Sal's got more than enough on his plate trying to get any kind of AppleScript support in Apple's own apps without knowing the intimate details of how each command and property is implemented.

reply 3. while we both have made assumptions about sal's skillset and awareness of applescript errata, i was merely asking a question, whereas you imply that he does not know the answer. im not clear why you choose to speak for sal...unless you are sal
No, I'm not Sal, and I don't believe I ever claimed I was. As stated above, I firmly believe the issue to be an iPhoto issue and not an AppleScript issue, per se. Addressing the question to the iPhoto product manager (if there is such a person) would seem more appropriate.

reply 4. while the essence of my question does indeed revolve around an iphoto applescript class prop, which in your view may not be "up sal's alley," please note that my assumption that sal does indeed know more than you credit him offers sal the opportunity to comment on any known workarounds or unpublished interfaces--which was clearly intent of my post
Sal could have answered anyway, but limiting the question to Sal could preclude others from answering the question. If anyone not called 'Sal' ignored the question, would JB have posted other discussions on the subject which might address the question?

reply 5. i can see no reason why you would suggest that this issue is a bug/defect. clearly the intended and observed behavior of the referenced read only property is consistent. this would indicate that the feature is working as designed--which i have acknowledged, but take issue with. thus this would be a feature request
You're absolutely right - the software is working as designed. The fact that the design itself is flawed is the problem. However, there's no other forum for officially reporting such issues to Apple other than the Bug Reporter.
As such, the Bug Reporter has options for "Feature (new)" and 'Enhancement", neither of which are "bugs", but are useful feedback to Apple as to what users are trying to do with their apps that they can't.

That said, my original response wasn't intented to be belligerent or demeaning. I simply asked why you addressed the question to Sal personally, rather than to the community in general (which includes Sal). I'm sorry you misinterpreted it that way.
Gods don't kill people - people with Gods kill people.
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 07:35 AM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2