Guest JohnD Posted May 2, 2004 Posted May 2, 2004 I wish to install some programs automaticlly from network or CD-rom. some of the programs require the computer to be restarted after installation, and than to continue. what is the best strategy for that task? John D.
scriptkitty Posted May 2, 2004 Posted May 2, 2004 I would use runonce myself... AutoIt3, the MACGYVER Pocket Knife for computers.
scriptkitty Posted May 2, 2004 Posted May 2, 2004 aye, as long as you remember to remove the shortcut or regkey you put in. I should have said "I use runonce myself" for many instalations: HKLM\Software\Microsoft\Windows\CurrentVersion\RunOnce Knowing when to use what is great, and as long as you know all the posibilities, you have all the tools, just need to know how to use them. Just cause I have hands and a paint brush doesn't mean I can paint the Mona Lisa. AutoIt3, the MACGYVER Pocket Knife for computers.
Lilla Posted May 2, 2004 Posted May 2, 2004 Yes... I usually have "multiple reboot" projects and forget the existence of RunOnce. Although The process in RunOnce may need to finish before windows continues to boot. Sometimes you want windows loaded before your script starts to dance.Lar.I use RunOnce for some scripts. It works really well.For example, I use it to run a script that cleans and defrags.Another example. I run a script that Schedules chkdsk on all drives to run on the next restart (in the blue screen before Windows loads). A RunOnce is used to create a chkdsk/autodsk report when windows does load, and display it immediately for the user to read.When the RunOnce script starts, I always wait 30 seconds before starting the script to allow windows to fully load. If I don't wait long enough (for example, 15 seconds is not long enough) I will have problems with the first script that executes in the RunOnce state.I learned how to use RunOnce and to wait 30 seconds from a guy named Larry (probably you) back when AutoIt2 was the latest version, and we were in the Yahoo group. Still there I know.I've been looking for a way to replace to 30 seconds with something more exacting, your idea of testing on the cursor sounds like it might work. I'm going to try it. If anyone has any other ideas on how to do this I'm interested.Lilla
scriptkitty Posted May 2, 2004 Posted May 2, 2004 Depending on the version of windows, You might look for the state of "Program Manager", or the taskbar as well. Interesting thoughts though. Gives me a few tests I need to do now. AutoIt3, the MACGYVER Pocket Knife for computers.
Lilla Posted May 3, 2004 Posted May 3, 2004 (edited) Here's the function I wrote, it works, and looks nice (I think). For a test, you can just run it without doing a restart, then you will see what it looks like. ;to run demo (without doing a restart), uncomment the next two lines ;WinMinimizeAll() ;WaitUntilWindowsIsFullyLoaded('') ;to run demo (with a retart) ;first, schedule run once task/s ;shutdown(6) ;at beginning of run once code, call the function below before doing anything else Func WaitUntilWindowsIsFullyLoaded($Title) Local $message1, $message2, $dif1, $dif2, $begin1, $begin2, $sleeptime, $Title If $Title='' then $Title = @ScriptName EndIf $message1 = 'Please wait...' & @LF & 'The automation script will begin once Windows is fully loaded.' SplashTextOn($Title, $message1, 640, 70, -1, -1, 16, 'Comic Sans MS', 10) $array=WinGetClientSize('Program Manager') ;returns desktop size MouseMove ( $array[0]/2+300, $array[1]/2+35) ;rest cursor at end of middle line $sleeptime=1000 ;1000=1 seconds $begin1 = TimerStart() While 1 If MouseGetCursor() = 2 Then ; 2=arrow $begin2 = TimerStart() While 1 $dif1 = TimerStop($begin1) $dif2 = TimerStop($begin2) $message2 = $message1 & @LF & 'Load time: ' & StringFormat("%.1f", $dif1 / 1000) & ' seconds' ControlSetText($Title, "", "Static1", $message2) ; update splashtexton If $dif2 > 10000 Then ;1000=1sec Sleep(1000) ;allow time to read final load time ExitLoop 2 ;exit out of both While-Wend loops EndIf Sleep($sleeptime) If MouseGetCursor() <> 2 Then ExitLoop EndIf Wend Else Sleep($sleeptime) EndIf Wend SplashOff() Return ; Windows is fully loaded EndFunc Edited May 3, 2004 by Lilla
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