IPB

Bienvenue invité ( Connexion | Inscription )

> script erroné [màj : Editeur de script buggué], help de la part d'un profane
Options
MacEmbert
posté 5 Mar 2018, 11:38
Message #1


Macbidouilleur de vermeil !
****

Groupe : Membres
Messages : 910
Inscrit : 12 Oct 2004
Lieu : Liège.be
Membre no 25 088



Bonjour,

Je cherche à traiter des lots de photos sur Photos.app. J'ai trouvé ici un script adhoc.

Mais Automator refuse de l'exécuter au motif d'une erreur de syntaxe.
Ne connaissant pas l'Apple Script, je suis perdu. Pourriez-vous m'aider ?

Voici la description du script par son auteur :
It's an application what will batch change the title of selected photos to the following format:

EXIF Capture Date (System's Short Date)–Description–Padded Sequential Number

Voici le script :
Code
on run {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_digits to n_digits_text as number

  tell application "Photos"
  activate
  set counter to 1
  set imageSel to (get selection) -- get selected images
  if imageSel is {} then
  error "Please select some images."
  else
  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 string of capture_date
  -- set capture_time_string to the time string of capture_date

  set new_title to short_capture_date_string & "-" & input & "-" & ntext as text

  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


PS je suis sous Sierra, avec Automator 2.7 (2016)

Ce message a été modifié par MacEmbert - 5 Mar 2018, 17:18.


--------------------
Je ne croque pas que des pommes, j'aime aussi le Camembert.
iMac 2020, macOS Catalina
MacMini C2D 2020, macOS Monterey
iPad mini 2, iPad 6
iPhone XS
Go to the top of the page
 
+Quote Post
 
Start new topic
Réponse(s)
MacEmbert
posté 10 Mar 2018, 12:26
Message #2


Macbidouilleur de vermeil !
****

Groupe : Membres
Messages : 910
Inscrit : 12 Oct 2004
Lieu : Liège.be
Membre no 25 088



OK c'est clair
Merci


--------------------
Je ne croque pas que des pommes, j'aime aussi le Camembert.
iMac 2020, macOS Catalina
MacMini C2D 2020, macOS Monterey
iPad mini 2, iPad 6
iPhone XS
Go to the top of the page
 
+Quote Post

Les messages de ce sujet


Reply to this topicStart new topic
1 utilisateur(s) sur ce sujet (1 invité(s) et 0 utilisateur(s) anonyme(s))
0 membre(s) :

 



Nous sommes le : 29th March 2024 - 15:43