• 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: Programmatically adding to one big Finder selection ?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Programmatically adding to one big Finder selection ?


  • Subject: Re: Programmatically adding to one big Finder selection ?
  • From: André Berg <email@hidden>
  • Date: Wed, 01 Jul 2009 10:35:18 +0200

Hi David,

Thanks for replying :)

Actually I am coming from a v0.1 version of my program, was trying to implement this with AppleScript Studio.
The Finder's dictionary has a "select" command but it appears that this command does nothing more than to
call said NSWorkspace method. The behaviour of executing the "select" command/method in a loop,
with the same set of path strings, once using pure Cocoa and once using pure AppleScript is exactly the same.
It will open a new Finder window for every path string entry in the array.


It *is* possible to supply the whole AppleScript list (AppleScript list = NSArray) to the Finder's select command
(if you convert the POSIX path-style strings in the list to file URLs via "POSIX file") and the "select" command is
smart enough to make a selection of all items in the frontmost window ...
... but only for the current folder level.


The problem with expanded subfolders in list view remains. Any paths that point to files with expanded subfolders
will spawn a new Finder window each. I am currently experimenting with looping through the subfolders, issueing
a NSAppleScript script that passes a list of POSIX files representing each subfolder's contents every cycle of the loop,
but it looks like it's not keeping the selection in the parent folder if I go to target a subfolder in the next loop cycle...


Thanks for the pointer to the AE docs. Until now I have always been shying away from reading those as raw AppleEvents
are still confusing the heck out of me. Seems there's no excuse left now .... unless there's some other way?



Cheers

André

--- Original Nachricht ---
Absender: Dave Keck
Datum: 01.07.2009 7:20 Uhr
I'd imagine the easiest way to do this is using an AppleScript, which
can be embedded in your app using the NSAppleScript class.

But I've got a whole lot of PTSD towards AppleScript, so if it were
me, I would deal with the AppeEvents directly, much as it's done here:

http://developer.apple.com/documentation/Applescript/Conceptual/AppleEvents/create_send_aepg/create_send_aepg.html

David

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Programmatically adding to one big Finder selection ?
      • From: André Berg <email@hidden>
  • Prev by Date: Re: Drawing the background of a single row in NSTableView
  • Next by Date: Re: Window not displaying
  • Previous by thread: Re: Drawing the background of a single row in NSTableView
  • Next by thread: Re: Programmatically adding to one big Finder selection ?
  • Index(es):
    • Date
    • Thread