Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: scripting safari and menu items




Le 13 févr. 2005 , à 13:40, Christian Vinaa a écrit :

i seem to be lost in a never maze of problems

first i wanted script safari
basically just save the front document

tell application "Safari"
	activate
	open location "http://webcam.aet.ch/traffico/airolo_n.jpg";
save  blabla
end tell


that didnt work

so i tried   menu and menu items

	--tell application "System Events"
	--	tell process "Safari"
	--select menu item 7 of menu 3 of menu bar 1
	--	end tell
	--end tell


Perhaps this may help:

property theApp : "Safari"
property useSubMenu : false

tell application theApp
	activate
	tell application "System Events"
		tell process theApp
			tell menu bar 1
				--set aa to get name of every menu bar item
				(*
				 {"Apple", "Safari", "Fichier", "Édition", ¬
				 "Présentation", "Historique", "Signets", ¬
				 "Fenêtre", "Aide"}
				 *)
				set nmbi to (name of menu bar item 3) as text (* 3 = "Fichier" *)
				
				tell menu bar item nmbi --"Apple"
					tell menu nmbi --"Apple"
						--set bb to name of every menu item
						(*
						{"Nouvelle fenêtre", "Ouvrir un fichier...", ¬
						"Ouvrir une adresse...", "-", ¬
						"Fermer", "Fermer toutes les fenêtres", ¬
						"Enregistrer sous...", "-", ¬
						"Format d'impression...", "Imprimer..."}
						*)
						
						if useSubMenu is false then
							set nmi to (name of menu item 7) as text
							click menu item nmi
						else		
							tell menu item nmi --"Location"
								tell menu nmi --"Location"
									-- set cc to get name of every menu item
									(*
									{"Automatic", "Configuration (06/11/2004 18:22)",
									missing value, "Préférences de Réseau..."}
									*)
									set nsmi to (name of menu item 1) as text
									click menu item nsmi --"Automatic" --location name
								end tell -- menu nsmi
							end tell -- menu item nsmi
						end if -- useSubMenu
						
					end tell -- menu nmbi
				end tell --menu bar item nmbi
			end tell -- menu bar 1
		end tell -- process theApp
	end tell -- application System Events
end tell -- application theApp


Yvan KOENIG

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

This email sent to email@hidden
References: 
 >Re: numbers and prefix zero (From: Paul Richardson <email@hidden>)
 >scripting safari and menu items (From: Christian Vinaa <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.