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: Integrating Unix scripting in Cocoa app




On 10/08/2007, at 7:03 AM, Nir Soffer wrote:


On Aug 9, 2007, at 11:54, Ron Fleckner wrote:

You can combine your easy to use way, #! line and file extension to make everyone happy:

1. If the script has app meta data saved in your app - use it

meta-data-app path/to/script

What do you mean by 'meta-data' in this case? (Remember, I'm not lazy, just...)



Imagine that you provide an "Add Script" menu item. When selected, you provide a simple editor, with a popup menu for script type (python, perl, bash, applescript...). The user type the script and close the window. You store the text and the type. When running, you load the text and run it with the selected app.


That simple editor may be too simple for general scripting, but maybe just enough for simple scripts. The user does not have to deal with file names, extensions, executable bits etc.


Best Regards,

Nir Soffer


and


On 10/08/2007, at 7:05 AM, Nir Soffer wrote:


On Aug 9, 2007, at 12:06, Ron Fleckner wrote:
Marcel, thanks very much for the code snippets. Finding out if the file is executable was a stumbling block for me. I don't know why I didn't see that NSFileManager method. I haven't had any time for coding over the last few days so all the replies my original question got are waiting for me to mull over them and then decide on a path forwards.

It this open source project? If you have a good idea and you open it, others will help.



Best Regards,

Nir Soffer



Hi Nir,

I really just wanted to make a 'black box' drop-in class that one could simply add to a Cocoa project which would add a script menu when told to and then run the (Apple)Scripts which it would find wherever it was told to find them. Support for Unix scripting such as Perl, Python, Ruby and the various shells was suggested by 'has' of appscript fame. I've tried to implement it and it works but isn't bullet proof. I'm not sure that I'm up to making it so. It works fine, I think, as an AppleScript menu manager/script runner.

If you're interested in having a look at the current state of the project, here's a link to a demo app/project which contains the menu manager class:
<http://members.ozemail.com.au/~ronfleckner/ASScriptMenuManagerDemo.zip>


I don't really want to bother with making the class handle things like providing a script editor to the host app or anything like that. I think the class would get too big. I'm not actually writing an app with this as a drop-in. I did make my app AppleScriptable, but the relatively small AppleScript dictionary wouldn't justify a dedicated Scripts menu. However it did inspire me to attempt to make this class.

If you do have a look at it, I'd be interested in your comments. It's fairly rough and not really in a finished state.

Ron Fleckner




_______________________________________________

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:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden
References: 
 >Re: Integrating Unix scripting in Cocoa app (From: Kevin Kuehl <email@hidden>)
 >Re: Integrating Unix scripting in Cocoa app (From: Nir Soffer <email@hidden>)
 >Re: Integrating Unix scripting in Cocoa app (From: Ron Fleckner <email@hidden>)
 >Re: Integrating Unix scripting in Cocoa app (From: Nir Soffer <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.