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


Question: syntax problem in script "batch change title"


I tested this script (from Léonie and Old Toad)

User uploaded file

It seems that it has there a problem of syntax in script. Is it possible ?

I am lost.

onrun {input, parameters}

-- batch change the title to the input, © léonie, version 1.0.1

set n_digits to 2 -- how many digits for the appended number

set answer to display dialog "Select the number of digits for the appended numbers (0 .. 10). Selecting '0' will suppress the leading zeros." buttons {"o.k"} default answer n_digits

set n_digits_text to the (text returned of answer)

set n_digitston_digits_textasnumber

tell application "Photos"


set counter to 1

set imageSel to (get selection) -- get selected images

if imageSel is {} then

error "Please select some images."


repeat with next_image in imageSel

-- the counter with padded numbers

set ntext to the counter as text

repeat while (the length of ntext < n_digits) -- add leading zeros

set ntext to "0" & ntext

end repeat

-- retrive the date

set capture_date to (the date of next_image)

set short_capture_date_string to the short date stringofcapture_date

-- set capture_time_string to the time string of capture_date

set new_titletoshort_capture_date_string & "-" & input & "-" & ntextastext

tell next_image

set the name to new_title as text

set counter to counter + 1

end tell

end repeat

-- return new_title

end if

end tell

return input

end run

Sierra 10.12.6

Photos 2.0

iMac, null

Posted on


Mar 5, 2018 10:19 AM in response to 8enoit In response to 8enoit

Which iMac model do you have? Which version of MacOS X is running on the iMac?

I have tested the scrips on my MacBook Pro and my iMac (27inch, Late 2013) with macOS 10.13.3.

There it is working.

it can not edit or execute scripts.

Does Script Editor not launch at all? Is it giving an error message?

Mar 5, 2018 10:19 AM

Reply Helpful
User profile for user: 8enoit

Question: syntax problem in script "batch change title"