claes@canit.se (Claes Bjorklund) writes: }Hi } }I am a beginner in Macperl. My project now is to run an application from a }cgi-script, my problem is when I am running the application in the script }the script stops before the application is finish }Have try with the commant 'wait' but macperl doesn't accept }I am very glad if someone can help me }The script is below It's because you're using AppleScript to run the program, and AppleScript cares or doesn't care that something is "finished" based on obscure (to me) reasons, although I bet an expert in AppleEvents can explain it. You've got two not very thrilling choices. Put a sleep($n); just before your open() statement, where $n contains the number of seconds it's likely to take for your SPSS run to complete. Or do the same thing inside the AppleScript with one of the OSAXen that can wait. I don't know if any of the OSAX do anything more than putting the processor in a tight loop, though, so the Perl solution is probably better. } }Regards } }\Claes } }#!perl }print "Content-type: text/html\n\n"; } }$test='HD850:Pub:test2.sps'; }$out='HD850:Pub:test2.sps Output'; } } } Get the input } read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); } } Split the name-value pairs } @pairs = split(/&/, $buffer); } } foreach $pair (@pairs) { } ($name, $value) = split(/=/, $pair); } } $value =~ tr/+/ /; } $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; } } $FORM{$name} = $value; } } } }$synt=$FORM{'synta'}; } } } }open(SYNTAX,">$test"); }print SYNTAX "$synt"; }close(SYNTAX); } } } } } }MacPerl::DoAppleScript(<<END_SCRIPT); }tell application "Finder" } activate } select file "test2.sps" of folder "Pub" of startup disk } open selection using file "SPSS Production Mode" of folder "SPSS }6.1" of folder "Program" of startup disk }end tell }END_SCRIPT } } }open(INPUT,"$out") || die "error in perl"; }print "<html><title>SPSS Results</title>\n"; }print "<pre>\n"; }print <INPUT>; }print "</pre></html>\n"; } }close(INPUT); } }-------------------------------------------------- }Claes Bjšrklund http://www.canit.se/~claes }claes@canit.se finger claes@uno.canit.se }-------------------------------------------------- } } } }***** Want to unsubscribe from this list? }***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch --- Paul J. Schinder NASA Goddard Space Flight Center Code 693, Greenbelt, MD 20771 schinder@pjstoaster.pg.md.us ***** Want to unsubscribe from this list? ***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch