AppleScript to Remove All Images Except First Image

This script automates the removal of all images except for the first image of individual or multiple selected listings.

Its purpose is to help reduce the number of images to minimize the overall size of the GarageSale library, while still maintaining a single reference image in case you want to duplicate a listing in the future for a similar item.

tell application "GarageSale"

repeat with theListing in (get selected ebay listings)
	-- Check if the listing has more than one image
	
	if (count of listing images of theListing) > 1 then
		-- Get the list of images for the current listing
		
		set theImages to listing images of theListing
		-- Start removing images from the second one onwards
		
		repeat with i from 2 to (count of theImages)
			set imageToRemove to item i of theImages
			tell theListing
				-- Remove the image
				
				remove listing image image imageToRemove
				
			end tell
		end repeat
	end if
end repeat
end tell
1 Like

I use the following Applescript saved an app in the desktop to make the first image the gallery image.

All my items have have their photos numbered to show the order in which they should appear within a listing so the first image is always the first image.

Manually selecting the gallery image for each listing wastes times. Since I also move very fast manually selecting the first images has the nasty habit of popping up the image edit window.

So instead I use this script on groups on otherwise completed listings.

I use the application NameChanger to bulk change the names of picture files to a sequence of numbers.

tell application "GarageSale 9.8.1"
	repeat with theListing in (get selected ebay listings)
		set imageAsGalleryImage to the first item of listing images of theListing
		tell theListing
			set is gallery image of imageAsGalleryImage to true
		end tell
	end repeat
end tell