• 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
Desktop icons problem
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Desktop icons problem


  • Subject: Desktop icons problem
  • From: Brian Christmas <email@hidden>
  • Date: Wed, 21 Jan 2015 21:08:44 +1100

G’day all

I have written an Xcode icon positioning application that has a requirement to be able to ascertain if an icon selection is either 

a) a selection of icons on the desktop

or

b) a selection of icons in a desktop window.

At the moment I’m using (in part) the script below, but it has the annoying trait of flickering between the desktop and the application.

Does anyone know of a way of determining if selected desktop icons are either on the desktop or in a desktop window? Preferably without resorting to having to activate Accessibility access, and without altering focus from the application.

Running Yosemite, but would like it to work in Mountain Lion +.

Regards

Santa

on mainloop()
try
set p to 2
tell application "Finder"
if selection ≠ {} then
set my listLength to count of (selection as list)
else
set my listLength to 0
end if
set p to 3
if my listLength > 0 then
set my keepSelection to selection as alias list
— Check if desktop or desktop window active
  if (item 1 of keepSelection as text) contains "Desktop" then

# Typical 'alias "Brian's Disk:Users:OzSanta:Desktop:ftp Folder Setter.app”’, and same for desktop and window

  activate # activate Finder
 tell application "System Events" to tell process "Finder"
set my we_are_on_desktop to not enabled of menu item "Enter Full Screen" of menu 1 of menu bar item "View" of menu bar 1
end tell
tell me to activate # activate application
end if
set p to 4
if my we_are_on_desktop then
set my theWindow to desktop
set ttt to count of (get every item of desktop)
else
set p to 5
set my theWindow to window 1
set ttt to count of (get every item of my theWindow)
set p to 6
set my theWindow to Finder window 1
end if
set p to 7
set my listLength to count of my keepSelection
set p to 8
end if
end tell

< SCRIPT>

on error errmsg number errnum
tell application "System Events" to display dialog "MainLoop error " & errmsg & "  error number " & errnum & return & "p = " & p
end try
if not my setIconsIsRunning then performSelector_withObject_afterDelay_("mainLoop", missing value, 1)
end mainloop
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
applescriptobjc-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Prev by Date: Re: [ANN] ASObjC Explorer update
  • Next by Date: App Delegate binding not working.
  • Previous by thread: Re: [ANN] ASObjC Explorer update
  • Next by thread: App Delegate binding not working.
  • Index(es):
    • Date
    • Thread