autoit-scripts – Diff between revs 2 and 4
?pathlinks?
Rev 2 | Rev 4 | |||
---|---|---|---|---|
1 | #NoTrayIcon |
1 | #NoTrayIcon |
|
2 | #Region ;**** Directives created by AutoIt3Wrapper_GUI **** |
2 | #Region ;**** Directives created by AutoIt3Wrapper_GUI **** |
|
3 | #AutoIt3Wrapper_Icon=favicon.ico |
3 | #AutoIt3Wrapper_Icon=favicon.ico |
|
4 | #AutoIt3Wrapper_Outfile=Release\x86\AutoRun.exe |
4 | #AutoIt3Wrapper_Outfile=Release\x86\AutoRun.exe |
|
5 | #AutoIt3Wrapper_Outfile_x64=Release\x64\AutoRun_x64.exe |
5 | #AutoIt3Wrapper_Outfile_x64=Release\x64\AutoRun_x64.exe |
|
6 | #AutoIt3Wrapper_Compression=0 |
6 | #AutoIt3Wrapper_Compression=0 |
|
7 | #AutoIt3Wrapper_Res_Comment=Hold shift key down in order to simulate autorun for games that do not have an autorun feature. |
7 | #AutoIt3Wrapper_Res_Comment=Hold shift key down in order to simulate autorun for games that do not have an autorun feature. |
|
8 | #AutoIt3Wrapper_Res_Description=Hold shift key down in order to simulate autorun for games that do not have an autorun feature. |
8 | #AutoIt3Wrapper_Res_Description=Hold shift key down in order to simulate autorun for games that do not have an autorun feature. |
|
9 | #AutoIt3Wrapper_Res_Fileversion=1.0.0.8 |
9 | #AutoIt3Wrapper_Res_Fileversion=1.0.0.9 |
|
10 | #AutoIt3Wrapper_Res_Fileversion_AutoIncrement=y |
10 | #AutoIt3Wrapper_Res_Fileversion_AutoIncrement=y |
|
11 | #AutoIt3Wrapper_Res_Fileversion_First_Increment=y |
11 | #AutoIt3Wrapper_Res_Fileversion_First_Increment=y |
|
12 | #AutoIt3Wrapper_Res_ProductName=AutoRun |
12 | #AutoIt3Wrapper_Res_ProductName=AutoRun |
|
13 | #AutoIt3Wrapper_Res_ProductVersion=1.0 |
13 | #AutoIt3Wrapper_Res_ProductVersion=1.0 |
|
14 | #AutoIt3Wrapper_Res_CompanyName=Wizardry and Steamworks |
14 | #AutoIt3Wrapper_Res_CompanyName=Wizardry and Steamworks |
|
15 | #AutoIt3Wrapper_Res_LegalCopyright=Copyright © 2018 Wizardry and Steamworks |
15 | #AutoIt3Wrapper_Res_LegalCopyright=Copyright © 2018 Wizardry and Steamworks |
|
16 | #AutoIt3Wrapper_Res_requestedExecutionLevel=asInvoker |
16 | #AutoIt3Wrapper_Res_requestedExecutionLevel=asInvoker |
|
17 | #AutoIt3Wrapper_Res_Field=Made By|Wizardry and Steamworks |
17 | #AutoIt3Wrapper_Res_Field=Made By|Wizardry and Steamworks |
|
18 | #AutoIt3Wrapper_Res_Field=Email|office@grimore.org |
18 | #AutoIt3Wrapper_Res_Field=Email|office@grimore.org |
|
19 | #AutoIt3Wrapper_Res_Field=AutoIt Version|%AutoItVer% |
19 | #AutoIt3Wrapper_Res_Field=AutoIt Version|%AutoItVer% |
|
20 | #AutoIt3Wrapper_Res_Field=Compile Date|%date% %time% |
20 | #AutoIt3Wrapper_Res_Field=Compile Date|%date% %time% |
|
21 | #AutoIt3Wrapper_AU3Check_Stop_OnWarning=y |
21 | #AutoIt3Wrapper_AU3Check_Stop_OnWarning=y |
|
22 | #AutoIt3Wrapper_AU3Check_Parameters=-q -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 |
22 | #AutoIt3Wrapper_AU3Check_Parameters=-q -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 |
|
23 | #AutoIt3Wrapper_Run_After=for %I in ("%in%" "directives.au3") do copy %I "C:\Program Files (x86)\autoit3\SciTE\AutoIt3Wrapper" |
23 | #AutoIt3Wrapper_Run_After=for %I in ("%in%" "directives.au3") do copy %I "C:\Program Files (x86)\autoit3\SciTE\AutoIt3Wrapper" |
|
24 | #AutoIt3Wrapper_Run_After="C:\Program Files\7-Zip\7z.exe" a -sfx AutoRun.exe Release/x86/AutoRun.exe |
24 | #AutoIt3Wrapper_Run_After="C:\Program Files\7-Zip\7z.exe" a -sfx %scriptdir%\Deploy\AutoRun.exe %out |
|
25 | #AutoIt3Wrapper_Run_Tidy=y |
25 | #AutoIt3Wrapper_Run_Tidy=y |
|
26 | #Tidy_Parameters=/sort_funcs /reel |
26 | #Tidy_Parameters=/sort_funcs /reel |
|
27 | #AutoIt3Wrapper_Run_Au3Stripper=y |
27 | #AutoIt3Wrapper_Run_Au3Stripper=y |
|
28 | #Au3Stripper_Parameters=/debug |
28 | #Au3Stripper_Parameters=/debug |
|
29 | #AutoIt3Wrapper_Versioning=v |
29 | #AutoIt3Wrapper_Versioning=v |
|
30 | #AutoIt3Wrapper_Versioning_Parameters=/Comments %fileversionnew% |
30 | #AutoIt3Wrapper_Versioning_Parameters=/Comments %fileversionnew% |
|
31 | #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** |
31 | #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** |
|
32 | |
32 | |
|
33 | ; Copyright 2018 Wizardry and Steamworks - MIT LICENSE |
33 | ; Copyright 2018 Wizardry and Steamworks - MIT LICENSE |
|
34 | ; |
34 | ; |
|
35 | ; Permission is hereby granted, free of charge, to any person obtaining a |
35 | ; Permission is hereby granted, free of charge, to any person obtaining a |
|
36 | ; copy of this software and associated documentation files (the Software), |
36 | ; copy of this software and associated documentation files (the Software), |
|
37 | ; to deal in the Software without restriction, including without |
37 | ; to deal in the Software without restriction, including without |
|
38 | ; limitation the rights to use, copy, modify, merge, publish, distribute, |
38 | ; limitation the rights to use, copy, modify, merge, publish, distribute, |
|
39 | ; sublicense, and/or sell copies of the Software, and to permit persons to |
39 | ; sublicense, and/or sell copies of the Software, and to permit persons to |
|
40 | ; whom the Software is furnished to do so, subject to the following |
40 | ; whom the Software is furnished to do so, subject to the following |
|
41 | ; conditions: |
41 | ; conditions: |
|
42 | ; |
42 | ; |
|
43 | ; The above copyright notice and this permission notice shall be included |
43 | ; The above copyright notice and this permission notice shall be included |
|
44 | ; in all copies or substantial portions of the Software. |
44 | ; in all copies or substantial portions of the Software. |
|
45 | ; |
45 | ; |
|
46 | ; THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
46 | ; THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
|
47 | ; IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
47 | ; IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
|
48 | ; FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
48 | ; FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
|
49 | ; THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR |
49 | ; THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR |
|
50 | ; OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, |
50 | ; OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, |
|
51 | ; ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
51 | ; ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
|
52 | ; OTHER DEALINGS IN THE SOFTWARE. |
52 | ; OTHER DEALINGS IN THE SOFTWARE. |
|
53 | |
53 | |
|
54 | Global Const $VERSION = "1.0.0.8" |
54 | Global Const $VERSION = "1.0.0.9" |
|
55 | #AutoIt3Wrapper_Testing=n |
55 | #AutoIt3Wrapper_Testing=n |
|
56 | #pragma compile(AutoItExecuteAllowed, true) |
56 | #pragma compile(AutoItExecuteAllowed, true) |
|
57 | #AutoIt3Wrapper_ShowProgress=n |
57 | #AutoIt3Wrapper_ShowProgress=n |
|
58 | |
58 | |
|
59 | #include <WinAPISys.au3> |
59 | #include <WinAPISys.au3> |
|
60 | #include <WinAPIFiles.au3> |
60 | #include <WinAPIFiles.au3> |
|
61 | #include <WinAPIvkeysConstants.au3> |
61 | #include <WinAPIvkeysConstants.au3> |
|
62 | #include <File.au3> |
62 | #include <File.au3> |
|
63 | #include <FileConstants.au3> |
63 | #include <FileConstants.au3> |
|
64 | #include <MsgBoxConstants.au3> |
64 | #include <MsgBoxConstants.au3> |
|
65 | #include <AutoItConstants.au3> |
65 | #include <AutoItConstants.au3> |
|
66 | #include <StringConstants.au3> |
66 | #include <StringConstants.au3> |
|
67 | ; Required for the $TRAY_CHECKED and $TRAY_ICONSTATE_SHOW constants. |
67 | ; Required for the $TRAY_CHECKED and $TRAY_ICONSTATE_SHOW constants. |
|
68 | #include <TrayConstants.au3> |
68 | #include <TrayConstants.au3> |
|
69 | ; Base64 encoder / decoder by J2TEAM (https://github.com/J2TEAM) |
69 | ; Base64 encoder / decoder by J2TEAM (https://github.com/J2TEAM) |
|
70 | #include "Base64.au3" |
70 | #include "Base64.au3" |
|
71 | |
71 | |
|
72 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
72 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
|
73 | ;; INTERNALS ;; |
73 | ;; INTERNALS ;; |
|
74 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
74 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
|
75 | |
75 | |
|
76 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
76 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
|
77 | ;; MAIN LOOP ;; |
77 | ;; MAIN LOOP ;; |
|
78 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
78 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
|
79 | |
79 | |
|
80 | ; Setup termination handler. |
80 | ; Setup termination handler. |
|
81 | OnAutoItExitRegister("Terminate") |
81 | OnAutoItExitRegister("Terminate") |
|
82 | |
82 | |
|
83 | ; Setup tray icon menu. |
83 | ; Setup tray icon menu. |
|
84 | Opt("TrayMenuMode", 3) |
84 | Opt("TrayMenuMode", 3) |
|
85 | Opt("TrayOnEventMode", 1) |
85 | Opt("TrayOnEventMode", 1) |
|
86 | Opt("SendCapslockMode", 0) |
86 | Opt("SendCapslockMode", 0) |
|
87 | |
87 | |
|
88 | TrayCreateItem("On", -1, -1, $TRAY_ITEM_RADIO) |
88 | TrayCreateItem("On", -1, -1, $TRAY_ITEM_RADIO) |
|
89 | TrayItemSetState(-1, $TRAY_CHECKED) |
89 | TrayItemSetState(-1, $TRAY_CHECKED) |
|
90 | TrayItemSetOnEvent(-1, "TrayMenuOn") |
90 | TrayItemSetOnEvent(-1, "TrayMenuOn") |
|
91 | TrayCreateItem("Off", -1, -1, $TRAY_ITEM_RADIO) |
91 | TrayCreateItem("Off", -1, -1, $TRAY_ITEM_RADIO) |
|
92 | TrayItemSetOnEvent(-1, "TrayMenuOff") |
92 | TrayItemSetOnEvent(-1, "TrayMenuOff") |
|
93 | TrayCreateItem("") |
93 | TrayCreateItem("") |
|
94 | TrayCreateItem("About") |
94 | TrayCreateItem("About") |
|
95 | TrayItemSetOnEvent(-1, "TrayMenuAbout") |
95 | TrayItemSetOnEvent(-1, "TrayMenuAbout") |
|
96 | TrayCreateItem("Exit", -1, -1) |
96 | TrayCreateItem("Exit", -1, -1) |
|
97 | TrayItemSetOnEvent(-1, "TrayMenuExit") |
97 | TrayItemSetOnEvent(-1, "TrayMenuExit") |
|
98 | |
98 | |
|
99 | ; -5 for EXE |
99 | ; -5 for EXE |
|
100 | TraySetIcon(@ScriptFullPath, -5) |
100 | TraySetIcon(@ScriptFullPath, -5) |
|
101 | TraySetState($TRAY_ICONSTATE_SHOW) |
101 | TraySetState($TRAY_ICONSTATE_SHOW) |
|
102 | |
102 | |
|
103 | Global $capsState = 0, $scriptEnabled = 1 |
103 | Global $capsState = 0, $scriptEnabled = 1 |
|
104 | |
104 | |
|
105 | ; Run main event loop. |
105 | ; Run main event loop. |
|
106 | While 1 |
106 | While 1 |
|
107 | If $scriptEnabled == 1 Then |
107 | If $scriptEnabled == 1 Then |
|
108 | ToggleAutoRun() |
108 | ToggleAutoRun() |
|
109 | EndIf |
109 | EndIf |
|
110 | Sleep(100) |
110 | Sleep(100) |
|
111 | WEnd |
111 | WEnd |
|
112 | |
112 | |
|
113 | Func _GetCaps() |
113 | Func _GetCaps() |
|
114 | Local $aOnOff[2] = ['OFF', 'ON'] |
114 | Local $aOnOff[2] = ['OFF', 'ON'] |
|
115 | Return $aOnOff[BitAND(_WinAPI_GetKeyState($VK_CAPITAL), 1)] |
115 | Return $aOnOff[BitAND(_WinAPI_GetKeyState($VK_CAPITAL), 1)] |
|
116 | EndFunc ;==>_GetCaps |
116 | EndFunc ;==>_GetCaps |
|
117 | |
117 | |
|
118 | ; Function definitions |
118 | ; Function definitions |
|
119 | |
119 | |
|
120 | Func Terminate() |
120 | Func Terminate() |
|
121 | ConsoleWrite("Terminating..." & @CRLF) |
121 | ConsoleWrite("Terminating..." & @CRLF) |
|
122 | Send("{LSHIFT UP}") |
122 | Send("{LSHIFT UP}") |
|
123 | EndFunc ;==>Terminate |
123 | EndFunc ;==>Terminate |
|
124 | |
124 | |
|
125 | Func ToggleAutoRun() |
125 | Func ToggleAutoRun() |
|
126 | Switch _GetCaps() |
126 | Switch _GetCaps() |
|
127 | Case "ON" |
127 | Case "ON" |
|
128 | If $capsState == 0 Then |
128 | If $capsState == 0 Then |
|
129 | ConsoleWrite("Activating Auto Run" & @CRLF) |
129 | ConsoleWrite("Activating Auto Run" & @CRLF) |
|
130 | Send("{LSHIFT DOWN}") |
130 | Send("{LSHIFT DOWN}") |
|
131 | $capsState = 1 |
131 | $capsState = 1 |
|
132 | EndIf |
132 | EndIf |
|
133 | Case "OFF" |
133 | Case "OFF" |
|
134 | If $capsState == 1 Then |
134 | If $capsState == 1 Then |
|
135 | ConsoleWrite("Deactivating Auto Run." & @CRLF) |
135 | ConsoleWrite("Deactivating Auto Run." & @CRLF) |
|
136 | Send("{LSHIFT UP}") |
136 | Send("{LSHIFT UP}") |
|
137 | $capsState = 0 |
137 | $capsState = 0 |
|
138 | EndIf |
138 | EndIf |
|
139 | EndSwitch |
139 | EndSwitch |
|
140 | EndFunc ;==>ToggleAutoRun |
140 | EndFunc ;==>ToggleAutoRun |
|
141 | |
141 | |
|
142 | Func TrayMenuAbout() |
142 | Func TrayMenuAbout() |
|
143 | MsgBox($MB_SYSTEMMODAL, "", "AutoRun ~ Hold down shift button." & @CRLF & @CRLF & _ |
143 | MsgBox($MB_SYSTEMMODAL, "", "AutoRun ~ Hold down shift button." & @CRLF & @CRLF & _ |
|
144 | "Version: " & FileGetVersion(@ScriptFullPath) & @CRLF & _ |
144 | "Version: " & FileGetVersion(@ScriptFullPath) & @CRLF & _ |
|
145 | "Install Path: " & StringLeft(@AutoItExe, StringInStr(@AutoItExe, "\", $STR_NOCASESENSEBASIC, -1) - 1)) |
145 | "Install Path: " & StringLeft(@AutoItExe, StringInStr(@AutoItExe, "\", $STR_NOCASESENSEBASIC, -1) - 1)) |
|
146 | EndFunc ;==>TrayMenuAbout |
146 | EndFunc ;==>TrayMenuAbout |
|
147 | |
147 | |
|
148 | Func TrayMenuExit() |
148 | Func TrayMenuExit() |
|
149 | Exit |
149 | Exit |
|
150 | EndFunc ;==>TrayMenuExit |
150 | EndFunc ;==>TrayMenuExit |
|
151 | |
151 | |
|
152 | Func TrayMenuOff() |
152 | Func TrayMenuOff() |
|
153 | $scriptEnabled = 0 |
153 | $scriptEnabled = 0 |
|
154 | If $capsState == 1 Then |
154 | If $capsState == 1 Then |
|
155 | Send("{LSHIFT UP}") |
155 | Send("{LSHIFT UP}") |
|
156 | EndIf |
156 | EndIf |
|
157 | EndFunc ;==>TrayMenuOff |
157 | EndFunc ;==>TrayMenuOff |
|
158 | |
158 | |
|
159 | Func TrayMenuOn() |
159 | Func TrayMenuOn() |
|
160 | $scriptEnabled = 1 |
160 | $scriptEnabled = 1 |
|
161 | EndFunc ;==>TrayMenuOn |
161 | EndFunc ;==>TrayMenuOn |
|
162 | |
162 | |