As I moved all my photos away from Google Photos to my self-hosted Immich instance, I needed a possibility to delete all photos and albums from Google Photos.
To delete all photos, there is an API call available so you could write a script to do that. Or you can just use this Chrome plugin (works also in MS Edge).
However, there seems to be no possibility to batch delete all the remaining empty albums from Googel Photos. There is just no API call and therefore no possibility to script that.
As I did not want to manually delete, click by click, all my over 200 albums, I created a small, quick & dirty script for Autohotkey:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
#SingleInstance Force ; To get the desired screen position, use the Window Spy tool included with Autohotkey ; Move the mouse pointer to the wanted screen position and read the values for "Mouse Position -> Screen" Esc:: ExitApp Return ; Run as soon as F8 key is pressed F8:: Loop { ; End script if Esc key is pressed if GetKeyState("Esc", "P") break ; Replace XXX and YYY with the position for the Album menu MouseMove, XXX, YYY, 5 Sleep, 100 Click Sleep, 300 ; Replace XXX and YYY with the position for "Delete Album" menu item MouseMove, XXX, YYY, 5 Sleep, 100 Click Sleep, 500 ; Replace XXX and YYY with the position for the Confirmation message MouseMove, XXX, YYY, 5 Sleep, 100 Click Sleep, 1000 } Return |
Save this script to a file with extension “.ahk” and change the XXX and YYY place holders with the real screen position for the message boxes in Google Photos on your screen.
The you can just double click on the file to start the script, click on the browser window with Google Photos in the album view and press F8.
The script will then make the necessary clicks to delete the first album, waits 1 second until the screen has refreshed and then does the same with the next album.
If all albums have been deleted, you just press the “Esc” key to stop it.
There is no kind of error checking etc. It just clicks on the specified screen coordinates. If Google Photos is slow sometimes, it may fail and then you need to restart it. However I did not want to invest more time than I needed to do the manual clicks 🙂