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

[MacPerl] HELP!!!(appleevent+processess =kill?)



Hi,

i m trying to make a "kill-em-all" script,
i ve found some source in the TIL (apple) but i should make some
mistakes.....

here is my code, the goal is to kill all the app unless macperl and the
finder (by the way, why some kills the finder ?)

sub test1
{
	$a = GetCurrentProcess;
	while (($psn, $pi) = each %Process)
	{
		print $psn."\n";
  		print " processname      $pi->{processName} \n";
  		print " processnumber    $pi->{processNumber} \n";
		print " processtype      $pi->{processType} \n";
  		print " processsignature $pi->{processSignature} \n";
  		print " processsize      $pi->{processSize} \n";
		print " processmode      $pi->{processMode} \n";
		 # print " processlocation  $pi->{processLocation} \n";
		 # print " processlauncher  $pi->{processLauncher} \n";
		 # print " processlaunchdate $pi->{processLaunchDate} \n";
		 # print " processactivetime $pi->{processActiveTime} \n";
		 # print " processappspec   $pi->{processAppSpec} \n";
 	if ((($pi->{processName} eq "Finder")&&($pi->{processType} eq
"FNDR"))||($pi->{processNumber} == $a))
  	{
		print "\t\t\t NOT DESTROY \n";
	}
  	else
   	{				
    	$desc = AECreateDesc(typeProcessSerialNumber,$psn);	
	$event =
AECreateAppleEvent(kCoreEventClass,kAEQuitApplication,$desc,kAutoGenerateReturnID,kAnyTransactionID);
	AEDisposeDesc($desc);
	AESend($event, nil,kAENoReply + kAEAlwaysInteract + kAECanSwitchLayer,
kAENormalPriority,kAEDefaultTimeout);
	AEDisposeDesc($event);
	}
	}
}

many thanks in advance

-- 

Laurent BARDI Ingenieur Systemes & Reseaux 
Centre National de la Recherche Scientifique
INSTITUT  de PHARMACOLOGIE et de BIOLOGIE STRUCTURALE
Tel : 05-61-17-59-47             http://www.ipbs.fr/
Fax : 05-61-17-59-94             lolo@ipbs.fr
CNRS-IPBS 205 Route de Narbonne 31400 TOULOUSE FRANCE 

///////////////////////////////////////////////////////////////////////////
/ There is worse than to have not succeded
:                              /
/ Not to have  tried
!                                                    /
///////////////////////////////////////////////////////////////////////////

If it stinks, it's chemistry. If it moves, it's biology.
If it does not work, It's computer science.

Linux the choice of a GNU generation

***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch