tell application "Photos"
-- Get the selected photos
set selectedPhotos to selection
-- Initialize an empty list to store filenames
set filenameList to {}
-- Loop through the selected photos
repeat with aPhoto in selectedPhotos
-- Get the filename of each photo
set photoFilename to filename of aPhoto
-- Add the filename to the list
set end of filenameList to photoFilename
end repeat
-- Display the sorted list of filenames
set AppleScript's text item delimiters to linefeed
display dialog "Selected Photo Filenames:" default answer (filenameList as text)
end tell