• 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: arrange icons on desktop
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: arrange icons on desktop


  • Subject: Re: arrange icons on desktop
  • From: kai <email@hidden>
  • Date: Tue, 15 Nov 2005 03:56:05 +0000


On 15 Nov 2005, at 02:44, Dave Lyons wrote:

On Nov 14, 2005, at 1:29 PM, Rhon Fitzwater wrote:
I need a script to arrange the icons on my desktop.

tell application "Finder"
set arrangement of icon view options of window of alias myDesktop to arranged by kind
end tell


This method is not working for me. I am getting the following error: "Finder got an error "Can't make some data into the expected type. (-1700)"

There must be a couple of things going on here:

(1) I don't know why you're getting the -1700 error. Try breaking down your line into smaller parts. Does "alias myDesktop" work OK by itself? How about "window of alias myDesktop" and "icon view options of window of alias myDesktop"?

At a guess, I'd say that the variable 'myDesktop' might already be an alias (possibly created by the 'path to desktop command'). The 'alias myDesktop' would lead to an attempt to evaluate 'alias (alias "path:to:Desktop:")' - which would normally result in a coercion failure (error number -1700).


(2) ...but, it's not going to do what you want. You'll be able to set the arrangement used when your Desktop folder is displayed inside of a window in Icon view, but not the arrangement used on the actual desktop.

Since Finder scripting isn't up to this task, you'd have to resort to GUI Scripting <http://www.apple.com/applescript/uiscripting/ index.html>, and have your script select the desktop, choose View > Show View Options, check the "Keep arranged by" checkbox, and so on.

Perhaps something like this, then:

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

to |keep desktop arranged| by v
tell application "System Events" to tell process "Finder"
set frontmost to true
tell scroll area 1 to perform action "AXRaise"
tell (first window whose subrole is "AXFloatingWindow" and name is "Desktop")
if not (exists) then keystroke "j" using command down
tell checkbox "Keep arranged by"
if value is 0 then click
repeat while value is 0
delay 0.1
end repeat
end tell
tell pop up button 1 to if value is not v then
click
click menu item v of menu 1
end if
end tell
keystroke "j" using command down
end tell
end |keep desktop arranged|


|keep desktop arranged| by "Kind"

-- "Name"/"Date Modified"/"Date Created"/"Size"/"Kind"/"Label"

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

Note that, if you haven't already set the desktop's view options to 'Keep arranged by [whatever]', you could even perform a non-fixed arrangement - maybe like this:

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

to |arrange desktop| by v
	tell application "System Events" to tell process "Finder"
		set frontmost to true
		perform action "AXRaise" of scroll area 1
		click menu item v of menu "Arrange By" of ¬
			menu item "Arrange By" of menu "View" of ¬
			menu bar item "View" of menu bar 1
	end tell
end |arrange desktop|

|arrange desktop| by "Kind"

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

---
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: 
 >arrange icons on desktop (From: Rhon Fitzwater <email@hidden>)
 >Re: arrange icons on desktop (From: Dave Lyons <email@hidden>)

  • Prev by Date: Disabling Expose
  • Next by Date: Adobe InDesign placing text or picture box on a layer? Working code
  • Previous by thread: Re: arrange icons on desktop
  • Next by thread: Re: arrange icons on desktop
  • Index(es):
    • Date
    • Thread