• 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: Scripting Finder window column widths
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Scripting Finder window column widths


  • Subject: Re: Scripting Finder window column widths
  • From: kai <email@hidden>
  • Date: Mon, 31 Jul 2006 00:01:09 +0100


On 29 Jul 2006, at 06:09, Gnarlodious wrote:

On 7/28/06, Laine Lee <email@hidden> wrote:
On 6/21/06 3:10 PM, "Gnarlodious"  wrote:

> set desktopWidth to (word 3 of (do shell script "defaults read
> /Library/Preferences/com.apple.windowserver | grep -w " & "Width")) as
> number
> set desktopHeight to (word 3 of (do shell script "defaults read
> /Library/Preferences/com.apple.windowserver | grep -w " & "Height"))
> as number


Depending on your system version, you might have better results if you
change this part to use the construct submitted by Kai a couple of days ago:


tell (do shell script "/usr/sbin/system_profiler SPDisplaysDataType | grep
Resolution") to set {wd, ht} to {word 2 as number, word 4 as number}
set screenz to result
set desktopWidth to (item 1 of screenz)
set desktopHeight to (item 2 of screenz)

Result is the same, but my method seems significantly faster.

Yes, your method is up to 2.3 times faster here, Gnarlie - although, if speed was a concern, the same information could be extracted up to 5 times faster again with something like:


--------

set p to (path to preferences from local domain as Unicode text) & "com.apple.windowserver.plist"
tell application "System Events" to tell property list item 1 of property list item 1 of ¬
property list item "DisplaySets" of property list file p
set w to (value of property list item "Width") div 1
set h to (value of property list item "Height") div 1
end tell


--------

However, there are issues with getting this type of information in such a way. The com.apple.windowserver.plist file contains a list of the currently supported resolutions - and either of the above methods just selects the first instances of width and height that occur. In addition, if an unsupported resolution happens to be selected, the file may still reflect the resolutions from a previous setting. There's also some further cautionary info here:

http://lists.apple.com/archives/applescript-users/2006/Jul/msg00107.html
http://lists.apple.com/archives/applescript-users/2006/Jul/msg00108.html

Another, even faster approach (20-40+ times faster than using defaults) might be something like:

--------

tell application "Finder" to items 3 thru 4 of (get bounds of desktop's window)

--------

(A degree of circumspection may be advisable here, too - since Finder returns a composite value for more than one monitor.)

But you can actually say one line:

tell (do shell script "/usr/sbin/system_profiler SPDisplaysDataType |
grep Resolution") to {word 2 as number, word 4 as number}

--> {1200, 1920}

Quite - as indeed the original did:

http://lists.apple.com/archives/applescript-users/2006/Jul/msg00230.html

:-)

---
kai


_______________________________________________ Do not post admin requests to the list. They will be ignored. Applescript-users mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >Re: Scripting Finder window column widths (From: Laine Lee <email@hidden>)
 >Re: Scripting Finder window column widths (From: Gnarlodious <email@hidden>)

  • Prev by Date: Re: Add prices with taxes in quark
  • Next by Date: Re: get selected text of message in Mail?
  • Previous by thread: Re: Scripting Finder window column widths
  • Next by thread: Script Editor dictionary for QuarkXpress 6.5
  • Index(es):
    • Date
    • Thread