At 11:27 am -0500 29/01/01, Steve Rothman wrote:
>Sorry for what I'm positive is a dopey question, but I'm a rank
>beginner at Perl in general and MacPerl in particular. I *have*
>spent literally hours going through the archives of this list and
>the MacPerl documentation trying to help myself, and I see fragments
>of answers but nothing that has yet worked for me...
>
>I am using a wonderful Perl script called MHonArc 2.5 -- in fact
>this is the same script that is used to create the MacPerl archives
>on the web.
>
>(For info: http://www.nacs.uci.edu/indiv/ehood/MHonArc/doc/mhonarc.html )
>
>My procedure for using MHonarc on my Mac is this:
>
> * Start MacPerl (5.2.0r4)
>
> * I do Command-R to run a script, then I select the MHonArc script
>
> * I get a prompt for a command line, then I type:
> mailboxname -outdir :outputpath -rcfile resourcefile.rsc -add
>
>This works great, and MHonArc speedily creates a set of web pages
>for me based on my Eudora mailbox.
>
>My problem is that I can't figure out how to automate it, and I'll
>need to do it once a day. On a unix system one would just type
>something on the shell like:
>
> # mhonarc mailboxname -outdir :outputpath -rcfile
>resourcefile.rsc -add
>
>And so it would be really easy to make a shellscript to do this.
>
>I've tried writing an AppleScript, and I can launch MacPerl and
>MHonArc from AppleScript just fine, but I can't figure out how to
>simulate typing in the command line. (There are a ton of posts on
>this topic in the MacPerl list archives, with many different
>solutions to this issue, but none of the solutions seem to work for
>me.)
>
>In any event, it seems a little silly to use AppleScript for this -
>but I don't even know how to get started to write a simple MacPerl
>script that will start up another existing script and feed it the
>correct command line options.
You could perhaps write a script something like this:
#!perl
# Put an alias to 'mhonarc' in the folder 'lib'
chdir("path:to:MHonArc2.4.7:lib");
@ARGV = ("path:to:System Folder:Eudora Folder:Mail Folder:In");
require "mhonarc";
When you run this script it will in turn run the script 'mhonarc'
with the parameters in '@ARGV'.
However when 'mhonarc' finds out that the OS is MacOS it will put up
an 'Ask Dialog' asking for the command line parameters. You don't
want this since the command line parameters are already stuffed into
'@ARGV'. To suppress the call alter line 66 of file 'mahamain' to
read:
require 'osinit.pl'; &OSinit(1);
------------------------------^
(There must be a more elegant way to do this but for the moment I
can't see it.)
Other options can be pushed into @ARGV in the usual way e.g.:
@ARGV = ('help');
or @ARGV = ('-add', 'path:to:mail');
and so on.
I'm not sure how automatic you want to make the whole thing, but it
might be appropriate to save the script above as a droplet. A double
click would then launch MacPerl (if it's not already running) and
create the web pages.
I hope this helps towards what you want to do.
Alan Fry