autoit-scripts – Diff between revs 6 and 7
?pathlinks?
Rev 6 | Rev 7 | |||
---|---|---|---|---|
Line 1... | Line 1... | |||
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 |
- | ||
6 | #AutoIt3Wrapper_Compression=0 |
5 | #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. |
6 | #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. |
7 | #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.11 |
8 | #AutoIt3Wrapper_Res_Fileversion=1.0.0.14 |
|
10 | #AutoIt3Wrapper_Res_Fileversion_AutoIncrement=y |
9 | #AutoIt3Wrapper_Res_Fileversion_AutoIncrement=y |
|
11 | #AutoIt3Wrapper_Res_Fileversion_First_Increment=y |
10 | #AutoIt3Wrapper_Res_Fileversion_First_Increment=y |
|
12 | #AutoIt3Wrapper_Res_ProductName=AutoRun |
11 | #AutoIt3Wrapper_Res_ProductName=AutoRun |
|
13 | #AutoIt3Wrapper_Res_ProductVersion=1.0 |
12 | #AutoIt3Wrapper_Res_ProductVersion=1.0 |
|
14 | #AutoIt3Wrapper_Res_CompanyName=Wizardry and Steamworks |
13 | #AutoIt3Wrapper_Res_CompanyName=Wizardry and Steamworks |
|
Line 23... | Line 22... | |||
23 | #AutoIt3Wrapper_Run_After=for %I in ("%in%" "directives.au3") do copy %I "C:\Program Files (x86)\autoit3\SciTE\AutoIt3Wrapper" |
22 | #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 %scriptdir%\Deploy\AutoRunSFX.exe %out% |
23 | #AutoIt3Wrapper_Run_After="C:\Program Files\7-Zip\7z.exe" a -sfx %scriptdir%\Deploy\AutoRunSFX.exe %out% |
|
25 | #AutoIt3Wrapper_Run_Tidy=y |
24 | #AutoIt3Wrapper_Run_Tidy=y |
|
26 | #Tidy_Parameters=/sort_funcs /reel |
25 | #Tidy_Parameters=/sort_funcs /reel |
|
27 | #AutoIt3Wrapper_Run_Au3Stripper=y |
26 | #AutoIt3Wrapper_Run_Au3Stripper=y |
|
28 | #Au3Stripper_Parameters=/debug |
27 | #Au3Stripper_Parameters=/debug /sf /sv |
|
29 | #AutoIt3Wrapper_Versioning=v |
28 | #AutoIt3Wrapper_Versioning=v |
|
30 | #AutoIt3Wrapper_Versioning_Parameters=/Comments %fileversionnew% |
29 | #AutoIt3Wrapper_Versioning_Parameters=/Comments %fileversionnew% |
|
31 | #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** |
30 | #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** |
|
Line 32... | Line 31... | |||
32 | |
31 | |
|
Line 49... | Line 48... | |||
49 | ; THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR |
48 | ; THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR |
|
50 | ; OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, |
49 | ; 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 |
50 | ; ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
|
52 | ; OTHER DEALINGS IN THE SOFTWARE. |
51 | ; OTHER DEALINGS IN THE SOFTWARE. |
|
Line 53... | Line 52... | |||
53 | |
52 | |
|
54 | Global Const $VERSION = "1.0.0.11" |
53 | Global Const $VERSION = "1.0.0.14" |
|
55 | #AutoIt3Wrapper_Testing=n |
54 | #AutoIt3Wrapper_Testing=n |
|
56 | #pragma compile(AutoItExecuteAllowed, true) |
55 | #pragma compile(AutoItExecuteAllowed, true) |
|
Line 57... | Line 56... | |||
57 | #AutoIt3Wrapper_ShowProgress=n |
56 | #AutoIt3Wrapper_ShowProgress=n |
|
58 | |
57 | |
|
59 | #include <WinAPISys.au3> |
58 | #include <WinAPISys.au3> |
|
- | 59 | #include <WinAPIFiles.au3> |
||
- | 60 | #include <WinAPIvkeysConstants.au3> |
||
- | 61 | #include <StructureConstants.au3> |
||
60 | #include <WinAPIFiles.au3> |
62 | #include <WinAPIConstants.au3> |
|
61 | #include <WinAPIvkeysConstants.au3> |
63 | #include <WindowsConstants.au3> |
|
62 | #include <File.au3> |
64 | #include <File.au3> |
|
63 | #include <FileConstants.au3> |
65 | #include <FileConstants.au3> |
|
64 | #include <MsgBoxConstants.au3> |
66 | #include <MsgBoxConstants.au3> |
|
- | 67 | #include <AutoItConstants.au3> |
||
65 | #include <AutoItConstants.au3> |
68 | #include <StringConstants.au3> |
|
66 | #include <StringConstants.au3> |
69 | #include <Misc.au3> |
|
67 | ; Required for the $TRAY_CHECKED and $TRAY_ICONSTATE_SHOW constants. |
70 | ; Required for the $TRAY_CHECKED and $TRAY_ICONSTATE_SHOW constants. |
|
68 | #include <TrayConstants.au3> |
71 | #include <TrayConstants.au3> |
|
Line 75... | Line 78... | |||
75 | |
78 | |
|
76 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
79 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
|
77 | ;; MAIN LOOP ;; |
80 | ;; MAIN LOOP ;; |
|
Line 78... | Line 81... | |||
78 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
81 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
|
79 | |
82 | |
|
- | 83 | ; Ensure only one instance of the program is running. |
||
- | 84 | If _Singleton(@ScriptName, 1) = 0 Then |
||
- | 85 | MsgBox($MB_SYSTEMMODAL, "Error", "An instance of this program is already running.") |
||
Line 80... | Line 86... | |||
80 | ; Setup termination handler. |
86 | Exit |
|
81 | OnAutoItExitRegister("Terminate") |
87 | EndIf |
|
82 | |
88 | |
|
83 | ; Setup tray icon menu. |
89 | ; Setup tray icon menu. |
|
Line 84... | Line 90... | |||
84 | Opt("TrayMenuMode", 3) |
90 | Opt("TrayMenuMode", 3) |
|
85 | Opt("TrayOnEventMode", 1) |
91 | Opt("TrayOnEventMode", 1) |
|
86 | Opt("SendCapslockMode", 0) |
92 | Opt("SendKeyDelay", 0) |
|
87 | |
93 | |
|
Line 98... | Line 104... | |||
98 | |
104 | |
|
99 | ; -5 for EXE |
105 | ; -5 for EXE |
|
100 | TraySetIcon(@ScriptFullPath, -5) |
106 | TraySetIcon(@ScriptFullPath, -5) |
|
Line -... | Line 107... | |||
- | 107 | TraySetState($TRAY_ICONSTATE_SHOW) |
||
- | 108 | |
||
- | 109 | #Region Main Event Loop |
||
- | 110 | ; Setup termination handler. |
||
101 | TraySetState($TRAY_ICONSTATE_SHOW) |
111 | OnAutoItExitRegister("Terminate") |
|
- | 112 | |
||
- | 113 | Global $capsState = 0, $scriptEnabled = 1, $shiftPressed = 0 |
||
- | 114 | |
||
- | 115 | ; Capture low-level shift button press. |
||
Line 102... | Line -... | |||
102 | |
- | ||
103 | Global $capsState = 0, $scriptEnabled = 1 |
116 | Global $g_hStub_KeyProc = DllCallbackRegister("ProcessKey", "long", "int;wparam;lparam") |
|
104 | |
117 | Global $g_hHook = _WinAPI_SetWindowsHookEx($WH_KEYBOARD_LL, DllCallbackGetPtr($g_hStub_KeyProc), _WinAPI_GetModuleHandle(0)) |
|
105 | ; Run main event loop. |
118 | |
|
106 | While 1 |
119 | While 1 |
|
107 | If $scriptEnabled == 1 Then |
120 | If $scriptEnabled == 1 Then |
|
108 | ToggleAutoRun() |
121 | CheckCaps() |
|
- | 122 | EndIf |
||
Line 109... | Line -... | |||
109 | EndIf |
- | ||
110 | Sleep(100) |
- | ||
111 | WEnd |
- | ||
112 | |
- | ||
113 | Func _GetCaps() |
- | ||
114 | Local $aOnOff[2] = ['OFF', 'ON'] |
123 | Sleep(100) |
|
115 | Return $aOnOff[BitAND(_WinAPI_GetKeyState($VK_CAPITAL), 1)] |
- | ||
116 | EndFunc ;==>_GetCaps |
124 | WEnd |
|
117 | |
- | ||
118 | ; Function definitions |
- | ||
119 | |
- | ||
120 | Func Terminate() |
- | ||
121 | ConsoleWrite("Terminating..." & @CRLF) |
- | ||
122 | Send("{LSHIFT UP}") |
125 | #EndRegion Main Event Loop |
|
123 | EndFunc ;==>Terminate |
126 | |
|
124 | |
127 | #Region Function Definitions |
|
125 | Func ToggleAutoRun() |
128 | Func CheckCaps() |
|
- | 129 | Switch GetCaps() |
||
126 | Switch _GetCaps() |
130 | Case "ON" |
|
127 | Case "ON" |
131 | If $capsState == 0 Or $shiftPressed == 1 Then |
|
- | 132 | ConsoleWrite("Activating Auto Run." & @CRLF) |
||
128 | If $capsState == 0 Then |
133 | Send("{LSHIFT UP}") |
|
129 | ConsoleWrite("Activating Auto Run" & @CRLF) |
134 | Send("{LSHIFT DOWN}") |
|
130 | Send("{LSHIFT DOWN}") |
135 | $capsState = 1 |
|
131 | $capsState = 1 |
136 | $shiftPressed = 0 |
|
132 | EndIf |
137 | EndIf |
|
133 | Case "OFF" |
138 | Case "OFF" |
|
134 | If $capsState == 1 Then |
139 | If $capsState == 1 Then |
|
135 | ConsoleWrite("Deactivating Auto Run." & @CRLF) |
140 | ConsoleWrite("Deactivating Auto Run." & @CRLF) |
|
- | 141 | Send("{LSHIFT UP}") |
||
- | 142 | $capsState = 0 |
||
- | 143 | EndIf |
||
- | 144 | EndSwitch |
||
- | 145 | EndFunc ;==>CheckCaps |
||
- | 146 | |
||
- | 147 | Func GetCaps() |
||
- | 148 | Local $aOnOff[2] = ['OFF', 'ON'] |
||
- | 149 | Return $aOnOff[BitAND(_WinAPI_GetKeyState($VK_CAPITAL), 1)] |
||
- | 150 | EndFunc ;==>GetCaps |
||
- | 151 | |
||
- | 152 | Func ProcessKey($nCode, $wParam, $lParam) |
||
- | 153 | Local $tKEYHOOKS = DllStructCreate($tagKBDLLHOOKSTRUCT, $lParam) |
||
- | 154 | If $nCode < 0 Then |
||
- | 155 | Return _WinAPI_CallNextHookEx($g_hHook, $nCode, $wParam, $lParam) |
||
- | 156 | EndIf |
||
- | 157 | If $wParam == $WM_KEYUP Then |
||
- | 158 | Local $vkCode = DllStructGetData($tKEYHOOKS, "vkCode") |
||
- | 159 | Switch $vkCode |
||
- | 160 | Case 160 |
||
- | 161 | ConsoleWrite("Left shift pressed..." & @CRLF) |
||
- | 162 | $shiftPressed = 1 |
||
- | 163 | EndSwitch |
||
- | 164 | EndIf |
||
- | 165 | Return _WinAPI_CallNextHookEx($g_hHook, $nCode, $wParam, $lParam) |
||
- | 166 | EndFunc ;==>ProcessKey |
||
- | 167 | |
||
- | 168 | Func ShiftPress() |
||
- | 169 | ConsoleWrite("shift pressed..." & @CRLF) |
||
- | 170 | EndFunc ;==>ShiftPress |
||
- | 171 | |
||
- | 172 | Func Terminate() |
||
- | 173 | ConsoleWrite("Terminating..." & @CRLF) |
||
- | 174 | $scriptEnabled = 0 |
||
- | 175 | If $capsState == 1 Then |
||
136 | Send("{LSHIFT UP}") |
176 | Send("{LSHIFT UP}") |
|
Line 137... | Line 177... | |||
137 | $capsState = 0 |
177 | EndIf |
|
138 | EndIf |
178 | _WinAPI_UnhookWindowsHookEx($g_hHook) |
|
- | 179 | DllCallbackFree($g_hStub_KeyProc) |
||
139 | EndSwitch |
180 | EndFunc ;==>Terminate |
|
140 | EndFunc ;==>ToggleAutoRun |
181 | |
|
141 | |
182 | Func TrayMenuAbout() |
|
Line 142... | Line 183... | |||
142 | Func TrayMenuAbout() |
183 | MsgBox($MB_SYSTEMMODAL, "", "AutoRun: Hold down shift button to simulate autorun for games." & @CRLF & _ |
|
143 | MsgBox($MB_SYSTEMMODAL, "", "AutoRun ~ Hold down shift button." & @CRLF & @CRLF & _ |
184 | "(c) 2018 Wizardry and Steamworks, MIT License." & @CRLF & @CRLF & _ |
|
144 | "Version: " & FileGetVersion(@ScriptFullPath) & @CRLF & _ |
185 | "Version: " & FileGetVersion(@ScriptFullPath) & @CRLF & _ |
|
Line 157... | Line 198... | |||
157 | EndFunc ;==>TrayMenuOff |
198 | EndFunc ;==>TrayMenuOff |
|
Line 158... | Line 199... | |||
158 | |
199 | |
|
159 | Func TrayMenuOn() |
200 | Func TrayMenuOn() |
|
160 | $scriptEnabled = 1 |
201 | $scriptEnabled = 1 |
|
- | 202 | EndFunc ;==>TrayMenuOn |