• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: To refresh or update Apple Menu->Recent Items and...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: To refresh or update Apple Menu->Recent Items and...


  • Subject: Re: To refresh or update Apple Menu->Recent Items and...
  • From: "koenig.yvan" <email@hidden>
  • Date: Thu, 16 May 2013 15:15:23 +0200


Le 16/05/2013 à 12:22, Nick Rogers <email@hidden> a écrit :

Hi,

I am new to Apple Scripts.
I explored the Finder and System Events dictionaries in AppleScript Editor.
There seems the possibility, but since I'm new I don't know how to update the Apple Menu->Recent Items (basically to click the last item to Clear Menu).
Also I need to do Clear Menu in Finder's Go->Recent Folders menu.

The possibility I think exists is to perform click to Clear Menu.
OR If there is another direct novel way, please suggest.

Please help.

You may use this piece of code :

property finalCode : false

my activateGUIscripting()

# Trigger Clear Recent Items from Apple menu
if finalCode then
my selectSubMenu("Finder", 1, 9, -1)
else
my select_SubMenu("Finder", 1, 9, -1)
end if
# Trigger Clear Recent Folders from Go To menu
if finalCode then
# my selectSubMenu("Finder", 6, -3, -1)
else
my select_SubMenu("Finder", 6, -3, -1)
end if

#=====

on activateGUIscripting()
(* to be sure than GUI scripting will be active *)
tell application "System Events"
if not (UI elements enabled) then set (UI elements enabled) to true
end tell
end activateGUIscripting

#=====
(*
==== Uses GUIscripting ====
*)
on selectSubMenu(theApp, mt, mi, ms)


activate application theApp
tell application "System Events" to tell application process theApp to 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 selectSubMenu

#=====
(*
==== Uses GUIscripting ====
*)
on select_SubMenu(theApp, mt, mi, ms)


activate application theApp
tell application "System Events" to tell process theApp to tell menu bar 1
get name of menu bar items
(*{
01 - "Apple", 
02 - "Finder", 
03 - "Fichier", 
04 - "Édition", 
05 - "Présentation", 
06 - "Aller", 
07 - "Fenêtre", 
08 - "Aide"}
*)
get name of menu bar item mt
-- {"Apple"}
tell menu bar item mt to tell menu 1
get name of menu items
(* {01 - "À propos de ce Mac", 
02 - "Informations système…", 
03 - "Mise à jour de logiciels…", 
04 - "App Store…", 
05 - missing value, 
06 - "Préférences Système…", 
07 - "Dock", 
08 - missing value, 
09 - "Éléments récents" 
10 - missing value, 
11 - "Forcer à quitter…", 
12 - "Forcer à quitter Finder", 
13 - missing value, 
14 - "Suspendre l’activité", 
15 - "Redémarrer…", 
16 - "Redémarrer", 
17 - "Éteindre…", 
18 - "Éteindre", 
19 - missing value, 
20 - "Fermer la session WXYZ…", 
21 - "Fermer la session WXY"}
*)
get name of menu item mi
--"Éléments récents"
tell menu item mi to tell menu 1
get name of menu items
(* {
1 - "Applications", 
2 - 

-2 - missing value, 
-1 - "Effacer le menu"}
*)
get name of menu item ms
-- "Effacer le menu"
--click menu item ms
end tell -- menu item…


end tell -- menu bar…


end tell -- System Events
end select_SubMenu

#=====

KOENIG Yvan (VALLAURIS, France) jeudi 16 mai 2013 15:15:19

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

  • Follow-Ups:
    • Re: To refresh or update Apple Menu->Recent Items and...
      • From: Nick Rogers <email@hidden>
References: 
 >To refresh or update Apple Menu->Recent Items and... (From: Nick Rogers <email@hidden>)

  • Prev by Date: To refresh or update Apple Menu->Recent Items and...
  • Next by Date: InDesign Separations
  • Previous by thread: To refresh or update Apple Menu->Recent Items and...
  • Next by thread: Re: To refresh or update Apple Menu->Recent Items and...
  • Index(es):
    • Date
    • Thread