• 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: Open Safari in fullscreen and hide toolbar script
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Open Safari in fullscreen and hide toolbar script


  • Subject: Re: Open Safari in fullscreen and hide toolbar script
  • From: Yvan KOENIG <email@hidden>
  • Date: Fri, 31 Jul 2015 16:54:30 +0200


Le 31/07/2015 à 16:07, Ball, Dan <email@hidden> a écrit :

Hello all,

Hoping someone can help me!   I had this applescript application running on 10.7.x fine and upgraded it to 10.10 and it won’t run anymore.  I added the app to the security pane and still has issues.  I’m wondering if its the code.  At the end it complains that it can’t find window 1 of group 2.  Is there a better way to write this?  I tried a few things, but at a loss.


delay 10


tell application "Safari"

activate

closeeverywindow

open location "http://www.google.com"

end tell


delay 2


tell application "System Events"

tellapplication process "Safari"

try

clickmenu item "Enter Full Screen" of menu 1 of menu bar item "View" of menu bar 1

end try

end tell

end tell


delay 2


tell application "System Events"

tellapplication process "Safari"

try

clickmenu item "Hide Toolbar" of menu 1 of menu bar item "View" of menu bar 1

end try

end tell

end tell


delay 3


(*

tell application "System Events"

tell application process "Safari"

perform action "AXShowMenu" of toolbar 1 of group 2 of window 1

key code 125

keystroke return

end tell

end tell

*)


tell application "System Events"

activateapplication "Safari"

tell application "System Events"

performaction "AXShowMenu" of toolbar 1 of group 2 of window 1

key code 125

keystrokereturn

end tell

end tell


Hello

(1) It's fair to post clean code, not code in which about ten space characters are missing !

(2) My understanding is that you read wrongly the error message. This one is :

error "Erreur dans System Events : Il est impossible d’obtenir toolbar 1 of group 2 of window 1 of process \"Safari\". Index non valable." number -1719 from toolbar 1 of group 2 of window 1 of process "Safari"

The script correctly see the group 2 of window 1, it warns you that it doesn't see a toolbar in this group.

It's logical because there is no such item in this group.

I ran this edited version (so that it can be used on my system running in French.
As you may see in the late comment, the group 2 contain only a tab and a group.

If you explain exactly what you are trying to achieve it would be easier to try to help you.

--delay 10


tell application "Safari"


activate


close every window


open location "http://www.google.com"


end tell


--delay 2


tell application "System Events"


tell process "Safari"
set frontmost to true
try


--click menu item "Enter Full Screen" of menu 1 of menu bar item "View" of menu bar 1
keystroke "f" using {command down, control down}


end try


end tell


end tell


delay 2


tell application "System Events"


tell process "Safari"
set frontmost to true
try


--click menu item "Hide Toolbar" of menu 1 of menu bar item "View" of menu bar 1
click menu item 1 of menu 1 of menu bar item 5 of menu bar 1
end try


end tell


end tell


-- delay 3



tell application "System Events"
tell process "Safari"
set frontmost to true


class of every UI element of window 1
log result --> (*group, group*)
position of group 2 of window 1
log result --> (*0, 0*)
class of UI elements of group 2 of window 1
log result --> (*tab, group*)


perform action "AXShowMenu" of toolbar 1 of group 2 of window 1


key code 125


keystroke return


end tell
end tell




Yvan KOENIG running Yosemite 10.10.4 in French (VALLAURIS, France) vendredi 31 juillet 2015 16:54:25







 _______________________________________________
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

References: 
 >Open Safari in fullscreen and hide toolbar script (From: "Ball, Dan" <email@hidden>)

  • Prev by Date: Open Safari in fullscreen and hide toolbar script
  • Next by Date: Re: Open Safari in fullscreen and hide toolbar script
  • Previous by thread: Open Safari in fullscreen and hide toolbar script
  • Next by thread: Re: Open Safari in fullscreen and hide toolbar script
  • Index(es):
    • Date
    • Thread