• 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: Getting iPhoto album ID with AppleScript
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Getting iPhoto album ID with AppleScript


  • Subject: Re: Getting iPhoto album ID with AppleScript
  • From: Philip Aker <email@hidden>
  • Date: Sat, 13 Oct 2007 05:43:06 -0700

On 2007-13-10, at 04:19, Nikita Zhuk wrote:

I'm developing an application which communicates with iPhoto via AppleScript. My application tracks some iPhoto albums by using their numeric album IDs, which are read from the AlbumData.xml file generated by iPhoto. A requirement of my application is to be able to change names of iPhoto albums by using their numeric album IDs. Since I don't see any way to say this directly in AppleScript (i.e. "set name of album with id 123 to 'TheNewName"), I use a loop where I loop through all iPhoto albums, check whether album's ID is the same integer as my id and set name of the found album.

Hi Nikita,

AlbumData.xml is just a property list. So theoretically, you could use System Events property list AppleScript, CFPropertyList (C language), or make a kludge with the 'defaults' shell tool.

Here's an example of a 3 way mapping that you might be able to make use of:

set f to ((path to pictures folder as text) & "iPhoto Library:AlbumData.xml")
set ppath to POSIX path of f

tell application "System Events"
set pfile to property list file ppath
set albums to property list item "List of Albums" of pfile
set total to {value} of every property list item of albums
set alist to item 1 of total
set res to {}
repeat with album in alist
set aname to |AlbumName| of album
set idnum to |AlbumId| of album
set end of res to {aname, idnum, idnum as integer}
end repeat
res
end tell


Philip Aker
email@hidden



 _______________________________________________
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: Getting iPhoto album ID with AppleScript
      • From: Nikita Zhuk <email@hidden>
References: 
 >Getting iPhoto album ID with AppleScript (From: Nikita Zhuk <email@hidden>)

  • Prev by Date: Re: Getting iPhoto album ID with AppleScript
  • Next by Date: Re: Getting iPhoto album ID with AppleScript
  • Previous by thread: Re: Getting iPhoto album ID with AppleScript
  • Next by thread: Re: Getting iPhoto album ID with AppleScript
  • Index(es):
    • Date
    • Thread