I tried this before. It didn't change anything. The utility "Free Meter"
shows me that 81% of 128 MB physical memory are used after the crash. System
ressources are at about 81%.
But why should "undef" make a difference at all? As far as I understand the
scope of "my $aktDok" should be within the "{ }" of the while loop. Doesn't
this mean that its reference count goes down to zero and its memory is
released as one iteration of the loop is processed? Isn't the body of the
loop entered and left at each iteration cycle? Is it only entered and left
once for the whole looping construct?
However, I tried undefining again. Everything is the same. To me it seems to
be a Word-Problem or an OLE problem.
An equvalent VBS script freezes up after 70 cycles too. But the same thing
in VBA started directly from within Word runs forever!
Maybe THE BIG DUBOIS has a suggestion?
TZS
===================================
The VBS Script:
dim appWD, f
set appWD = CreateObject("Word.Application")
set f =WScript.StdOut
Do
Set aktdoc = appWD.Documents.Open("Test.doc")
For Each aktpara In aktdoc.Paragraphs
For Each aktword In aktpara.Range.Words
'do nothing
Next
Next
aktdoc.Close
Set aktdoc = Nothing
counter = counter + 1
f.writeline counter
Loop
=======================================
The VBA Script:
Sub test()
Dim aktdoc As Document
Dim counter As Integer
Do
Set aktdoc = Documents.Open("Test.doc")
For Each aktpara In aktdoc.Paragraphs
For Each aktword In aktpara.Words
'do nothing
Next
Next
Set aktdoc = Nothing
counter = counter + 1
Debug.Print counter
Loop
End Sub
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]]On Behalf
> Of Carl Jolley
> Sent: Friday, May 05, 2000 9:37 AM
> To: Perl-Win32-Users Mailing List
> Cc: Perl-Win32-Users Mailing List
> Subject: Re: Word OLE problem
>
>
> On Thu, 4 May 2000, Thomas Zapf-Schramm wrote:
>
> > Can anybody tell me, why this script freezes after 70 iterations of the
> > outer loop?
> >
> >
> > use Win32::OLE qw(in with);
> > use Win32::OLE::Const 'Microsoft Word';
> >
> > my $appWD=Win32::OLE->new('Word.Application', 'Quit')
> > or die "Oops, cannot start Word";
> > $counter=0;
> > while(1) {
> > {
> > my $aktDoc=$appWD->Documents->Open("Test.doc")
> > or die "Cannot open WordDoc\n";
> > foreach my $aktPara (in $aktDoc->Paragraphs)
> > {
> > foreach my $aktWort (in $aktPara->Range->Words)
> > {
> > # do nothing}
> > }
> > $aktDoc->Close;
> > $counter++;
> > print "$counter\n";
> > }
> > }
> >
>
> Could it be because 70 interations consumes all your memory?
> You might want to add the following after the $aktDoc->Close call:
> undef $aktDoc;
>
> **** [EMAIL PROTECTED] <Carl Jolley>
> **** All opinions are my own and not necessarily those of my employer ****
>
>
> ---
> You are currently subscribed to perl-win32-users as:
> [EMAIL PROTECTED]
> To unsubscribe, forward this message to
> [EMAIL PROTECTED]
> For non-automated Mailing List support, send email to
> [EMAIL PROTECTED]
>
---
You are currently subscribed to perl-win32-users as: [archive@jab.org]
To unsubscribe, forward this message to
[EMAIL PROTECTED]
For non-automated Mailing List support, send email to
[EMAIL PROTECTED]