Wednesday, August 16, 2017

#1 2017-08-02 02:34:47 am

daBee
Member
Registered: 2010-02-09
Posts: 76

Choose iTunes Menu Item

I already have the playlist selected in itunes.  I want to choose File:Library:Show Duplicate Items

I know this is a "System Events" tell, but not sure how to do it.  Any advice appreciated.

Cheers


Filed under: iTunes, select menu

Offline

 

#2 2017-08-02 03:38:03 am

Yvan Koenig
Member
Registered: 2006-09-14
Posts: 3182

Re: Choose iTunes Menu Item

You may try :

Applescript:

# Long instruction used to get the indexes
my select_SubMenu("iTunes", 3, 12, 10) # Fichier > Bibliothèque > Afficher les doublons

# short instruction to use in real life because it's faster
my selectSubMenu("iTunes", 3, 12, 10)



on selectSubMenu(theApp, mt, mi, ms) # Fichier > Bibliothèque > Afficher les doublons
   activate application theApp
   tell application "System Events" to tell process theApp
       set frontmost to true
       tell menu bar 1 to tell menu bar item mt to ¬
           tell menu 1 to tell menu item mi to tell menu 1 to click menu item ms
   end tell
end selectSubMenu

#=====
(*
useful to get the indexs of the triggered item
my select_SubMenu("iTunes", 3, 12, 10) # Fichier > Bibliothèque > Afficher les doublons
*)

on select_SubMenu(theApp, mt, mi, ms)
   activate application theApp
   tell application "System Events" to tell process theApp
       set frontmost to true
       tell menu bar 1
           get name of menu bar items
           (*{
01 - "Apple",
02 - "iTunes",
03 - "Fichier",
04 - "Édition",
05 - "Morceau",
06 - "Présentation",
07 - "Commandes",
08 - "Compte",
09 - "Fenêtre",
10 - "Aide"
}*)

           get name of menu bar item mt
           -- {"Fichier"}
           tell menu bar item mt to tell menu 1
               get name of menu items
               (* {
               01 - "Nouvelle playlist",
02 - "Nouvelle playlist à partir de la sélection",
03 - Nouvelle playlist intelligente…,
04 - "Nouveau dossier de playlist",
05 - "Nouvelle playlist Genius",
06 - missing value,
07 - "Modifier la playlist",
08 - "Fermer la fenêtre",
09 - missing value,
10 - "Ajouter à la bibliothèque…",
11 - "Graver la playlist sur un disque",
12 - "Bibliothèque",
13 - "Appareils",
14 - "Partage à domicile",
15 - missing value,
16 - "Ouvrir le flux…",
17 - "S’abonner au podcast…",
18 - missing value,
19 - "Afficher dans le Finder",
20 - "Convertir",
21 - missing value,
22 - "Format d’impression…",
23 - "Imprimer…"
}*)

               get name of menu item mi
               --"Bibliothèque"
               
               tell menu item mi to tell menu 1
                   get name of menu items
                   (* {
01 - "Mettre à jour la bibliothèque musicale iCloud",
02 - "Actualiser Genius",
03 - missing value,
04 - "Organiser la bibliothèque…",
05 - "Consolider les fichiers…",
06 - "Exporter la bibliothèque…" ,
07 - missing value,
08 - "Importer la playlist…",
09 - "Exporter la playlist…",
10 - "Afficher les doublons",
11 - "Afficher les éléments en double",
12 - missing value,
13 - "Obtenir les illustrations d’album",
14 - "Obtenir les noms de piste"
}*)

                   get name of menu item ms
                   -- "Afficher les doublons"
                   click menu item ms
               end tell -- menu item…
           end tell
       end tell -- menu bar…
   end tell -- System Events
end select_SubMenu

#=====
my select_SubMenu("iTunes", 3, 12, 10) # Fichier > Bibliothèque > Afficher les doublons

Yvan KOENIG running Sierra 10.12.6 in French (VALLAURIS, France) mercredi 2 aout 2017 10:37:35

Offline

 

#3 2017-08-03 12:22:04 pm

daBee
Member
Registered: 2010-02-09
Posts: 76

Re: Choose iTunes Menu Item

Hi Yvan.  Thanks for the reply.

I'm not trying to get Applescript to do anything more than just choose a menu item.  That's all I want. 

File
   Library
       Show Duplicate Items

Cheers


Filed under: iTunes, select menu

Offline

 

#4 2017-08-03 12:42:32 pm

Yvan Koenig
Member
Registered: 2006-09-14
Posts: 3182

Re: Choose iTunes Menu Item

Doing what you ask requires a lot of instructions.
It's what my script does.
You may test it to check.

Yvan KOENIG running Sierra 10.12.6 in French (VALLAURIS, France) jeudi 3 aout 2017 19:41:25

Offline

 

#5 2017-08-08 07:24:45 am

daBee
Member
Registered: 2010-02-09
Posts: 76

Re: Choose iTunes Menu Item

Excellent.  I took the time to walk through it and saw most of it was comments.  I see how it works now. 

Cheers

Offline

 

#6 2017-08-08 07:28:32 am

Yvan Koenig
Member
Registered: 2006-09-14
Posts: 3182

Re: Choose iTunes Menu Item

I assumed that my message was clear. select_SubMenu is the "long" version useful to define the indexes to use. selectSubMenu is the compact version to use in real life.

Yvan KOENIG running Sierra 10.12.6 in French (VALLAURIS, France) mardi 8 aout 2017 14:28:26

Offline

 

#7 2017-08-08 08:57:03 pm

squigee90
Member
Registered: 2017-03-26
Posts: 26

Re: Choose iTunes Menu Item

Hi Yvan, did you get my private message?

Offline

 

#8 2017-08-09 04:18:49 am

Yvan Koenig
Member
Registered: 2006-09-14
Posts: 3182

Re: Choose iTunes Menu Item

No, at this time 2017/08/09 11:15:20 I received nothing.
Maybe your message was delivered in my spam box where I may have missed it.
The best way is to use : k o e n i g . y v a n @ s f r . f r  (without the space characters).

Yvan KOENIG running Sierra 10.12.6 in French (VALLAURIS, France) mercredi 9 aout 2017 11:18:22

Offline

 

#9 2017-08-09 07:04:29 am

Yvan Koenig
Member
Registered: 2006-09-14
Posts: 3182

Re: Choose iTunes Menu Item

Oops, I didn't knew the way personal messages behave in this list.
Happily Nigel Garvey explained me off list.
I will try to retrieve the original thread to see if I may help you.

Yvan KOENIG running Sierra 10.12.6 in French (VALLAURIS, France) mercredi 9 aout 2017 14:04:25

Offline

 

#10 2017-08-09 07:41:58 am

Yvan Koenig
Member
Registered: 2006-09-14
Posts: 3182

Re: Choose iTunes Menu Item

I retrieved the original thread.lease send me a mail using the address given in message #8 so that we may exchange - possibly with attached files - easily.
I need some complementary explanations.

Yvan KOENIG running Sierra 10.12.6 in French (VALLAURIS, France) mercredi 9 aout 2017 14:41:15

Offline

 

#11 2017-08-12 01:37:35 am

squigee90
Member
Registered: 2017-03-26
Posts: 26

Re: Choose iTunes Menu Item

Hi Yvan, did you receive my email??

Offline

 

Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)