• 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: Opening Finder window from another app
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Opening Finder window from another app


  • Subject: Re: Opening Finder window from another app
  • From: p3consulting <email@hidden>
  • Date: Sat, 21 Jun 2003 10:45:35 +0200

> How can I open up a Finder window (particularly a selected directory)
> from another application? This would be a similar effect of most web
> browser download managers which have a Show in Finder.
>
> Chad Armstrong
> email@hidden
>

By sending an AppleScript to the Finder:

tell application "Finder"
open folder "Applications" of disk "XBoot"
end tell

How to send an AppleScript to the Finder?
AECreateDesc(typeChar, theCString_containing_the_script, itsLength,
&theScriptDesc)
OSACompileExecute(osaComponent, , &aScriptDesc, kOSANullScript,
kOSAModeNull, &theResultID)
etc
You can get the osaComponent with OpenDefaultComponent(
kOSAComponentType, kAppleScriptSubtype
If I remember correctly, you will have to link to add the Carbon
framework to your Cocoa project.

How to the construct the folder X of folder y of  of disk D string ?
By using
NSString
stringByExpandingTildeInPath and stringByResolvingSymlinksInPath, or
stringByStandardizingPath
componentsSeparatedByString
stringByDeletingLastPathComponent
etc
NSFileManager
fileAttributesAtPath: traverseLink:
fileExistsAtPath: isDirectory:
etc
and be careful of /Volumes/MyDisk/MyFolder -> folder "MyFolder" of
disk "MyDisk", every folder on the path should be visible, if not the
Finder returns an error

Pascal Pochet
P3 Consulting
email@hidden
http://www.p3-consulting.net
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Prev by Date: Re: scroll view & drop-n-drag
  • Next by Date: Re: Not a drawer but a ... ?
  • Previous by thread: Re: Opening Finder window from another app
  • Next by thread: crash in [NSDocument displayName]
  • Index(es):
    • Date
    • Thread