Skip navigation.
 
mlRe: Folder Action the Cocoa Way
FROM : Mark Butler
DATE : Sun Jun 25 20:06:51 2006

Thanks Pablo,

You were right NSAppleScript did the trick.



NSAppleScript *folderActionScript;
   
folderActionScript=[[NSAppleScript alloc] initWithSource:@"tell 
application \"System Events\" to attach action to 
\"Internal:private:tmp:TestFolder:\" using \"Internal:private:tmp:RGB-
Finder.scpt\""];
   
[folderActionScript executeAndReturnError:nil];



Works great. It is a little slow on the first execution.. Guessing 
that is because it has to compile the script first. Since the paths 
arent static I cant really per-compile the scripts.

Thanks again for your help..

Mark


On Jun 25, 2006, at 4:56 AM, Pablo Pons Bordes wrote:

> I don't know if there is any API to do this but if you are able to 
> do this by an apple script what you can do is execute the apple 
> script from the COCOA code with the "NSAppleScript" Class. I think 
> that it is the easy and fasted way if you know to do with apple script
>
>
> good luck
>
> Pablo Pons
>
> El 24/06/2006, a las 19:40, Mark Butler escribió:
>

>> First I am really new to this... So I guess I am beggin for a 
>> little slack. Maybe all I really need is pointers to the right 
>> documentation.
>>
>> Is there a way to attach a "folder action" to a directory with an 
>> objective c call... Or do I need to call an applescript to do that.
>>
>> I can attach a folder action by doing an applescript like
>> Tell application "System Events" to attach action to myFolder 
>> using myActionScriptFile
>>
>> Mark
>> _______________________________________________
>> Do not post admin requests to the list. They will be ignored.
>> Cocoa-dev mailing list      (<email_removed>)
>> Help/Unsubscribe/Update your Subscription:
>> http://lists.apple.com/mailman/options/cocoa-dev/pabloponsbordes%
>> 40gmail.com
>>
>> This email sent to <email_removed>

>

Related mailsAuthorDate
mlFolder Action the Cocoa Way Mark Butler Jun 24, 20:40
mlRe: Folder Action the Cocoa Way Alan Smith Jun 24, 21:03
mlRe: Folder Action the Cocoa Way Uli Kusterer Jun 25, 13:48
mlRe: Folder Action the Cocoa Way Pablo Pons Bordes Jun 25, 13:56
mlRe: Folder Action the Cocoa Way Mark Butler Jun 25, 20:06
mlRe: Folder Action the Cocoa Way John Stiles Jun 26, 01:05
mlRe: Folder Action the Cocoa Way Uli Kusterer Jun 26, 11:47
mlRe: Folder Action the Cocoa Way Uli Kusterer Jun 26, 11:59
mlRe: Folder Action the Cocoa Way John Stiles Jun 26, 16:48
mlRe: Folder Action the Cocoa Way Uli Kusterer Jun 26, 18:18
mlRe: Folder Action the Cocoa Way John Stiles Jun 26, 18:29