lizardly Posted July 24, 2007 Share Posted July 24, 2007 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! Link to comment Share on other sites More sharing options...
SadBunny Posted July 24, 2007 Share Posted July 24, 2007 I'm struggling with an issue related to rebooting my system.I have a set of scripts that run fine while I'm developing butI'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 somesort of startup issue. Subsequent runs will be fine.It seems to take much longer for the applications to open upthe first time and I have tried all kinds of ways to wait for theapp. 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. Link to comment Share on other sites More sharing options...
Bert Posted July 25, 2007 Share Posted July 25, 2007 can we see the script? The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
Developers Jos Posted July 25, 2007 Developers Share Posted July 25, 2007 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... SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
lizardly Posted July 25, 2007 Author Share Posted July 25, 2007 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 Link to comment Share on other sites More sharing options...
lizardly Posted July 25, 2007 Author Share Posted July 25, 2007 I'm struggling with an issue related to rebooting my system.I have a set of scripts that run fine while I'm developing butI'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 somesort of startup issue. Subsequent runs will be fine.It seems to take much longer for the applications to open upthe first time and I have tried all kinds of ways to wait for theapp. 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 launchedit 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 buta Win32 app which is apparently loading system stuff for the initial launchas 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. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now