After struggling with iPhoto in AppleScript for a while (and all
of a sudden realizing that a photo's date property is a string,
not a date object), I had to come back to Perl and DateTime. I 
need to shift the times on thousands of images by a certain offset.
Amazingly, Batch Change can't add an offset to every image timestamp
(do the iPhoto developers ever even use digital cameras?).

I think I'm missing something about setting properties though.
I can read things fine, but I get an error when I try to set
a property: "'Mac::AEObjDesc=HASH(0xb03f00)' parameter not available".

Where's my error?

   #!/usr/bin/perl
   use strict;
   use warnings;
   
   use Mac::Glue qw(:all);
   
   my $iPhoto = Mac::Glue->new( "iPhoto" );
   
   my $album = $iPhoto->prop( "current_album" );
   my $name  = $album->prop( "name" )->get;
   
   my $photos = $album->prop( "photos" );
   my $count  = $photos->count;
   print( qq|Found $count photos in "$name"\n| );
   
   my $photo = $album->obj( photo => 1 );
   my $title = $photo->prop( "title" )->get;
   print( qq|title is "$title"\n| );
   
   my $date  = $photo->prop( "date" )->get;
   print( qq|date is "$date"\n| );
      
   $photo->set( date => to => "2004-06-13 12:34:56" );
   # $photo->prop( 'date' )->set( ... ) ?
   __END__
   
   Found 5 photos in "Album"
   title is "7/24/01 14:21"
   date is "2001:07:24 14:21:57"
   'Mac::AEObjDesc=HASH(0xb03f00)' parameter not available at
/usr/local/lib/perl5/site_perl/5.8.4/Mac/Glue.pm line 1579

-- 
brian d foy, [EMAIL PROTECTED]

Reply via email to