Sign in to follow this  
Followers 0
lizardly

Reboot causes script to fail

6 posts in this topic

I'm struggling with an issue related to rebooting my system.

I have a set of scripts that run fine while I'm developing but

I've found that if I shutdown and reboot my pc then run them from the

command line, the first time I do so they will fail due to some

sort of startup issue. Subsequent runs will be fine.

It seems to take much longer for the applications to open up

the first time and I have tried all kinds of ways to wait for the

app. to start but to no avail.

I'm curious if this is a documented behavior and if someone

can suggest a workaround.

Thanks!

Share this post


Link to post
Share on other sites



I'm struggling with an issue related to rebooting my system.

I have a set of scripts that run fine while I'm developing but

I've found that if I shutdown and reboot my pc then run them from the

command line, the first time I do so they will fail due to some

sort of startup issue. Subsequent runs will be fine.

It seems to take much longer for the applications to open up

the first time and I have tried all kinds of ways to wait for the

app. to start but to no avail.

I'm curious if this is a documented behavior and if someone

can suggest a workaround.

Thanks!

I have many scripts that run immediately on startup, both through the registry runkeys and through the startup start menu folder. Afaik, no problems with that, not a single one ever reported.

Care to elaborate on your post by showing reproducer code and explaining what the code would need to do?


Roses are FF0000, violets are 0000FF... All my base are belong to you.

Share this post


Link to post
Share on other sites

Only issue I have seen is that RunAsSet() and subsequent RunWait() failed because the "Secondary Logon" service hadn't started yet.

I just made the script Sleep() for a Minute at boot time or test for this service to be running before continuing...


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

can we see the script?

Well my AutoIT code is embarrassingly complex as I've set up a testing process that has

multiple modules.

Essentially there is a driver that calls a series of tests that have several supporting scripts.

It looks something like this :

TestCentral.au3

Test_Misc1.au3

Test_Feature2a.au3

Test_Workflow2b.au3

supported with

ArcMap_Lib.au3

6.1_Lib.au3

TaskManager.au3

In the simplest case TestCentral.exe calls Test_Misc1.au3 which in turn calls functions

in both TaskManager.au3 (process monitoring) and 6.1_Lib.au3 (app automation).

So, the issue is that upon reboot the app I'm automating (internal/proprietary) doesn't

respond to the control automation properly. But after it fails and I try again it will work

every time. There is something about initializing an application that throws off the control

clicks and Send commands.

This happens with both our app and ArcMap when you run an AutoIT app after reboot so

I think it's related to my system as opposed to my specific application I'm automating.

System:

XP SP2

Intel Pentium 4

3.80 GHz

2.00 GB Ram

The app I'm automating is .NET but the Win32 ArcMap automation does the same thing

on startup.

Following is some sample code:

* The variables in the Control Statements are to overcome the .NET Control name problem I ran into previously.

See my previous posts under Lizardly...

Func SetLogFiles($BP,$TP)

PreferencesTab()

; Encode Output Path.

;

; IMPORTANT - You must leave off the window name for this to work, ControlFocus("", not ControlFocus("Preferences",

;

Sleep($SleepVal)

ControlFocus("", "", "[CLASS:" & $EDIT & $HexAppDomainHash & "; INSTANCE:3]")

Sleep($SleepVal)

; $TestPath Global passed for this.

Send($TP)

Sleep($SleepVal)

; Log files (sessions).

ControlFocus("", "", "[CLASS:" & $EDIT & $HexAppDomainHash & "; INSTANCE:2]")

Sleep($SleepVal)

; $BasePath Global passed for this.

Send($BP)

Sleep($SleepVal)

; Histograms (sessions).

ControlFocus("", "", "[CLASS:" & $EDIT & $HexAppDomainHash & "; INSTANCE:1]")

Sleep($SleepVal)

; $BasePath Global passed for this.

Send($BP)

Sleep($SleepVal)

; Click OK.

ControlClick("", "", "[CLASS:" & $BUTTON & $HexAppDomainHash & "; TEXT:OK; INSTANCE:19]")

Sleep($SleepVal)

EndFunc

Share this post


Link to post
Share on other sites

I'm struggling with an issue related to rebooting my system.

I have a set of scripts that run fine while I'm developing but

I've found that if I shutdown and reboot my pc then run them from the

command line, the first time I do so they will fail due to some

sort of startup issue. Subsequent runs will be fine.

It seems to take much longer for the applications to open up

the first time and I have tried all kinds of ways to wait for the

app. to start but to no avail.

I'm curious if this is a documented behavior and if someone

can suggest a workaround.

Thanks!

I believe I have found a workaround and an explanation for this behavior.

It seems that upon rebooting my system the first time our app is launched

it has to initialize the entire .NET 2.0 framework, which is why the timing

for app automation is thrown off so far.

The same thing happens for the ArcMap app which is not a .NET app but

a Win32 app which is apparently loading system stuff for the initial launch

as well.

My work around involves... Calling a new script that starts and stops both

app's prior to launching my script... Ugly but it works. No matter how I

manipulated the startup without this workaround the automation was still

off for the first run.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0