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

[MacPerl] Help with AppleEvents



Hi all!

I'm working on writing a module to script Eudora Light, but am facing some
problems with constructing the appropriate AppleEvents.

I tested the following AppleScript

	tell application "Eudora Light 3.1.1"
		count each mailbox of mail folder ""
	end tell

and used "Capture AE", which reported

Process("Eudora Light 3.1.1").SendAE "core,cnte,'----':obj {form:name,
want:type(euMF), seld:'TEXT'(), from:'null'()}, kocl:type(euMB)"

On my system, this code reports "24".

Using this, I constructed the following

	my %ae = (
		target => 'CSOm',
		class => 'core',
		id => 'cnte',
		params => ["'----':obj{want:type(euMF), " .
			"from:null(), form:enum(name), seld:TEXT(\@)}",
			"kocl:type(euMB)"
			]
		);
	my $event = AEBuildAppleEvent (
		$ae{'class'}, $ae{'id'}, 'sign', $ae{'target'}, 0, 0,
		@{$ae{'params'}}
		) || die $^E;
	my $reply = AESend ($event, kAEWaitReply) || die $^E;
	print "Event = ", AEPrint ($event), "\n";
	print "Reply = ", AEPrint ($reply), "\n";
	AEDisposeDesc ($event);
	AEDisposeDesc ($reply);

Upon execution, MacPerl reports

Event = core\cnte{'----':obj {want:type(euMF), from:'null'(),
	form:name, seld:"kocl:type(euMB)"}, &inte:cans, &timo:3600}
Reply = aevt\ansr{errn:-1701}

Capture AE reports

Process("Eudora Light 3.1.1").SendAE "core,cnte,'----':obj
{want:type(euMF), from:'null'(), form:name, seld:"kocl:type(euMB)"}"

Two questions:
	1) Why are the AEs reported by AppleScript and MacPerl different
(see the "seld" part)?
	2) And since I don't get the desired answer, looks like an error
number -1701 is reported, what am I doing wrong?

Thanks!



Cheers,
Ramesh

`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`
   But what ... is it good for?
       - Engineer at the Advanced Computing
         Systems Division of IBM, 1968,
         commenting on the microchip.
`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`



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