anixon Posted March 2, 2007 Posted March 2, 2007 ;Exit the program ; Func dtexit() $sd = iniread(@scriptdir&"\inifiles\my.ini", "shutdown", "type", "0") $shutdown = iniread(@scriptdir&"\inifiles\my.ini", "shutdown", "process", "0") If $shutdown = 1 Then Shutdown($sd) EndIf Exit EndFunc ; ;End of Script This routine worked ok when $sd was set to Hibernate (64) when I changed to Logoff (0) I got a logoff but when I try and run the script after logging back on I am get the following message box "myscript.exe - DLL Initalisation Failed - The application failed to initalise because a Windows Station is shutting down. I have done the following: Recompiled the script - did not resolve Restored Windows XP to an earlier date - did not resolve Deleted and then reinstalled/recompiled Script - did not resolve Could only resolve the problem if I set $shutdown to 0 or rename the script. Any clues? Ant..
MrCreatoR Posted March 2, 2007 Posted March 2, 2007 Maby try to do some check errors... Func dtexit() $sd = IniRead(@scriptdir&"\inifiles\my.ini", "shutdown", "type", "0") $shutdown = IniRead(@scriptdir&"\inifiles\my.ini", "shutdown", "process", "0") If $shutdown = 1 Then Switch $sd Case 0, 1, 2, 4, 8, 32, 64 Shutdown($sd) Case Else MsgBox(16, "Error", "Wrong ShutDown parameters: " & $sd) EndSwitch EndIf Exit EndFunc Its only an example, you must do more checking... Spoiler Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1 AutoIt Russian Community My Work... Spoiler Projects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating ) * === My topics === * ================================================== ================================================== AutoIt is simple, subtle, elegant. © AutoIt Team
anixon Posted March 2, 2007 Author Posted March 2, 2007 Maby try to do some check errors... Func dtexit() $sd = IniRead(@scriptdir&"\inifiles\my.ini", "shutdown", "type", "0") $shutdown = IniRead(@scriptdir&"\inifiles\my.ini", "shutdown", "process", "0") If $shutdown = 1 Then Switch $sd Case 0, 1, 2, 4, 8, 32, 64 Shutdown($sd) Case Else MsgBox(16, "Error", "Wrong ShutDown parameters: " & $sd) EndSwitch EndIf Exit EndFunc Its only an example, you must do more checking... Thanks for the code. The following results were achieved 0 = Logoff - OK 1 = Shutdown - OK 2 = Logoff and Reboot - OK 4 = Did nothing but when trying to run the script again got the dll initalisation failure message 8 = Logoff and POwer Off - OK 32 = Standby/Logon Screen however no response to the keyboard or the mouse had to push the resent button to resolve 64 = Hibernate/POwer Button to Restart/LOgon Screen/ Returned to where I was when Hibernation processed - OK It would appear that on my system shutdown(4) and shutdown(32) dont produce the documented response is this a bug or a Windows setting? Cheers Ant....
anixon Posted March 3, 2007 Author Posted March 3, 2007 Thanks for the code. The following results were achieved0 = Logoff - OK1 = Shutdown - OK2 = Logoff and Reboot - OK4 = Did nothing but when trying to run the script again got the dll initalisation failure message8 = Logoff and POwer Off - OK32 = Standby/Logon Screen however no response to the keyboard or the mouse had to push the resent button to resolve64 = Hibernate/POwer Button to Restart/LOgon Screen/ Returned to where I was when Hibernation processed - OKIt would appear that on my system shutdown(4) and shutdown(32) dont produce the documented responseis this a bug or a Windows setting?Cheers Ant....I solved the problem by simply not using shutdown(4) as a process perhaps this may need to be documentedCheersAnt..
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