| Date: | Tue, 18 May 1999 12:38:28 -0500 |
| Reply-To: | "Bauer, John" <bauer@SPSS.COM> |
| Sender: | "SPSSX(r) Discussion" <SPSSX-L@UGA.CC.UGA.EDU> |
| From: | "Bauer, John" <bauer@SPSS.COM> |
| Subject: | Re: running SCRIPT..... |
|---|
Raynald,
Your original description of the problem showed only the .ExecuteCommands
and the While .IsBusy loop. However, you are copying information to the
Clipboard. There are often latency problems when doing so, depending on
what is being placed there and what other applications may be doing.
You might look at the Export To Word / Excel scripts. When using the
clipboard, they use Sleep from the Windows API, and an error handler with
what is called an exponential back-off. Even so, excess user activity or
other events outside the control of the script occasionally result in
failure of either the cut or paste operation.
You should not be polling .IsBusy after operations such as selecting data
cells, copying, or pasting. These are "Front End" operations, and do not
involve the SPSS Processor.
John Bauer, Ph.D.
SPSS Developer Support
visit the SPSS Script eXchange:
http://www.spss.com/software/spss/scriptexchange/
-----Original Message-----
From: Raynald Levesque [mailto:rlevesque@VIDEOTRON.CA]
Sent: Monday, May 17, 1999 8:08 PM
To: SPSSX-L@UGA.CC.UGA.EDU
Subject: Re: running SCRIPT.....
(copy was not sent to the list when I sent it to J. Bauer).
Raynald
From: Raynald Levesque <rlevesque@videotron.ca>
To: Bauer, John <bauer@spss.com>
Sent: Monday, May 17, 1999 8:41 PM
Subject: Re: running SCRIPT.....
> Hi John,
>
> I am using version 8.0.2.
>
> I have attached a copy of the script in question. (The original version
was
> a stand alone script which came from scriptExchange but I need to modify
it
> so that it may be called from syntax.)
>
> By now I have found a solution to the specific question I posted (I
defined
> an error handler which simply tries again to use the variable) but the
same
> approach is not practical for other areas of the script.
>
> My guess is that when a script is called from a syntax file, the processor
> is "busy" waiting for the script to finish so that it can then proceed
with
> the rest of the syntax file. This would explain why objSpssApp.IsBusy is
> always true.
>
> I agree with you that a "wait xx" loop is not a general solution because:
> - correct execution of the script may depend on the speed of the computer
or
> on how many tasks the computer is doing at the time
> - this is not efficient when it is needed in areas of a script which are
> repeated many times (like in a loop).
>
> Regards
>
> Raynald Levesque rlevesque@videotron.ca
>
>
> ----- Original Message -----
> From: Bauer, John <bauer@spss.com>
> To: 'Raynald Levesque' <rlevesque@VIDEOTRON.CA>; <SPSSX-L@UGA.CC.UGA.EDU>
> Sent: Monday, May 17, 1999 10:54 AM
> Subject: RE: running SCRIPT.....
>
>
> > Raynald,
> >
> > Could you tell me exactly which version of SPSS you are using? (9.0 or
> > 9.0.1, I suspect.)
> >
> > Instead of the While loop, try using "Wait 10" to pause for ten seconds,
> and
> > see if that will get the script to resume execution. (Allow enough time
> for
> > the syntax to finish, plus a margin of error.) Please let me know if
that
> > gets past the limitation.
> >
> > I'm not suggesting that this is a solution; I need more information so I
> can
> > report the problem accurately to SPSS Development.
> >
> >
> >
> >
> > John Bauer, Ph.D.
> > SPSS Developer Support
> >
> > visit the SPSS Script eXchange:
> > http://www.spss.com/software/spss/scriptexchange/
> >
> >
> > ---Original Message-----
> > From: Raynald Levesque [mailto:rlevesque@VIDEOTRON.CA]
> > Sent: Saturday, May 15, 1999 10:53 AM
> > To: SPSSX-L@UGA.CC.UGA.EDU
> > Subject: running SCRIPT.....
> >
> >
> >
> > Dear list members
> >
> > I have a script which does does not require input parameters. When I run
> it
> > with the run command there are no problems.
> > When I run it from a syntax file using the SCRIPT command, the status
bar
> > shows "Running SCRIPTS" but nothing happens. The only way to regain
> control
> > is to terminate SPSS.
> >
> > The problem occurs in the following loop of the Script:
> > <snip>
> >
> > objSpssApp.ExecuteCommands strCommands, False
> >
> > While objSpssApp.IsBusy
> >
> > 'wait until spss processor is ready
> >
> > Wend
> >
> > <snip>
> >
> > The line before the loop creates a new variable. After the loop, the
> > variable is used. The While Wend loop is supposed to wait until the
> > processor has finished the creation of the variable before continuing
with
> > the flow of the script. Without the loop, an error is produced when the
> new
> > variable is referenced because the processor has not finished creating
it.
> I
> > trust above explanation is clear.
> >
> > Any ideas to solve this problem?
> >
> > TIA,
> >
> > Raynald Levesque rlevesque@videotron.ca <mailto:rlevesque@videotron.,ca>
>
>
|