• 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: get size of available screen fails
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: get size of available screen fails


  • Subject: Re: get size of available screen fails
  • From: kai <email@hidden>
  • Date: Wed, 4 Jan 2006 04:40:50 +0000


On 4 Jan 2006, at 01:31, Robert Poland wrote:

For some reason the following seems to have quit working, It generates an error, "Can't set text item delimiters to "<key>Width</ key>". It has been working for ages. No recent changes that I remember. I have tried restarting Smile and re-launching the Finder.

Any Ideas?

Tia,

-- get size of available screen
set l to {}
set p to read file ((path to "pref" from local domain as Unicode text) & "com.apple.windowserver.plist")
repeat with v in {"Width", "Height"}
set text item delimiters to "<key>" & v & "</key>"
set l's end to middle word of paragraph 2 of p's text item 2 as integer
end repeat
set text item delimiters to {""}
set topLimit to 44 -- top edge
set leftLimit to 1 -- left edge
set rightLimit to (text item 1 of l) as number -- actual size of screen
set bottomLimit to (text item 2 of l) as number -- actual size of screen

For some reason, parts of that look slightly familiar, Bob. :-)

Yeah - things have moved on a bit, and the file structure has changed. Best we move along with it, I suppose...

How about something like this?

-------------------

set p to POSIX path of (path to preferences from local domain) & "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 leftLimit to 1 -- left edge
set topLimit to 44 -- top edge
set rightLimit to (value of property list item "Width") div 1
set bottomLimit to (value of property list item "Height") div 1
end tell


-------------------

Or, if you fancy a one-liner:

-------------------

tell application "Finder" to tell (get bounds of desktop's window) to set ¬
{leftLimit, topLimit, rightLimit, bottomLimit} to {1, 44, item 3, item 4}


-------------------

---
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
  • Follow-Ups:
    • Re: get size of available screen fails
      • From: Martin Orpen <email@hidden>
References: 
 >get size of available screen fails (From: Robert Poland <email@hidden>)

  • Prev by Date: Re: How do I delete the 1st three characters from a variable
  • Next by Date: Re: How do I delete the 1st three characters from a variable
  • Previous by thread: Re: get size of available screen fails
  • Next by thread: Re: get size of available screen fails
  • Index(es):
    • Date
    • Thread