Indem Du ein anderes Skript aus derselben Quelle verwendest:

https://discussions.apple.com/docs/DOC-12211

Show Plain Text
  1. (*
  2. https://discussions.apple.com/docs/DOC-12211
  3.  
  4. The Photos.app does not allow us to sort albums by the file size of the items ins an album.  But an AppleScript can read the file size of a media item in Photos and create albums based on the file size.
  5.  
  6. If you want to find files, that are too large or to small among a set of media items in Photos, select the videos or photos you want to check for their size and run the script below.
  7. It will ask for a file size threshold - you could enter 512 kB, for example, then run the script.  It will create two albums, one with the items smaller or equal than 512kB, one with the items larger than 512kB. Now you can select easily the items that are too small or too large in one of the albums.
  8.  
  9.  
  10. How to use this script:
  11.  
  12. This script will split the selection into two albums -
  13. - one album with pictures or videos larger than the given file size threshold
  14. - one album with pictures  or videos smaller  than the given file size threshold
  15.  
  16. Open this script in Script Editor. Launch Photos.
  17. Select the photos and videos you want to distribute between the albums.
  18.  
  19. When all all photo are selected, press the "Run" button in Script Editor.
  20.  
  21. Author: léonie
  22. *)
  23.  
  24. --the file size threshold in kB
  25. set defaultFileSizeThreshold to 10240 -- 10 MB,  change this to the file  size threshold  you want for a photo to be counted as small
  26.  
  27. set dialogResult to display dialog ¬
  28.   "Enter the file size threshold for small photos or videos in kB : " buttons {"Cancel", "OK"} ¬
  29.   default answer (defaultFileSizeThreshold as text)
  30. set FileSizeThresholdkB to (text returned of dialogResult) as integer -- file size in kB
  31. set FileSizeThreshold to FileSizeThresholdkB * 1024 -- file size in Byte
  32.  
  33.  
  34. set smallAlbumName to "smallerThan" & FileSizeThresholdkB -- the album to collect the small photos
  35.  
  36. set largeAlbumName to "largerThan" & FileSizeThresholdkB -- the album to collect the larger photos
  37.  
  38. tell application "Photos"
  39.   activate
  40.   -- Ensure that the albums do exist
  41.   try
  42.     set imageSel to (get selection)
  43.   on error errTexttwo number errNumtwo
  44.     display dialog "Cannot get the selection: " & errNumtwo & return & errTexttwo
  45.   end try
  46.   -- return the size of the first item of imageSel
  47.  
  48.   try
  49.     if not (exists container smallAlbumName) then
  50.       make new album named smallAlbumName
  51.     end if
  52.     set theSmallAlbum to container smallAlbumName
  53.    
  54.     if not (exists container largeAlbumName) then
  55.       make new album named largeAlbumName
  56.     end if
  57.     set theLargeAlbum to container largeAlbumName
  58.    
  59.     if not (exists container "SkippedPhotos") then
  60.       make new album named "SkippedPhotos"
  61.     end if
  62.     set theSkippedAlbum to container "SkippedPhotos"
  63.    
  64.    
  65.   on error errTexttwo number errNumtwo
  66.     display dialog "Cannot open albums: " & errNumtwo & return & errTexttwo
  67.   end try
  68.  
  69.   -- process the selected photos from the All Photos album
  70.  
  71.   set smallPhotos to {} -- the list of small photos
  72.   set largePhotos to {} -- the list of larger photos
  73.   set skippedPhotos to {} -- the list of skipped  photos
  74.  
  75.  
  76.   -- check, if the album or the selected photos do contain images
  77.  
  78.   if imageSel is {} then
  79.     error "Please select some images."
  80.   else
  81.     repeat with im in imageSel
  82.       try
  83.        
  84.         tell im --get the file size
  85.           set s to its size
  86.         end tell
  87.       on error errText number errNum
  88.         display dialog "Error: " & errNum & return & errText & "Trying again"
  89.         try
  90.           delay 2
  91.           tell im
  92.             set s to its size
  93.            
  94.           end tell
  95.         on error errTexttwo number errNumtwo
  96.           display dialog "Skipping image due to repeated error: " & errNumtwo & return & errTexttwo
  97.         end try
  98.        
  99.       end try
  100.       set noSize to (s is missing value)
  101.       if noSize then
  102.         set skippedPhotos to {im} & skippedPhotos
  103.       else
  104.         if (s ≤ FileSizeThreshold) then
  105.           set smallPhotos to {im} & smallPhotos
  106.         else
  107.           set largePhotos to {im} & largePhotos
  108.          
  109.         end if
  110.       end if
  111.      
  112.     end repeat
  113.    
  114.     add smallPhotos to theSmallAlbum
  115.     add largePhotos to theLargeAlbum
  116.     add skippedPhotos to theSkippedAlbum
  117.    
  118.     return "small photos: " & (length of smallPhotos) & ", larger photos : " & (length of largePhotos) & ", skipped: " & (length of skippedPhotos)
  119.    
  120.   end if
  121.  
  122. end tell
  123.  
  124.  
  125. (*
  126. This user tip was generated from the following discussion: How do I sort videos by length of time or by file size?
  127. https://discussions.apple.com/thread/7220031
  128. *)
----------
macOS 10.4, 10.14, 10.15, 11, 12, 13 sowie iOS 12, 15 und 17