[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

[MacPerl] Re: what about "system()" and backticks?



To me, it seems like the best way to do this would be using either just
plain Applescript, or MacPerl/AppleEvents.

Your program would need to accept an event -- perhaps "convert", or if it
_only_ does this, and doesn't need to know anything about where to save
stuff (ie, there are defaults), an "open" event.  On receiving this
event, it would convert the file and save it as appropriate.

Then, either using Applescript, or using Chris Nandor's
Mac::AppleEvents::Simple (I think is what it's called), you could have
the user select a "root" directory, and simply call the application for
every file in the tree below this root.

Actually, this shouldn't be so hard to implement in C either -- have your
friend return to you a starting point, then traverse the file system
below that...

At any rate, the best way I can think of to pass the equivalent of
command line parameters to the program would be via AppleEvents.

Hope this helps,
Ricky Morse


On Tue, Dec 19, 2000, at 1:56 PM, David Graff <graff@unagi.cis.upenn.edu>
wrote:

>I wrote a command-line-oriented C program that works on wintel and unix -- a 
>basic file-filter for converting a specialized audio file format
(involving a 
>specialized form of audio compression) to the more widely accessible "riff" 
>(aka "wav") format (without compression).  The CLI is pretty simple, just  
>input and output file names, plus a couple of option flags.
>
>I'm not a mac programmer or user, so a very concientious mac person has
given 
>me valuable help in porting this application to macs; but we both recognize 
>that there is a problem.  Sometimes, users may be confronted with literally 
>thousands of files that need conversion (e.g. on a set of cdroms that I send 
>them), and it's just not possible to do this manually, one file at a time.  
>(Doing it manually just one directory at a time would not be much
>better.)  On 
>wintel/unix, it's no problem -- a simple perl script will do all the
>files you 
>want, and you just need to start it once to do it all.  But with a mac... ?
>
>My mac friend says it will take him a long time to get a decent solution
>using 
>just C to add the right kind of interface to my program, and he probably
>won't 
>have that much time to work on it.  (He did provide a compromise, doing a 
>directory at a time, but...)
>
>I think MacPerl could make this pretty simple (I could do it myself!) -- IF 
>it's possible to invoke this C program from a MacPerl script, or somehow
make 
>the C code runnable as an extension to the script.  The "current"(?) FAQ
page 
>(July, 1999) says nothing about "system()", and not much about backticks
(and 
>it's not encouraging).
>
>I don't mind having a mac version of the app that's a completely
>different set 
>of code from the wintel/unix app -- just so long as I can maintain it
and get 
>the same functionality on all three platforms (and I don't require 
>non-programmer mac users to install MPW on their machines).
>
>Does anyone have relevant examples they could share, or helpful advice or 
>pointers to better detail than the faq?  (Or, if anyone has suggestions
about 
>an appropriate way to "think different"... (;^)  -- Well, of course I have 
>thought about making the cdroms with wav files in the first place, but
>really, 
>I'm afraid this is not an option.)
>
>Thanks,
>	Dave Graff

-----
Pukku

# ===== Want to unsubscribe from this list?
# ===== Send mail with body "unsubscribe" to macperl-request@macperl.org