1hleOupaSVNrFQILQVbYUD changeset

Changeset346534376137 (b)
ParentNone (a)
ab
0+; Opera Shutdown 0.13
0+; Shutdowns/Hibernates computer when Opera completes transfers
0+; http://my.opera.com/Tamil/blog/show.dml/2094333
0+
0+#NoTrayIcon
0+#SingleInstance Force
0+#NoEnv
0+SoundBeep
0+
0+StringTrimRight, ScriptFullPathWithoutExt, A_ScriptFullPath, 4
0+PrefsFile = %ScriptFullPathWithoutExt%.ini
0+IfNotExist, %PrefsFile%
0+{
0+        FileInstall, OperaShutdown.ini, %PrefsFile%, 1
0+        FileSetTime, , %PrefsFile%, C
0+}
0+
0+IniRead, TriggerText, %PrefsFile%, Prefs, Trigger Text
0+IniRead, CheckEvery, %PrefsFile%, Prefs, Check Every
0+IniRead, ConfirmationTimeout, %PrefsFile%, Prefs, Confirmation Timeout
0+IniRead, Hibernate, %PrefsFile%, Prefs, Hibernate
0+IniRead, Test, %PrefsFile%, Prefs, Test
0+IniRead, ExitShortcut, %PrefsFile%, Prefs, Exit Shortcut
0+
0+If ExitShortcut
0+        Hotkey, %ExitShortcut%, EXITPROGRAM
0+
0+SetTitleMatchMode, 1
0+CheckEvery *= 60000
0+KillTimeout := ConfirmationTimeout*30000
0+ConfirmationTimeout *= 60
0+Goto, CHECKLOOP
0+
0+CHECKLOOP:
0+Sleep, %CheckEvery%
0+IfWinExist, %TriggerText%
0+{
0+        MsgBox, 36, , Opera transfers completed.`n`nDo you want to close Opera and shutdown/hibernate computer?, %ConfirmationTimeout%
0+        IfMsgBox, No
0+                ExitApp
0+        If Test = 1
0+        {
0+                Gosub, CLOSEOPERA
0+                MsgBox, 64, , The program is in test mode., %ConfirmationTimeout%
0+                ExitApp
0+        }
0+        Else
0+        {
0+                If Hibernate = 1
0+                        DllCall("PowrProf\SetSuspendState", "int", 1, "int", 0, "int", 0)
0+                Else
0+                {
0+                        Gosub, CLOSEOPERA
0+                        Shutdown, 8
0+                }
0+        }
0+}
0+Else
0+    Goto, CHECKLOOP
0+
0+CLOSEOPERA:
0+WinClose, %TriggerText%
0+Sleep, %KillTimeout%
0+IfWinExist, %TriggerText%
0+        WinKill, %TriggerText%
0+Return
0+
0+EXITPROGRAM:
0+SoundBeep
0+ExitApp
0+Return
...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
--- Revision None
+++ Revision 346534376137
@@ -0,0 +1,71 @@
+; 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