• 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
Scripting Bridge and Finder selection
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Scripting Bridge and Finder selection


  • Subject: Scripting Bridge and Finder selection
  • From: Jjgod Jiang <email@hidden>
  • Date: Wed, 2 Jan 2008 07:05:07 +0800 (CST)

Hi,

How do I get the currently selected file in Finder via Scripting Bridge
in Python? In Applescript, we have code like this:

  tell application "Finder"
    if selection is {} then
      set finderSelection to folder of the front window as string
    else
      set finderSelection to selection as alias list
    end if
  end tell

but in Python, I tried

  from ScriptingBridge import *

finder = SBApplication.applicationWithBundleIdentifier_("com.apple.Finder")
selection = finder.selection()


however, selection is just a SBObject, which I couldn't get it's
real path, so how do I get it?

- Jiang
_______________________________________________

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


  • Prev by Date: Re: NSOutlineView, NSTreeController and itemForPersistentObject...
  • Next by Date: Re: NSOutlineView, NSTreeController and itemForPersistentObject...
  • Previous by thread: Re: NSOutlineView, NSTreeController and itemForPersistentObject...
  • Next by thread: Re: Scripting Bridge and Finder selection
  • Index(es):
    • Date
    • Thread