-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMy Scripts.ahk
277 lines (237 loc) · 14.4 KB
/
My Scripts.ahk
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
/************************************************************************
* @description The central "hub" script for my entire repo. Handles most windows scripts + some editing scripts.
* The ahk version listed below is the version I am using while generating the current release (so the version that is being tested on)
* @file My Scripts.ahk
* @author Tomshi
* @date 2024/12/12
* @version v2.15.1
* @ahk_ver 2.0.18
***********************************************************************/
;\\CURRENT SCRIPT VERSION\\This is a "script" local version and doesn't relate to the Release Version
;\\v2.34.11
#SingleInstance Force
#Requires AutoHotkey v2.0
; { \\ #Includes
#Include <Classes\Settings>
#Include <Classes\ptf>
#Include <KSA\Keyboard Shortcut Adjustments>
#Include <Classes\Apps\Discord>
#Include <Classes\Apps\VSCode>
#Include <Classes\Editors\After Effects>
#Include <Classes\Editors\Photoshop>
#Include <Classes\Editors\Premiere>
#Include <Classes\tool>
#Include <Classes\block>
#Include <Classes\coord>
#Include <Classes\switchTo>
#Include <Classes\Move>
#Include <Classes\winget>
#Include <Classes\Startup>
#Include <Classes\obj>
#Include <Classes\clip>
#Include <Classes\reset>
#Include <Classes\keys>
#Include <Classes\errorLog>
#Include <Classes\Streamdeck_opt>
#Include <Functions\mouseDrag>
#Include <Functions\getLocalVer>
#Include <Functions\fastWheel>
#Include <Functions\youMouse>
#Include <Functions\jumpChar>
#Include <Functions\refreshWin>
#Include <Functions\getHotkeys>
#Include <Functions\alwaysOnTop>
#Include <Functions\pauseYT>
#Include <Functions\delaySI>
#Include <Functions\isDoubleClick>
#Include <Functions\multiKeyPress>
#Include <GUIs\settingsGUI\settingsGUI>
#Include <GUIs\activeScripts>
#Include <GUIs\hotkeysGUI>
;#Include Premiere_RightClick.ahk ;this file is included towards the bottom of the script - it was stopping the below `startup functions` from firing
; }
;//! Setting up script defaults.
SetWorkingDir(ptf.rootDir) ;sets the scripts working directory to the directory it's launched from
SetNumLockState("AlwaysOn") ;sets numlock to always on (you can still it for macros)
SetCapsLockState("AlwaysOff") ;sets caps lock to always off (you can still it for macros)
SetScrollLockState("AlwaysOff") ;sets scroll lock to always off (you can still it for macros)
SetDefaultMouseSpeed(0) ;sets default MouseMove speed to 0 (instant)
SetWinDelay(0) ;sets default WinMove speed to 0 (instant)
A_MaxHotkeysPerInterval := 400 ;BE VERY CAREFUL WITH THIS SETTING. If you make this value too high, you could run into issues if you accidentally create an infinite loop
A_MenuMaskKey := "vkD7" ;necessary for `alt_menu_acceleration_disabler.ahk` to work correctly
TraySetIcon(ptf.Icons "\myscript.png") ;changes the icon this script uses in the taskbar
; ============================================================================================================================================
;
; THIS SCRIPT IS DESIGNED FOR v2.0 OF AUTOHOTKEY
; IT WILL NOT RUN IN v1.1
; --------------------------------------------------------------------------------
; Everything in this script is functional within v2.0
; any code like `errorLog()` or `hardReset()` etc are all functions and defined
; in the various `..\lib\Functions` scripts. Look there for specific code to edit.
;
; any code like `block.On()` or `tool.Cust()` etc are functions within a class
; and also defined within the various `..\lib\Classes\` scripts.
;
; ============================================================================================================================================
;
; This script was created by & for Tomshi (https://www.youtube.com/c/tomshiii, https://www.twitch.tv/tomshi)
; Its purpose is to help speed up editing and random interactions with windows.
; Copyright (C) <2023> <Tom Tomshi>
;
; You are free to modify this script to your own personal uses/needs, but you must follow the terms shown in the license file in the root directory of this repo (basically just keep source code available)
; You should have received a copy of the GNU General Public License along with this script. If not, see <https://www.gnu.org/licenses/>
;
; Please give credit to the foundation if you build on top of it, similar to how I have below, otherwise you're free to do as you wish
; Youtube playlist going through some of my AHK changes/updates (https://www.youtube.com/playlist?list=PL8txOlLUZiqXXr2PNOsNSXeCB1171lQ1b)
;
; ============================================================================================================================================
; A chunk of the code in the original versions of this script was either directly inspired by, or originally copied from Taran, a previous editor for LTT (https://github.com/TaranVH/)
; I eventually modified some of his code to work with v2.0 of ahk and continued to adapt and modify things for my own workflow. His videos on the subject are what got me into AHK to begin with and what brought the foundation of the original version of this script to life.
; These scripts now contain mostly my own work with some code from others here and there, this code is usually referenced/linked in comments.
; I use a streamdeck to run a lot of my scripts which is why a bunch of them are separated out into their own scripts in the \Streamdeck AHK\ folder.
; I use to use notepad++ to edit this script, if you want proper syntax highlighting in notepad++ for ahk go here: https://www.autohotkey.com/boards/viewtopic.php?t=50
; I now use VSCode which can be found here: https://code.visualstudio.com/
; AHK (and v2.0) syntax highlighting can be installed within the program itself.
; If you EVER get stuck in some code within any of these scripts REFRESH THE SCRIPT - by default I have it set to `win + shift + r` - and it will work anywhere (unless you're clicked on a program run as admin) if refreshing doesn't work open up task manager with ctrl + shift + esc and use your keyboard to find all instances of autohotkey and force close them.
; If you encounter any issues with these scripts, feel free to submit an issue on the github repo: https://www.github.com/tomshiii/ahk/
; If you wish to contribute to these scripts, feel free to submit a pull request on the repo (fork the repo, then submitt a pull request of your fork)
; =======================================================================================================================================
;
;
; STARTUP
;
; =======================================================================================================================================
start := Startup()
start.generate() ;generates/replaces the `settings.ini` file every release
SD_Opt().checkCount() ;checks the streamdeck `options.ini` file to ensure the user has all settings
start.updateChecker() ;runs the update checker
start.updatePackages(,,,, ["vcredist"]) ;checks for updates to packages installed through choco by default
start.trayMen() ;adds the ability to toggle checking for updates when you right click on this scripts tray icon
start.firstCheck() ;runs the firstCheck() function
start.oldLogs() ;runs the loop to delete old log files
start.adobeTemp() ;runs the loop to delete cache files
start.adobeVerOverride() ;attempts to automatically set premiere/after effects versions
start.libUpdateCheck() ;runs a loop to check for lib updates
start.updateAHK() ;checks for a newer version of ahk and alerts the user asking if they wish to download it
start.monitorAlert() ;checks the users monitor work area for any changes
start.checkShortcuts() ;attempts to create shortcuts if they haven't already been generated
start.__Delete()
;// so streamdeck scripts can receive premiere timeline coords
onMsgObj := ObjBindMethod(WM, "__recieveMessage")
OnMessage(0x004A, onMsgObj.Bind()) ; 0x004A is WM_COPYDATA
;=============================================================================================================================================
;
; Windows
;
;=============================================================================================================================================
;//! code below here (until the next #HotIf) will work anywhere
#HotIf
;// these scripts need to be separated out because if any of them are under a hotif with the `GetKeyState` conditional, they lag out because the getkeystate check can't keep up
;// this is only really necessary because the `fastwheel()` functions rapidly fire inputs, any other F14 hotkeys are then only in here because if they are split into other #HotIf's
;// and those hotif's have conditionals that are slow, ahk has to check all of those conditionals and thus drags `fastwheel()` down with it
#Include <My Scripts\F14 Mouse Scripts>
;//! code below here (until the next #HotIf) will work anywhere as long as F24 is not being held
#HotIf !GetKeyState("F24", "P")
;//! Suspend Exempt
#SuspendExempt
#Include <My Scripts\Windows_SE>
#SuspendExempt false
;//! NOT Suspend Exempt
#Include <My Scripts\Windows>
;//! windows explorer
#HotIf WinActive("ahk_class CabinetWClass") || WinActive("ahk_class #32770")
#Include <My Scripts\Windows_Explorer>
;=============================================================================================================================================
;
; VSCODE
;
;=============================================================================================================================================
;//! VSCode
#HotIf WinActive(vscode.winTitle)
#Include <My Scripts\VSCode>
;=============================================================================================================================================
;
; FIREFOX
;
;=============================================================================================================================================
;//! Firefox
#HotIf WinActive(browser.firefox.winTitle)
#Include <My Scripts\Firefox>
;=============================================================================================================================================
;
; Discord
;
;=============================================================================================================================================
;//! Discord
#HotIf WinActive(discord.winTitle) ;some scripts to speed up discord interactions
#Include <My Scripts\Discord>
;=============================================================================================================================================
;
; Slack
;
;=============================================================================================================================================
;//! Slack
#HotIf WinActive(Slack.winTitle) ;some scripts to speed up Slack interactions
#Include <My Scripts\Slack>
;=============================================================================================================================================
;
; mpv
;
;=============================================================================================================================================
;//! mpv
#HotIf WinActive(ptf.mpvWintitle)
#Include <My Scripts\mpv>
;=============================================================================================================================================
;
; obsidian
;
;=============================================================================================================================================
;//! obsidian
#HotIf WinActive(ptf.obsidianWintitle)
#Include <My Scripts\obsidian>
;=============================================================================================================================================
;
; Photoshop
;
;=============================================================================================================================================
;//! Photoshop
#HotIf WinActive(editors.Photoshop.winTitle) && !GetKeyState("F24")
#Include <My Scripts\Photoshop>
;=============================================================================================================================================
;
; After Effects
;
;=============================================================================================================================================
;//! After Effects
#HotIf WinActive(editors.AE.winTitle) && !GetKeyState("F24")
#Include <My Scripts\AE>
;=============================================================================================================================================
;
; Premiere
;
;=============================================================================================================================================
;//! Premiere
#HotIf WinActive(editors.Premiere.winTitle) && !GetKeyState("F24")
#Include <My Scripts\Premiere>
;=============================================================================================================================================
;
; other - NOT an editor
;
;=============================================================================================================================================
;//! Anything that isn't in the Editors Group
#HotIf not WinActive("ahk_group Editors") && !GetKeyState("F24") ;code below here (until the next #HotIf) will trigger as long as premiere pro & after effects aren't active
#Include <My Scripts\Not Editor>
;---------------------------------------------------------------------------------------------------------------------------------------------
;
; Premiere F14/position specific scripts
;
;---------------------------------------------------------------------------------------------------------------------------------------------
;//! Further Premiere Mouse Scripts
;//* having these scripts above with the other premiere scripts caused `wheelup` and `wheeldown` hotkeys to lag out and cause windows beeping
;//* thanks ahk :)
#HotIf WinActive(editors.Premiere.winTitle) && !GetKeyState("F24")
;// I have this here instead of running it separately because sometimes if the main script loads after this one things get funky and break because of priorities and stuff
#Include <Classes\Editors\Premiere_RightClick>
;//? Attempts to stop adobe fs.ahk from freaking out at times
;stopfullscreenpremHotkey;
Ctrl & \::return