; Opera Shutdown 0.13 ; Shutdowns/Hibernates computer when Opera completes transfers ; http://my.opera.com/Tamil/blog/show.dml/2094333 #NoTrayIcon #SingleInstance Force #NoEnv SoundBeep StringTrimRight, ScriptFullPathWithoutExt, A_ScriptFullPath, 4 PrefsFile = %ScriptFullPathWithoutExt%.ini IfNotExist, %PrefsFile% { FileInstall, OperaShutdown.ini, %PrefsFile%, 1 FileSetTime, , %PrefsFile%, C } IniRead, TriggerText, %PrefsFile%, Prefs, Trigger Text IniRead, CheckEvery, %PrefsFile%, Prefs, Check Every IniRead, ConfirmationTimeout, %PrefsFile%, Prefs, Confirmation Timeout IniRead, Hibernate, %PrefsFile%, Prefs, Hibernate IniRead, Test, %PrefsFile%, Prefs, Test IniRead, ExitShortcut, %PrefsFile%, Prefs, Exit Shortcut If ExitShortcut Hotkey, %ExitShortcut%, EXITPROGRAM SetTitleMatchMode, 1 CheckEvery *= 60000 KillTimeout := ConfirmationTimeout*30000 ConfirmationTimeout *= 60 Goto, CHECKLOOP CHECKLOOP: Sleep, %CheckEvery% IfWinExist, %TriggerText% { MsgBox, 36, , Opera transfers completed.`n`nDo you want to close Opera and shutdown/hibernate computer?, %ConfirmationTimeout% IfMsgBox, No ExitApp If Test = 1 { Gosub, CLOSEOPERA MsgBox, 64, , The program is in test mode., %ConfirmationTimeout% ExitApp } Else { If Hibernate = 1 DllCall("PowrProf\SetSuspendState", "int", 1, "int", 0, "int", 0) Else { Gosub, CLOSEOPERA Shutdown, 8 } } } Else Goto, CHECKLOOP CLOSEOPERA: WinClose, %TriggerText% Sleep, %KillTimeout% IfWinExist, %TriggerText% WinKill, %TriggerText% Return EXITPROGRAM: SoundBeep ExitApp Return