Re: Call tool from VBA

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



In article <towb-F2726D.20560614062007@xxxxxxxxxxxxx>,
Tobias Weber <towb@xxxxxxx> wrote:

In article <1181844995.940105.3310@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>,
"gimme_this_gimme_that@xxxxxxxxx" <gimme_this_gimme_that@xxxxxxxxx>
wrote:

Get Office 2004.

Finally something useful from you. Unfortunately I cannot afford both
2004 now and 2008 in a few months.

So maybe we can get back to the original question: how to use the
"Shell" VBA function on the Mac to call a unix program?

I came up with this monstrous hack:

In VBA (note the 2nd WorkPathUnix on the cmd line is a parm to the perl
script):


' For info on DoShellScript See
' http://developer.apple.com/technotes/tn2002/tn2065.html

' Note that the stderr redirection makes sure
' err messages from Perl get back to r
cmd = "set mySlug to do shell script ""/usr/bin/perl " & WorkpathUnix &
"plmain.pl " & WorkpathUnix & " 2>&1"""
rtn = MacScript(cmd)
If rtn <> "OK" Then
MsgBox ("Aborting: problem with perl script")
Exit Sub
End If


The script included this:

# DoShellScript goes nuts with a nonzero rc, which in turn
# screws up MacScript. Nice.
#

END {
exit 0;
}

#(other stuff)

die "workdir parm $workdir is not a directory" unless -d $workdir;

#(and at exit, of course:)

print "OK";
exit 0;

----

I hope that helped. Thanks to gimme_this_gimme_that for the
MacPerl::AppleScript --- wish I had known about that earlier.

PS You two should chill out -- you both sound pretty smart
(and freakin' uncivil)
.



Relevant Pages

  • Re: Is this possible in Perl?
    ... whatever perl does for the waiting user when it performs the exit ... process that started the Perl script. ... the process that started your script waiting for. ...
    (comp.lang.perl.misc)
  • Re: [PATCH 1/3] Replace kernel/timeconst.pl with kernel/timeconst.sh
    ... The new shell script ... it gave me different results than the perl version for 250 and 1000: ... +trap "rm $FILENAME" EXIT ...
    (Linux-Kernel)
  • perl out of memory?
    ... Given the script: ... When the command is executed as root 'perl -wc x.pl' all ... Callback called exit at x.pl line 3. ...
    (comp.unix.aix)
  • perl out of memory?
    ... Given the script: ... When the command is executed as root 'perl -wc x.pl' all ... Callback called exit at x.pl line 3. ...
    (comp.lang.perl.misc)
  • 2005-10-23 [de.comp.lang.perl.cgi] FAQ
    ... Programmiersprache Perl in CGI-Scripten. ... Wo gibt es Dokumentation über Perl und CGI? ... Hilfe zum Programm perldoc kann man mit 'perldoc perldoc' ... Mein Script läuft nicht bei meinem Provider. ...
    (de.comp.lang.perl.cgi)