Je suis têtu.
Il suffit peut-être d'augmenter la valeur attribuée à delay afin de laisser du temps à Contacts pour s'ouvrir.
-- Début script
set p2Aux to ((path to desktop as text) & "4Contacts.app") as alias
set p2Contacts to ((path to applications folder as text) & "Contacts.app") as alias
tell application "Finder"
open p2Contacts
delay 1 -- ou plus >>>>>>>>>>>>>>
open p2Aux
end tell
-- fin script
ou mieux, avec une routine qui vérifie que Contacts est ouvert
-- Début script
set p2Aux to ((path to desktop as text) & "4Contacts.app") as alias
set p2Contacts to ((path to applications folder as text) & "Contacts.app") as alias
tell application "Finder"
open p2Contacts
my wait4Contacts()
open p2Aux
end tell
on wait4Contacts()
tell application "System Events"
repeat 50 times -- je suis pessimiste
set theProcesses to name of processes
if theProcesses contains "Contacts" then
set maybe to frontmost of process "Contacts"
if maybe then exit repeat -- Contacts est ouvert et au premier plan
exit repeat
delay 0.5
end if
end repeat
end tell
end wait4Contacts
-- fin script
Yvan KOENIG (VALLAURIS, France) mardi 7 janvier 2020 21:10:37
_______________________________________________
Applescript_fr mailing list
Applescript_fr@???
http://listes.patpro.net/mailman/listinfo/applescript_fr