autoit-scripts – Blame information for rev 8
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | #NoTrayIcon |
2 | #Region ;**** Directives created by AutoIt3Wrapper_GUI **** |
||
3 | #AutoIt3Wrapper_Icon=favicon.ico |
||
4 | #AutoIt3Wrapper_Outfile=Release\x86\AutoRun.exe |
||
5 | #AutoIt3Wrapper_Compression=0 |
||
6 | #AutoIt3Wrapper_Res_Comment=Hold shift key down in order to simulate autorun for games that do not have an autorun feature. |
||
7 | #AutoIt3Wrapper_Res_Description=Hold shift key down in order to simulate autorun for games that do not have an autorun feature. |
||
8 | office | 8 | #AutoIt3Wrapper_Res_Fileversion=1.0.0.15 |
1 | office | 9 | #AutoIt3Wrapper_Res_Fileversion_AutoIncrement=y |
10 | #AutoIt3Wrapper_Res_Fileversion_First_Increment=y |
||
11 | #AutoIt3Wrapper_Res_ProductName=AutoRun |
||
12 | #AutoIt3Wrapper_Res_ProductVersion=1.0 |
||
13 | #AutoIt3Wrapper_Res_CompanyName=Wizardry and Steamworks |
||
14 | #AutoIt3Wrapper_Res_LegalCopyright=Copyright © 2018 Wizardry and Steamworks |
||
15 | #AutoIt3Wrapper_Res_requestedExecutionLevel=asInvoker |
||
16 | #AutoIt3Wrapper_Res_Field=Made By|Wizardry and Steamworks |
||
17 | #AutoIt3Wrapper_Res_Field=Email|office@grimore.org |
||
18 | #AutoIt3Wrapper_Res_Field=AutoIt Version|%AutoItVer% |
||
19 | #AutoIt3Wrapper_Res_Field=Compile Date|%date% %time% |
||
20 | #AutoIt3Wrapper_AU3Check_Stop_OnWarning=y |
||
21 | #AutoIt3Wrapper_AU3Check_Parameters=-q -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 |
||
22 | #AutoIt3Wrapper_Run_After=for %I in ("%in%" "directives.au3") do copy %I "C:\Program Files (x86)\autoit3\SciTE\AutoIt3Wrapper" |
||
5 | office | 23 | #AutoIt3Wrapper_Run_After="C:\Program Files\7-Zip\7z.exe" a -sfx %scriptdir%\Deploy\AutoRunSFX.exe %out% |
1 | office | 24 | #AutoIt3Wrapper_Run_Tidy=y |
25 | #Tidy_Parameters=/sort_funcs /reel |
||
26 | #AutoIt3Wrapper_Run_Au3Stripper=y |
||
7 | office | 27 | #Au3Stripper_Parameters=/debug /sf /sv |
1 | office | 28 | #AutoIt3Wrapper_Versioning=v |
29 | #AutoIt3Wrapper_Versioning_Parameters=/Comments %fileversionnew% |
||
30 | #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** |
||
31 | |||
32 | ; Copyright 2018 Wizardry and Steamworks - MIT LICENSE |
||
33 | ; |
||
34 | ; Permission is hereby granted, free of charge, to any person obtaining a |
||
35 | ; copy of this software and associated documentation files (the Software), |
||
36 | ; to deal in the Software without restriction, including without |
||
37 | ; limitation the rights to use, copy, modify, merge, publish, distribute, |
||
38 | ; sublicense, and/or sell copies of the Software, and to permit persons to |
||
39 | ; whom the Software is furnished to do so, subject to the following |
||
40 | ; conditions: |
||
41 | ; |
||
42 | ; The above copyright notice and this permission notice shall be included |
||
43 | ; in all copies or substantial portions of the Software. |
||
44 | ; |
||
45 | ; THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
||
46 | ; IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
||
47 | ; FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
||
48 | ; THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR |
||
49 | ; OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, |
||
50 | ; ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
||
51 | ; OTHER DEALINGS IN THE SOFTWARE. |
||
52 | |||
8 | office | 53 | Global Const $VERSION = "1.0.0.15" |
1 | office | 54 | #AutoIt3Wrapper_Testing=n |
55 | #pragma compile(AutoItExecuteAllowed, true) |
||
56 | #AutoIt3Wrapper_ShowProgress=n |
||
57 | |||
58 | #include <WinAPISys.au3> |
||
59 | #include <WinAPIFiles.au3> |
||
60 | #include <WinAPIvkeysConstants.au3> |
||
7 | office | 61 | #include <StructureConstants.au3> |
62 | #include <WinAPIConstants.au3> |
||
63 | #include <WindowsConstants.au3> |
||
1 | office | 64 | #include <File.au3> |
65 | #include <FileConstants.au3> |
||
66 | #include <MsgBoxConstants.au3> |
||
67 | #include <AutoItConstants.au3> |
||
68 | #include <StringConstants.au3> |
||
7 | office | 69 | #include <Misc.au3> |
1 | office | 70 | ; Required for the $TRAY_CHECKED and $TRAY_ICONSTATE_SHOW constants. |
71 | #include <TrayConstants.au3> |
||
72 | |||
73 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
||
74 | ;; INTERNALS ;; |
||
75 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
||
76 | |||
77 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
||
78 | ;; MAIN LOOP ;; |
||
79 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
||
80 | |||
7 | office | 81 | ; Ensure only one instance of the program is running. |
82 | If _Singleton(@ScriptName, 1) = 0 Then |
||
83 | MsgBox($MB_SYSTEMMODAL, "Error", "An instance of this program is already running.") |
||
84 | Exit |
||
85 | EndIf |
||
1 | office | 86 | |
87 | ; Setup tray icon menu. |
||
88 | Opt("TrayMenuMode", 3) |
||
89 | Opt("TrayOnEventMode", 1) |
||
7 | office | 90 | Opt("SendKeyDelay", 0) |
1 | office | 91 | |
92 | TrayCreateItem("On", -1, -1, $TRAY_ITEM_RADIO) |
||
93 | TrayItemSetState(-1, $TRAY_CHECKED) |
||
94 | TrayItemSetOnEvent(-1, "TrayMenuOn") |
||
95 | TrayCreateItem("Off", -1, -1, $TRAY_ITEM_RADIO) |
||
96 | TrayItemSetOnEvent(-1, "TrayMenuOff") |
||
97 | TrayCreateItem("") |
||
98 | TrayCreateItem("About") |
||
99 | TrayItemSetOnEvent(-1, "TrayMenuAbout") |
||
100 | TrayCreateItem("Exit", -1, -1) |
||
101 | TrayItemSetOnEvent(-1, "TrayMenuExit") |
||
102 | |||
103 | ; -5 for EXE |
||
104 | TraySetIcon(@ScriptFullPath, -5) |
||
105 | TraySetState($TRAY_ICONSTATE_SHOW) |
||
106 | |||
7 | office | 107 | #Region Main Event Loop |
108 | ; Setup termination handler. |
||
109 | OnAutoItExitRegister("Terminate") |
||
1 | office | 110 | |
7 | office | 111 | Global $capsState = 0, $scriptEnabled = 1, $shiftPressed = 0 |
112 | |||
113 | ; Capture low-level shift button press. |
||
114 | Global $g_hStub_KeyProc = DllCallbackRegister("ProcessKey", "long", "int;wparam;lparam") |
||
115 | Global $g_hHook = _WinAPI_SetWindowsHookEx($WH_KEYBOARD_LL, DllCallbackGetPtr($g_hStub_KeyProc), _WinAPI_GetModuleHandle(0)) |
||
116 | |||
1 | office | 117 | While 1 |
118 | If $scriptEnabled == 1 Then |
||
7 | office | 119 | CheckCaps() |
1 | office | 120 | EndIf |
121 | Sleep(100) |
||
122 | WEnd |
||
7 | office | 123 | #EndRegion Main Event Loop |
1 | office | 124 | |
7 | office | 125 | #Region Function Definitions |
126 | Func CheckCaps() |
||
127 | Switch GetCaps() |
||
1 | office | 128 | Case "ON" |
7 | office | 129 | If $capsState == 0 Or $shiftPressed == 1 Then |
130 | ConsoleWrite("Activating Auto Run." & @CRLF) |
||
131 | Send("{LSHIFT UP}") |
||
1 | office | 132 | Send("{LSHIFT DOWN}") |
133 | $capsState = 1 |
||
7 | office | 134 | $shiftPressed = 0 |
1 | office | 135 | EndIf |
136 | Case "OFF" |
||
137 | If $capsState == 1 Then |
||
138 | ConsoleWrite("Deactivating Auto Run." & @CRLF) |
||
139 | Send("{LSHIFT UP}") |
||
140 | $capsState = 0 |
||
141 | EndIf |
||
142 | EndSwitch |
||
7 | office | 143 | EndFunc ;==>CheckCaps |
1 | office | 144 | |
7 | office | 145 | Func GetCaps() |
146 | Local $aOnOff[2] = ['OFF', 'ON'] |
||
147 | Return $aOnOff[BitAND(_WinAPI_GetKeyState($VK_CAPITAL), 1)] |
||
148 | EndFunc ;==>GetCaps |
||
149 | |||
150 | Func ProcessKey($nCode, $wParam, $lParam) |
||
151 | Local $tKEYHOOKS = DllStructCreate($tagKBDLLHOOKSTRUCT, $lParam) |
||
152 | If $nCode < 0 Then |
||
153 | Return _WinAPI_CallNextHookEx($g_hHook, $nCode, $wParam, $lParam) |
||
154 | EndIf |
||
155 | If $wParam == $WM_KEYUP Then |
||
156 | Local $vkCode = DllStructGetData($tKEYHOOKS, "vkCode") |
||
157 | Switch $vkCode |
||
158 | Case 160 |
||
159 | ConsoleWrite("Left shift pressed..." & @CRLF) |
||
160 | $shiftPressed = 1 |
||
161 | EndSwitch |
||
162 | EndIf |
||
163 | Return _WinAPI_CallNextHookEx($g_hHook, $nCode, $wParam, $lParam) |
||
164 | EndFunc ;==>ProcessKey |
||
165 | |||
166 | Func ShiftPress() |
||
167 | ConsoleWrite("shift pressed..." & @CRLF) |
||
168 | EndFunc ;==>ShiftPress |
||
169 | |||
170 | Func Terminate() |
||
171 | ConsoleWrite("Terminating..." & @CRLF) |
||
172 | $scriptEnabled = 0 |
||
173 | If $capsState == 1 Then |
||
174 | Send("{LSHIFT UP}") |
||
175 | EndIf |
||
176 | _WinAPI_UnhookWindowsHookEx($g_hHook) |
||
177 | DllCallbackFree($g_hStub_KeyProc) |
||
178 | EndFunc ;==>Terminate |
||
179 | |||
1 | office | 180 | Func TrayMenuAbout() |
7 | office | 181 | MsgBox($MB_SYSTEMMODAL, "", "AutoRun: Hold down shift button to simulate autorun for games." & @CRLF & _ |
182 | "(c) 2018 Wizardry and Steamworks, MIT License." & @CRLF & @CRLF & _ |
||
1 | office | 183 | "Version: " & FileGetVersion(@ScriptFullPath) & @CRLF & _ |
7 | office | 184 | "Path: " & @ScriptFullPath) |
1 | office | 185 | EndFunc ;==>TrayMenuAbout |
186 | |||
187 | Func TrayMenuExit() |
||
188 | Exit |
||
189 | EndFunc ;==>TrayMenuExit |
||
190 | |||
191 | Func TrayMenuOff() |
||
192 | $scriptEnabled = 0 |
||
193 | If $capsState == 1 Then |
||
194 | Send("{LSHIFT UP}") |
||
195 | EndIf |
||
196 | EndFunc ;==>TrayMenuOff |
||
197 | |||
198 | Func TrayMenuOn() |
||
199 | $scriptEnabled = 1 |
||
200 | EndFunc ;==>TrayMenuOn |
||
7 | office | 201 | #EndRegion Function Definitions |