• 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 list of desktops?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Get list of desktops?


  • Subject: Re: Get list of desktops?
  • From: 2551 <email@hidden>
  • Date: Fri, 19 Jul 2013 16:18:16 +0700


On 19 Jul 2013, at 13:42, Brian Christmas <email@hidden> wrote:
I haven't followed this thread, but this will get you the properties of the desktops.

tell application "System Events"
set temp to id of every desktop as list
repeat with x from 1 to count of temp
set tempID to item x of temp as integer
get the properties of desktop id (tempID)
end repeat
end tell
_______________________________________________

Well, there's an interesting thing. This didn't work on my machine with an external display, returning an error. I tried it several times. A little later, I decided to see if it'd work without only one display, which it did. Now here's the magic part: when I plugged in the external monitor again, it now worked with both!!

One thing worth mentioning here, though: if you look at the 'Result', you'll only see one set of properties (the result of more than one record with the same properties will do that to you). To see the properties for both (or more) displays, you need to look in the 'Replies' panel. 


BTW, in playing around with this, I ended up with a routine that returns the value of any property. Try altering the values of i and j (explanation in the script). It's a long winded way of doing what you could do in a couple of lines if you already knew what you're looking for, but it could be adapted to get info from a user. 




on _getProps(theList, someProperty)
get item someProperty of theList
end _getProps

tell application "System Events"
set nn to count of every desktop
set n to 1
set x to {} as list
repeat while n is less than or equal to nn


set x to x & properties of desktop n as list
set n to n + 1
end repeat
end tell


(*
Play with different setting for i below between 1 and 10, where

1 = display name; 2=id; 3= changer interval; 4= name; 5=picture; 6=class; 7=filepath; 8=tranlucentmenubar; 9= random order; 10=picture rotation
*)

set i to 3 -- get user choice in  display dialog or choose from list?

(*
play with different setting for j below where 1 is desktop 1, 2 is desktop 2 etc
*)
set j to 1 -- 1 is Desktop or Display 1, 2 is Display 2, etc

---------------------
if j is greater than nn then
display dialog "You don't have " & j & " displays connected!"
else if j = 1 then
set i to i
else
set i to i + ((j - 1) * 10)
end if
set p to i
_getProps(x, p)








Best

Phil
http://applehelpwriter.com







 _______________________________________________
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: 
 >Fwd: Get list of desktops? (From: "koenig.yvan" <email@hidden>)
 >Re: Get list of desktops? (From: Alex Zavatone <email@hidden>)
 >Re: Get list of desktops? (From: "koenig.yvan" <email@hidden>)
 >Re: Get list of desktops? (From: Alex Zavatone <email@hidden>)
 >Re: Get list of desktops? (From: Alex Zavatone <email@hidden>)
 >Re: Get list of desktops? (From: Brian Christmas <email@hidden>)

  • Prev by Date: Re: Get list of desktops?
  • Next by Date: Rép: Get list of desktops?
  • Previous by thread: Re: Get list of desktops?
  • Next by thread: Re: Get list of desktops?
  • Index(es):
    • Date
    • Thread