• 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 15:10:12 +0200

Hello

As you know I'm curious so, I decided to compare Christopher scheme to the brute force one.

# brute force 

use framework "Foundation"

set beg to current application's NSDate's |date|()

tell application "Safari"
activate
close every window
make new document with properties {URL:"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 theDiff to (beg's timeIntervalSinceNow()) as real
tell application "SystemUIServer"
using terms from scripting additions
display dialog "effectué en : " & -theDiff & " secondes"
--> display dialog "effectué en : 0,209477007389 secondes"
end using terms from
end tell


# Christopher scheme

use framework "Foundation"

set beg to current application's NSDate's |date|()

set theURL to "http://www.google.com"

tell application "Safari"
try
set frontDoc to first window where its document is not missing value


tell frontDoc
set URL of its document to theURL
close (tabs whose index is not 1)
end tell


close (windows where it is not frontDoc)


on error
make new document with properties {URL:theURL}
end try


end tell

set theDiff to (beg's timeIntervalSinceNow()) as real
tell application "SystemUIServer"
using terms from scripting additions
display dialog "effectué en : " & -theDiff & " secondes"
--> display dialog "effectué en : 0,006065011024 secondes"
end using terms from
end tell

Honestly I didn't imagine that there may be such a difference ;-)

Other question asked by the curious.


When I ran the brute force script for the first time, I got :

tell application "SystemUIServer"
display dialog "effectué en : 0,209477007389 secondes"
«event ascrgdut»
display dialog "effectué en : 0,209477007389 secondes"
end tell

When I ran it again, I got :

tell application "SystemUIServer"
display dialog "effectué en : 0,209477007389 secondes"
end tell

I'm not sure if I already asked here : is the double call with «event ascrgdut» appear on systems running in English ?

If it doesn't I will file a bug report.


Yvan KOENIG running Yosemite 10.10.4 in French (VALLAURIS, France) samedi 1 août 2015








 _______________________________________________
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>
References: 
 >Re: Open Safari in fullscreen and hide toolbar script (From: Yvan KOENIG <email@hidden>)
 >Re: Open Safari in fullscreen and hide toolbar script (From: Christopher Stone <email@hidden>)
 >Re: Open Safari in fullscreen and hide toolbar script (From: Yvan KOENIG <email@hidden>)

  • Prev by Date: Re: Open Safari in fullscreen and hide toolbar script
  • Next by Date: Re: Open Safari in fullscreen and hide toolbar script
  • Previous by thread: 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