Hi there,
I know not much is being done with Photos yet, but I want to write Apple script to remove all photos from a specific Album. Example Album name is Test.
Remove all photos from “Test”
Possible?
Hi there,
I know not much is being done with Photos yet, but I want to write Apple script to remove all photos from a specific Album. Example Album name is Test.
Remove all photos from “Test”
Possible?
Hi,
Interesting question. They don’t seem to have a delete mechanism. Hmm.
Edited: or even a move (like to the trash).
Later,
kel
I got an idea. What if you create a new album with the same name and replace the other album. Would that work?
Here’s the one:
That’s probably it!
gl,
kel
So, it would go something like this:
remove every item from (a reference to the album).
In the case you’re wondering how I found that was to look in the dictionary of Photos.
gl and happy scripting,
kel
Tell me if that was it. Otherwise, there might be a little more to it.
Edited: you never know.
Edited: the reason why I say this is I don’t have much time. I would have to create a new album and test on that. But, I’m washing clothes! and hopefully can rest after that.
gl,
kel
Hi Poleary,
Did you get it to work?
Now I have some time and was thinking about trying out the ‘remove’ with the filter reference form. The part I didn’t like was removing every photo from an album. So, I have to crate a whole new small album and didn’t have time.
I’ll show you a good example if I can think of one.
Edited: btw, not sure but it read like you knew about AppleScript so I was very vague.
Later,
kel
Ok, what I was thinking is that say you have an album selected. So, what you want to do is remove every photo from that album. The selection doesn’t seem to cover albums. so, you need to somehow get your script to select an album.
I got it! You choose the album from the list or another way way might be to select a photo from an album and from there get the album. I kind of like the idea of selecting an album to delete items. Sounds good to me.
Edited: Ooo, It’s a little bit trickey. Nice puzzle.
Later,
kel
I’m starting to think that the best way to do this is to go back to the original idea of deleting the album and creating a new album. Interesting though. What if I just wanted to delete every photo but the last one.
Darn, I can’t find the remove command. It must have been from iPhoto. Ok, damn it. Gotta get serious here…
Ok, think I found the secret. This reminds me of Mail when ti first came out. It seems the programmers don’t know about AppleScript very much.
I got it! Why the hell did they use container instead of album? Crazy man.
Darn, I remember now. Had to delete it from the database. Darn! That’s why I was asking how to delete items from the database. I think. Yeah, I think that was it. I remember something about sqlite or something like that.
The way Apple has it now, you can’t even hack your own computer!
Darn, I think you have to resort to uielement scripting to get rid of the photos. It’s too bad because all you would actually need to do is delete it from the database, if.
gl,
kel
In the olden days you might find that database and make changes, but now days you might just as well wait and perhaps send in some feedback to Apple.
gl,
kel
Here’s as far as I got and then you need to search trough the database I think:
tell application "Photos"
set the_album to first container whose name is "TestAlbum1"
every media item of the_album
end tell
From there you need to find the database and modify it. And then you don;t know if that will even work I think.
gl,
kel
Hi there,
THANK YOU so much for your help. I wasn’t able to test it yet. Prior to your help, I got fed up with the speed of Photos on OS X. It was choking on my 60k picture library. I literally couldn’t do anything without it giving me the beachball of death.
I will definitely save this and use / try it out once I test it again under OS X El Capitain.
Thanks again, and sorry for the delay responding!
Hi poleary,
Actually, there is no solution as I remember. Maybe in the future there might be one.
gl,
kel