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

Re: [MacPerl] AE, checking if file open, memory issues in MacPerl



>At 03.31 1998.05.04, Peter Hartmann wrote:
>>[1]
>>The following code snippet intends to make Netscape download a file to disk
>>(I know I could have MacPerl handle this job all on its own, but since it
>>is not threaded, I have to wait until a download completes, before I can
>>move to the next, which can be pretty time consuming - or am I wrong?), but
>>it doesn't work (although it compiles), obviously to my handling of the fss.
>>Thanks to InsideMac, Chris' invaluable AE Tutorial [Thanks Chris!] and
>>other sample code I figured out quite a couple of things on my own, but I
>>am stuck on this. Could anyone point me into the right direction? Is there
>>a way to pass a simple file path of type TEXT instead of a fss?
>
>Often, a filespec will be passed in something like this:
>
>"'----':obj {want:type(file), from:'null'(), form:enum(name), seld:TEXT(\@)",
>   $path  # i think this is right ...
>
>Or:
>
>"'----':alis(\@\@)", NewAliasMinimal($path)
>
>--
>Chris Nandor

I could manage to make the following snippet work:

#######
use Mac::AppleEvents;

$url = "http://www.abcde.com";
$file = "Macintosh HD:Desktop Folder:testit.html";

$obj = "'----':Ò$urlÓ, INTO:obj{form:name, want:type(file), seld:Ò$fileÓ,
from:'null'()}";

$be = AEBuildAppleEvent('WWW!','OURL',typeApplSignature,'MOSS',0,0,$obj) ||
die "$^E\n";

$reply = AESend($be, kAEWaitReply) or die $^E;

print AEPrint($be), "\n";
print AEPrint($reply), "\n";
#########

So Chris was very close. The only problem was that since Netscape is
supposed to save any downloaded document into one single file, it does not
accept an enum here, as the output from aete.converter tells us. Actually
very simple, if you know how.

Peter Hartmann
Visiting Scholar
Ritsumeikan University, Kyoto, Japan
e-mail:
hartmann@mbox.kyoto-inet.or.jp (preferred)
phv00542@askic.kic.ritsumei.ac.jp




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