Re: How to launch Finder with given directory from Carbon app
Re: How to launch Finder with given directory from Carbon app
- Subject: Re: How to launch Finder with given directory from Carbon app
- From: Philip Aker <email@hidden>
- Date: Fri, 13 Feb 2009 04:27:13 -0800
On 2009-02-12, at 00:52:43, Jean-Daniel Dupas wrote:
Using OSA calls to attain a result is just as viable as using LaunchServices because in every case it will call through to lower level systems services on your behalf. In fact, one can make the argument that with even a basic knowledge of AppleScript, one could use its functionality at the OSA level to attain a substantial percentage of system services an application would normally make with an economy of means not available in either Carbon or Cocoa.
And what if the user choose to open folder with something else than the Finder (Path Finder) ?
There used to be a low level variable one has to set in order to masquerade as Finder (or some other jiggery-pokery). If that's still the case, the AppleEvents would probably be redirected to the user's default Finder. But usually what happens in AppleScript (unlike AppleEvents) is if the application is not running, it will be activated with the 'tell' and perform the request.
However, since it's a good point you bring up, I should mention the recommendation is now to use System Events where it has duplicated Finder scripting. So it would be prudent in this case to:
set fold to (path to desktop folder from user domain) tell application "System Events" open fold end tell
It's like using OSA and Safari to open an URL. The user may have choosed something else than Safari as the default browser.
The 'open location' AppleScript call uses the default browser.
∎
§
Anyway, the point is that with a half-page of OSA code, there's a huge gain and it's just as "correct" as any other Apple technology.
Philip Aker echo email@hidden@nl | tr a-z@. p-za-o.@ Democracy: Two wolves and a sheep voting on lunch.
|
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden