msubedi Posted September 4, 2005 Share Posted September 4, 2005 what is the autoit script to ask "your computer need to restarted once, press Yes to restart the computer and No to cancel"now if yes is clicked it should restart the PCif no is pressed , dialogue box should be disappearedand if nothing is clicked for 1 minute it should be able to restart the PC automatically. Link to comment Share on other sites More sharing options...
Kelsenellenelvian Posted September 4, 2005 Share Posted September 4, 2005 We could use that over at WPI too I would like to see such a script..... Link to comment Share on other sites More sharing options...
jbm Posted September 4, 2005 Share Posted September 4, 2005 I came up with this script that runs shutdown.exe but Idon't know how or if its even possible to not have theshutdown.exe window pop up. setting the timeout to 1 isthe best I could do. If you leave it off it defaults to 30seconds. I didn't try setting it to 0Dim $valueDim $yesDim $nodim $valuedim $timeoutdim $nobutton$timeout=01$yes = 6$no = 7$nobutton = -1$value = MsgBox(4,"Restart required","Click yes to restart No to cancel",60)If $value = $yes or $value = $nobutton Then Run("shutdown.exe -r -t " & $timeout)EndIf Link to comment Share on other sites More sharing options...
Nazgul Posted September 4, 2005 Share Posted September 4, 2005 Why use shutdown.exe when AutoIt supports its own shutdown function? Link to comment Share on other sites More sharing options...
MHz Posted September 4, 2005 Share Posted September 4, 2005 I use a 10 minute timeout. If I do not attend the PC, then it will shutdown. A simple messagebox takes care of it. I run an Au3 script from the RunOnce key to take care of shortcuts, possible windows, change ini settings for RainLendar and then perform a countdown for the shutdown.Timeout Messagebox; First Logon Script.; enable adlib.AdlibEnable('_AdLib'); lets sleep alittle and give the desktop a chance to setup.Sleep(10000); remove read only attributes.FileSetAttrib(@UserProfileDir & '\*', '-R', 1)#region - Alter Rainlendar position in it's ini file_Rainlendar()Func _Rainlendar() Local $width = @DesktopWidth Select Case $width = 640 Local $x = 469 Case $width = 800 Local $x = 619 Case $width = 1024 Local $x = 840 Case $width = 1280 Local $x = 1084 Case $width = 1600 Local $x = 1429 Case Else Return EndSelect IniWrite(@AppDataDir & '\Rainlendar\Rainlendar.ini', 'Rainlendar', 'X', $x) IniWrite(@AppDataDir & '\Rainlendar\Rainlendar.ini', 'Rainlendar', 'Y', 15) IniWrite(@AppDataDir & '\Rainlendar\Rainlendar.ini', 'Rainlendar', 'TodoX', $x+10) IniWrite(@AppDataDir & '\Rainlendar\Rainlendar.ini', 'Rainlendar', 'TodoY', 184) IniWrite(@AppDataDir & '\Rainlendar\Rainlendar.ini', 'Rainlendar', 'EventListX', $x+10) IniWrite(@AppDataDir & '\Rainlendar\Rainlendar.ini', 'Rainlendar', 'EventListY', 242)EndFunc#endregion#region - Remove shortcuts; all user startmenu shortcutsIf FileChangeDir(@StartMenuCommonDir) Then FileDelete('Set Program Access and Defaults.lnk') FileDelete('Windows Catalog.lnk') FileDelete('Windows Update.lnk')EndIf; all user startmenu \ programs shortcutsIf FileChangeDir(@ProgramsCommonDir) Then FileDelete('Windows Movie Maker.lnk') FileMove('Windows Messenger.lnk', 'Accessories\Communications\Windows Messenger.lnk')EndIf; current user desktop shortcutsIf FileChangeDir(@DesktopCommonDir) Then FileDelete('Internet Explorer.lnk') FileDelete('Outlook Express.lnk')EndIf; current user startmenu \ programs shortcutsIf FileChangeDir(@ProgramsDir) Then FileDelete('Internet Explorer.lnk') FileDelete('Outlook Express.lnk') FileDelete('Windows Media Player.lnk') FileDelete('Accessories\Program Compatibility Wizard.lnk') FileDelete('Accessories\Tour Windows XP.lnk') FileMove('Remote Assistance.lnk', @ProgramsCommonDir & '\Accessories\Communications\Remote Assistance.lnk')EndIf#endregion#region - Give option to not shutdown$option = MsgBox(4, 'Installation is fully complete', 'System will shutdown within 10 minutes, unless No is pressed', 600); disable adlibAdlibDisable(); process optionSelect Case $option = -1 Shutdown(1) Case $option = 6 Shutdown(1) Case Else ExitEndSelect#endregionExitFunc _AdLib() ; scan for unexpected events If WinExists('Windows Security Alert') Then If Not WinActive('Windows Security Alert') Then WinActivate('Windows Security Alert') Sleep(1000) Send('!u') EndIf If WinExists('avast! Home Edition Info') Then ControlClick('avast! Home Edition Info', '', 'Button1') EndIfEndFunc Link to comment Share on other sites More sharing options...
jbm Posted September 5, 2005 Share Posted September 5, 2005 (edited) Why use shutdown.exe when AutoIt supports its own shutdown function?<{POST_SNAPBACK}>Thanks, I was wondering about that. searched for it in help, guess I didn't search very good. Now I go to search in autoIt help and find it right away.Mmm must have been half asleep before.Just tried my script using autoit's shutdown function. works much better Edited September 5, 2005 by jbm Link to comment Share on other sites More sharing options...
Nepali Posted September 5, 2005 Share Posted September 5, 2005 (edited) ; Author: bhurte_p@hotmail.com (Pawan Bhurtel)$answer = MsgBox(4, "Windows XP|Restart|", "Your computer need to be restarted once to fully update ur system. Do u want to restart ur computer ? Or will automatically restart after 1 minute.", 60)If $answer = 7 Then ExitEndIfShutdown(6)most simplest one,, what u r looking for .... Edited September 5, 2005 by Nepali 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