• 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: click using option down button 2 of window 1
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: click using option down button 2 of window 1


  • Subject: Re: click using option down button 2 of window 1
  • From: Yvan KOENIG <email@hidden>
  • Date: Sun, 26 Oct 2014 10:51:21 +0100


Le 25/10/2014 à 23:16, Robert Poland <email@hidden> a écrit :

Hi,

Now that Yosemite screwed with the green button, how do I "click" in Applescript using Option down?

TIA,

Robert Poland


Hello Robert

(1) the green button is not screwed. It does exactly what it is designed to achieve:
- activate full screen if it's clicked with no modifier
- maximize the window if it's clicked with option depressed.

System Events doesn't offer the ability to define a modifier when we click an item.
Happily, we may use ASObjC Runner

activate application "Finder"
tell application "System Events" to tell process "Finder"
tell window 1
set buttonPos to position of button 2
end tell
tell application "ASObjC Runner" to click button once at buttonPos holding down {option}
end tell
end



We may achieve the same goal without ASObjC Runner.
We just need to trigger the menu item dedicated to this task in the Windows menu.
In French it's named Réduire/agrandir
It's the second item displayed in the menu but its index is 3.

activate application "Finder"
delay 0.2 # delay required
tell application "System Events" to tell process "Finder"
tell menu bar 1 to tell menu bar item 7 to tell menu 1
# name of menu items
--> {"Placer dans le Dock", "Placer toutes les fenêtres dans le Dock", "Réduire/agrandir", "Réduire/agrandir toutes les fenêtres", "Faire défiler les fenêtres", missing value, "Afficher l’onglet précédent", "Afficher l’onglet suivant", "Afficher l’onglet précédent", "Afficher l’onglet suivant", "Afficher l’onglet précédent", "Afficher l’onglet suivant", "Placer l’onglet dans une nouvelle fenêtre", "Fusionner toutes les fenêtres", missing value, "Tout ramener au premier plan", missing value, "Mobile Applications"}
click menu item 3
--> menu item "Réduire/agrandir" of menu "Fenêtre" of menu bar item "Fenêtre" of menu bar 1 of application process "Finder" of application "System Events"
end tell
end tell

Of course, I guess that Shane will be able to give us a neater scheme triggering directly ASObjC in Yosemite.

Yvan KOENIG (VALLAURIS, France) dimanche 26 octobre 2014 10:51:13
 _______________________________________________
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: click using option down button 2 of window 1
      • From: Shane Stanley <email@hidden>
References: 
 >click using option down button 2 of window 1 (From: Robert Poland <email@hidden>)

  • Prev by Date: Re: Small change to script causes Script Editor to crash - Yosemite
  • Next by Date: Re: click using option down button 2 of window 1
  • Previous by thread: click using option down button 2 of window 1
  • Next by thread: Re: click using option down button 2 of window 1
  • Index(es):
    • Date
    • Thread