Schedule Tasks to run interactively without being logged in

N

nikeshp4tel

Hi all,

I running overnight tests which uses windows form. If I run the tests
in command prompt when i'm logged in, the tests work pefectly fine.
However if I schedule the task through Scheduled Tasks wizard and run
at midnight when no one is logged in i get the follwoing error:

System.InvalidOperationException : It is invalid to show a modal
dialog or form when the application is not running in UserInteractive
mode. Specify the ServiceNotification or DefaultDesktopOnly style to
display a notification from a service application.


To overcome this I've tried to schedule it running the AT command
using the /interactive command. This woks perfectly fine if you use
the default user login for the AT command which is the local system.
However I do not want to run the task under local system because
before I run the tests I need to check out some files using cvs which
requires my user login details. So i change the default account of
the AT scheduler to be my account. This works fine but the tests seem
to freeze when it attempts to load up dialogue boxes. For some reason
they do not appear and my tests hang around looking for them.

If it works for local system but hangs for my user login, there must
be some internal permissioning that prevents my login from displaying
these dialogues. Has any1 come across this or has any1 got any ideas
to over come this?

Any help will be much appreciated.

Nik
 
C

CreateWindow

Hi Nik,

This may not suit you but can't you run the tests whilst logged on with the
desktop _locked_ overnight?

GUI thingies will still run under your logged on Window Station desktop
thread.

Cheers,

CreateWindow
http://mymessagetaker.com
 
N

nikeshp4tel

I have actually got the schedule task to login in with my user details
and run the GUI overnight using the AT command with the interactive
parameter. When i log in the morning i can actually see the Windows
form running but its stuck in a loop waiting for the message box. I
can see the title of the messagebox in task bar but when i click on it
i get a message box with a white box. It works perfectly fine if i use
the local system admin but under my user login it seems to get stuck.
 
P

Pegasus \(MVP\)

I have actually got the schedule task to login in with my user details
and run the GUI overnight using the AT command with the interactive
parameter. When i log in the morning i can actually see the Windows
form running but its stuck in a loop waiting for the message box. I
can see the title of the messagebox in task bar but when i click on it
i get a message box with a white box. It works perfectly fine if i use
the local system admin but under my user login it seems to get stuck.

Since your application uses dialog boxes, why don't you
just launch it while logged on, just before you leave the
office?

If it is meant to run outside an interactive session then you
should eliminate the dialog boxes. There isn't anyone to
see them anyway!
 
N

nikeshp4tel

I can't run the tests when i leave because they depend on a build
system which is scheduled to run overnight, so i cant run the tests
until the build system has finished.

I need the dialogue boxes because the tests verify that the correct
dialogue box is popped up with the correct error message when invalid
data is returned.
 
P

Pegasus \(MVP\)

I can't run the tests when i leave because they depend on a build
system which is scheduled to run overnight, so i cant run the tests
until the build system has finished.

I need the dialogue boxes because the tests verify that the correct
dialogue box is popped up with the correct error message when invalid
data is returned.

Your problem is easily solved by launching the following batch
file as you leave:

@echo off
set hours=4
set /a seconds=3600 * %hours%
ping localhost -n %seconds% > nul
"c:\Program Files\Your App\SomeApp.exe"

The batch file will wait around 4 hours before launching
the newly built application. With slightly different coding
you could get it to launch itself at a fixed time, e.g. at 1am.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top