• 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: Sat, 01 Aug 2015 10:07:55 +0200

Hello

We were unable to guess that the asker run El Capitan.

Here is a script doing the job under this new OS and under older ones.

I tried to borrow a piece of code to Christopher Stone but I discovered that it fails if there is no Safari window already open:
error "Erreur dans Safari : Il est impossible d’obtenir window 1. Index non valable." number -1719 from window 1


tell application "Safari"
activate
close every window
tell me to open location "http://www.google.com"
repeat # Wait until the window is really available
delay 0.1
if exists window 1 then exit repeat
end repeat
end tell

set sysVersion to (system attribute "sys2")

tell application "System Events" to tell process "Safari"
set frontmost to true
if sysVersion > 10 then
# Here running under El Capitan (10.11)
keystroke "f" using {command down, control down} # force full screen mode


repeat
tell me to delay 0.1
if enabled of menu item 1 of menu 1 of menu bar item 5 of menu bar 1 then exit repeat
end repeat


value of attribute "AXMenuItemMarkChar" of menu item 1 of menu 1 of menu bar item 5 of menu bar 1
if result is not missing value then
click menu item 1 of menu 1 of menu bar item 5 of menu bar 1
end if
else
# Here running Yosemite or older OS
if toolbar of window 1 is not {} then
click menu item 1 of menu 1 of menu bar item 5 of menu bar 1
end if


keystroke "f" using {command down, control down} # force full screen mode
end if
end tell


Yvan KOENIG running Yosemite 10.10.4 in French (VALLAURIS, France) samedi 1 aoqt 2015 10:07:45


 _______________________________________________
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: Open Safari in fullscreen and hide toolbar script
      • From: Deivy Petrescu <email@hidden>
    • Re: Open Safari in fullscreen and hide toolbar script
      • From: Christopher Stone <email@hidden>
  • Next by Date: Re: Open Safari in fullscreen and hide toolbar script
  • Next by thread: Re: Open Safari in fullscreen and hide toolbar script
  • Index(es):
    • Date
    • Thread