In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] (Allan) wrote:
> i like to know how to close a program like Internet Explorer from perl. > the little script below seem to work for me, but i guess there must be > a cleaner and more correct way. Many have suggested AppleScript. A pox upon their houses! Use Mac::Carbon. I don't use MSIE, so I do it here with Mozilla. #!perl -wl use POSIX 'SIGTERM'; use Mac::Processes; while (my($psn, $psi) = each %Process) { next unless $psi->processName eq 'Mozilla'; # 'Internet Explorer' ? kill SIGTERM, GetProcessPID($psn); last; } $psn (and $psi->processNumber) contain the Mac OS "process serial number". GetProcessPID, new to Mac::Carbon 0.02, maps that to a POSIX PID. Then kill SIGTERM, well, kills it. Mac::Carbon 0.02 is available on the CPAN, and on http://sf.net/projects/macperl/ (where there is also a binary installer, for those of you who have trouble building it, such as those on 10.1.x systems). -- Chris Nandor [EMAIL PROTECTED] http://pudge.net/ Open Source Development Network [EMAIL PROTECTED] http://osdn.com/