Re: Start An application with a script

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Bonj (a_at_b.com)
Date: 04/02/04


Date: Fri, 2 Apr 2004 19:21:42 +0100

So.... the app is doing some work, and you reach a point where the process
is still running, but no more work is being done..? Hmmm, sounds like
either:
a) The app has actually finished doing its work but hasn't unloaded all
forms.
b) The app THINKS it has finished doing its work but hasn't unloaded all
forms.
c) One of the algorithms has got itself into an endless loop - there are
numerous ways this can happen, most commonly in a Do Until/While....End Do
loop, where the Until condition never actually becomes true (While becomes
false). High processor usage by the application when it has reached the
problematic stage might indicate if this is the case.

Write a routine that logs messages to a log file (or database table), and
sprinkle calls to this routine liberally all over the place, such that it
logs whenever it has finished a stage of its work successfully. You can then
look at the end of this log file when the application has 'stopped', and
work out what the next log should have been. It's the code prior to this log
that's obviously causing the problem. Put the calls to the log function
successively closer together until you work out exactly what is the exact
bit of code that is causing the failure. Also, code more paranoically. i.e.
make sanity checks very often - i.e. checking the value of a condition that
is important to be true, but always should be true - which you may have
neglected to code some validation for, on the premise that it will probably
always be true anyway - but in fact it seems might not be - after all if
everything that you've considered "should" be true in fact was, then the
application would work wouldn't it? Again, pay particular attention to your
loops.

Needless to say, this sort of operation will always be easier if you can run
the application in the VB IDE rather than compiled - there are relatively
few scenarios where the behaviour should differ.

Hope this helps

"corinne" <corinnetalaboulma@hotmail.com> wrote in message
news:eoa%23h77FEHA.744@TK2MSFTNGP09.phx.gbl...
> Hi Jeff, Bonj,
>
> I guess it would indeed help to describe the failure.
>
> The failure in my case is: the application just stops.
> No error are logged anywhere or displayed (message, box, event log, error
> log)
> I had other errors, for example "timed out expired" is one and I know I
can
> add error handling like trying X times to access the database.
> The failure I have got only happens from time to time and doesn't leave
any
> traces or shuts down the application.
> I can't reproduce the problem either.
>
> So that is why I was hoping to cleanily stop and restart the application
via
> a check script.
>
> I know I need to add a better "error capture" code as well.
>
> I inherited the code and before to make too many changes wanted to
implement
> a quick restart scipt.
>
> I have, (I think, still in the middle of testing) find a way of doing so
by
> using WScript.Shell.
>
> Thank you for your help guys.
>
> Corinne
>
> "Bonj" <a@b.com> wrote in message
> news:%23M5fnb2FEHA.3096@TK2MSFTNGP11.phx.gbl...
> > Recompile the exe so it can run silently with command line options, or
> > better still answer Jeff's question and define what 'fails' means, then
> you
> > can build error handling into it...
> > if you don't have control of the 'application', then you'll have to use
> > messaging APIs
> >
> > "corinne" <corinnetalaboulma@hotmail.com> wrote in message
> > news:O4QGQnvFEHA.3568@tk2msftngp13.phx.gbl...
> > > Hi Everyone,
> > >
> > > I have an exe that is supposed to run all the time, doing bit and
pieces
> > on
> > > a regular basis.
> > >
> > > From time to time it fails.
> > >
> > > I have set up a job emailing me when it stops so I can restart it
> > manually.
> > >
> > > The next step would be for the "check" script to actually restart the
> > > application itself.
> > >
> > > Could you suggest me programmatical objects, ways of doing the
> following.
> > >
> > > 1 Start the application
> > > 2 Change the value in the text box on the UI
> > > 3 Click the start button on the application.
> > >
> > > I have started looking but it is quite urgent so I need to find the
> right
> > > road pretty quickly.
> > >
> > > Thank you for any suggestion.
> > >
> > > Corinne
> > >
> > >
> >
> >
>
>



Relevant Pages

  • Re: Linked list tutorial (in C)?
    ... > possible failure causes, having a global source of error information ... You could also include some assertions to verify that: ... /* Appends the node referenced by 'app' to a list. ... ** null or the node referenced by 'del' cannot be found. ...
    (alt.comp.lang.learn.c-cpp)
  • Re: User-defined Shortcut keys
    ... Tried many combinations and cannot produce a failure. ... You may also want to try replacing keyboard driver. ... key:' press desired key combination, ... Sometime the app will start ...
    (microsoft.public.windowsxp.basics)
  • Re: New HIDE (HLA IDE) version is available
    ... But anyway, seems that you app closes fine now, I havent looked ... But in your messageloop, ... return 0 to indicate failure. ...
    (alt.lang.asm)
  • Re: How to make Merged Proxy support turned for a pre-existing pro
    ... everything works until the point when the app is exited from, ... RevokeInterfaceFromGlobal calls made during regular execution. ... ignore the failure in RegisterInterfaceInGlobal in destructor: ... Prev by Date: ...
    (microsoft.public.vc.atl)
  • Re: Batch file and MFC (Properly Terminating Application)
    ... running any secondary modal loop. ... don't write an OnCancel handler, ... the changes the user thought had been made--because the app closed without ... user clicks on Cancel button and application exits. ...
    (microsoft.public.vc.mfc)