Want to highlight a helpful answer? Upvote!

Did someone help you, or did an answer or User Tip resolve your issue? Upvote by selecting the upvote arrow. Your feedback helps others! Learn more about when to upvote >

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Sorting Photos in Photos App musing AppleScript

I tried the scripts at: Re: Is there a way to sort photos by size? but got the error: Expected end of line, etc. but found identifier. Also, the word Button was highlighted. So I guess I'm not using the script as intended. So 2 questions:

  1. Can you explain why I got the error?
  2. Is there a repository of scripts for the Photos App?

MacBook, iOS 12.1

Posted on Oct 31, 2018 8:29 AM

Reply

Similar questions

6 replies

Oct 31, 2018 2:16 PM in response to ghozx

word "buttons" highlighted on the line...

"Enter the pixel size threshold for small photos: " buttons {"Cancel", "OK"} ¬

Perhaps there is an additional line break in the code.

The first lines of the script should look like this when pasted into the Script Editor window:User uploaded file

The forum software is reformatting the code we are pasting here.

Oct 31, 2018 2:22 PM in response to léonie

When the script runs, it will show this dialog and you enter a number for the minimum size of the photos.

User uploaded file


If you do not reply to this request, you will be seeing a timeout error message. Perhaps this dialog panel is hidden for you by another window, so you cannot press the o.k. button and you are getting a timeout error.

Oct 31, 2018 10:58 AM in response to ghozx

Which system version do you have installed?

I just tested this script (Script: Search for Photos by the Dimensions in Pixel Size) again on my Mac with macOS 10.14.1 Mojave and it is still working. But scripting has not been working well in Photos 1 on Yosemite and El Capitan.


To use the script, copy and paste the code into the Script Editor


The code starts with the line

(* How to use this script:

end the last line is

end tell


Select the photo in Photos that you want to split by size, then press the "run" button in the Script Editor toolbar.



To find more Apple Scripts for Photos have a look at this page: Thematic Index to Photos for Mac Related User Tips:

Oct 31, 2018 1:36 PM in response to léonie

I'm using MacOS Mojave Version 10.14.1 Beta 18B73a and Script Editor Version 2.11 (203) with AppleScript 2.7

I've copied and pasted your script from the link you gave and I still get the same error with the word "buttons" highlighted on the line...

"Enter the pixel size threshold for small photos: " buttons {"Cancel", "OK"} ¬

Does the script need to be saved with a special name in in a special location?

Nov 2, 2018 7:37 AM in response to léonie

So I solved the issue with the script. One line of code was split over 3 lines. I put the lines together and the script works very well indeed! Thanks millions.


The offending lines:

set dialogResult to display dialog ¬



"Enter the pixel size threshold for small photos: " buttons {"Cancel", "OK"} ¬



default answer (defaultSizeThreshold as text)


The fix:


set dialogResult to display dialog "Enter the pixel size threshold for small photos: " buttons {"Cancel", "OK"} default answer (defaultSizeThreshold as text)

Sorting Photos in Photos App musing AppleScript

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.