• 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
Can't Remove Photos from iPhoto Slideshow using AppleScript / Scripting Bridge
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Can't Remove Photos from iPhoto Slideshow using AppleScript / Scripting Bridge


  • Subject: Can't Remove Photos from iPhoto Slideshow using AppleScript / Scripting Bridge
  • From: Dalmazio Brisinda <email@hidden>
  • Date: Fri, 21 Nov 2008 14:30:11 -0600

Hello,

I'm having trouble removing a series of images from a slideshow album in iPhoto using both AppleScript and Scripting Bridge. I decided that Scripting Bridge is much easier to use, so I will focus on it. But if you have a solution in either metaphor that would be great.

What I've done is just create a static array of image names that I then loop through and remove those images in the slideshow album that have the same name/title as those images within the array. But it looks like when I remove the image from the slideshow album it only ever removes the first currently selected image. Nothing else is removed, and the following error is spat to the console:

2008-11-21 04:22:19.859 MyScriptBridge[2792:813] Apple event returned an error.  Event = 'iPho'\'isal'{ '----':'obj '{ 'want':'ipmr', 'from':'obj '{ 'want':'ipal', 'from':'null'(), 'form':'name', 'seld':'utxt'("Jury66_Proj1 Slideshow") }, 'form':'name', 'seld':'utxt'("000002.jpg") } }
Error info = {
    ErrorNumber = -1728;
    ErrorOffendingObject = <IPhotoPhoto @0x192440: IPhotoPhoto "000002.jpg" of IPhotoAlbum "Jury66_Proj1 Slideshow" of application "iPhoto" (146)>;
}

Here's some sample code:

- (id) init;
{
[super init];
iPhoto = [SBApplication applicationWithBundleIdentifier:@"com.apple.iPhoto"];
return self;
}

- (void) removeSlideshowImages:(id)sender;
{
NSMutableArray *xmlPhotoTitles = [[NSMutableArray alloc] initWithObjects:
@"000001.jpg", @"000002.jpg", @"000003.jpg", @"000004.jpg", @"000005.jpg", nil];
[iPhoto activate];
SBElementArray *albums = [iPhoto albums];
iPhotoAlbum *slideshowAlbum = [albums objectWithName:@"Jury66_Proj1 Slideshow"];
[slideshowAlbum select];

SBElementArray *albumPhotos = [slideshowAlbum photos];
for (NSString *photoTitle in xmlPhotoTitles) {
iPhotoPhoto *photo = (iPhotoPhoto *)[albumPhotos objectWithName:photoTitle];
[photo select];
[photo removeFrom:albumPhotos];
}
[xmlPhotoTitles release];
}

It almost looks like removing the image causes references to be shuffled around, causing the program to dereference a non-existent object. 

BTW, I have all 5 images in the slideshow described in the xmlPhotoTitles array. 

Does anyone know how to get around this?

Best,
dalmazio
 _______________________________________________
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

  • Prev by Date: Re: Puzzle (Results)
  • Next by Date: Re: A puzzle
  • Previous by thread: Re: Puzzle (Results)
  • Next by thread: Re: Can't Remove Photos from iPhoto Slideshow using AppleScript / Scripting Bridge
  • Index(es):
    • Date
    • Thread