Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Folder Action the Cocoa Way



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@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/pabloponsbordes% 40gmail.com


This email sent to email@hidden


_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden
References: 
 >Folder Action the Cocoa Way (From: Mark Butler <email@hidden>)
 >Re: Folder Action the Cocoa Way (From: Pablo Pons Bordes <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.