forked from TaranVH/2nd-keyboard
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Almost_All_Premiere_Functions.ahk
2151 lines (1827 loc) · 75.9 KB
/
Almost_All_Premiere_Functions.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
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
SetWorkingDir, C:\AHK\2nd-keyboard\support_files
;the above will supposedly set A_WorkingDir. It MUST be done in the autoexecute area, BEFORE the code below.
;SetWorkingDir, C:\Users\TaranWORK\Documents\GitHub\2nd-keyboard\2nd keyboard support files
#NoEnv
Menu, Tray, Icon, shell32.dll, 283 ; this changes the tray icon to a little keyboard!
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
#SingleInstance force ;only one instance of this script may run at a time!
#MaxHotkeysPerInterval 2000
#WinActivateForce ;https://autohotkey.com/docs/commands/_WinActivateForce.htm
;-------------------------------------------------------------------------
; HELLO PEOPLES!
; IF YOU ARE NEW TO AUTOHOTKEY, YOU MUST AT LEAST TAKE THE FOLLOWING TUTORIAL:
; https://autohotkey.com/docs/Tutorial.htm
;
; You will need to know some basic scripting to custom tailor most
; of these scripts to your own machine, if you want to use them!
;
; CHECK OUT MY BIG TUTORIAL FOR SOME EXPLANATION OF HOW THESE
; AHK SCRIPTS WORK, AND HOW THEY COMMUNICATE WITH ONE ANOTHER.
; https://youtu.be/O6ERELse_QY?t=20m7s
;
; VERY IMPORTANT NOTE:
; This file works in tandem with ALL_MULTIPLE_KEYBOARD_ASSIGNMENTS.ahk.
; All the functions from HERE are actually CALLED from keyboard shortcuts
; in THAT script. I had to do it this way because of the Stream Deck(s)...
; But you can put your key bindings and functions in the same script if
; you want.
;
; You also need to read from around line 90 of ALL_MULTIPLE_KEYBOARD_ASSIGNMENTS.ahk.
; to see which keybaord shortcut assignements are necessary to make these scripts work.
;
; I reccomend that you only copy the functions that you need.
; Add one at a time or it will be overwhelming!
;
; All the code in my github repo is free for you to use and change as you please.
; Just don't try to sell it, and we cool.
;------------------------------------------------------------------------
;the variable below POSSIBLY exists for the purpose of communicaiton with gui.ahk if a script is launched from the Stream Deck.
TargetScriptTitle = "C:\AHK\2nd-keyboard\gui.ahk ahk_class AutoHotkey"
;but apparently I do not know for sure...
recallTransition(foo) ;this was a part of the luamacros scripts.
{
;Do nothing.
msgbox, the recallTransition function was deleted cause it never worked very well.
}
;;;;;;non luamacros stuff begins now.;;;;;
;;;;;;temporary tooltip maker;;;;;;
Tippy(tipsHere, wait:=333)
{
ToolTip, %tipsHere% TP,,,8
SetTimer, noTip, %wait% ;--in 1/3 seconds by default, remove the tooltip
}
noTip:
ToolTip,,,,8
;removes the tooltip
return
;;;;;;/temporary tooltip maker;;;;;;
#IfWinActive ahk_exe Adobe Premiere Pro.exe ;---EVERYTHING BELOW THIS LINE WILL ONLY WORK INSIDE PREMIERE PRO! (until canceled with a lone "#IfWinActive")
;is the above line really necessary? i dont think so, but i am afraid to touch it.
monitorKeys(whichMonitor,shortcut,useSpace := 1)
{
;msgbox,,, useSpace is %useSpace%,1
if WinActive("ahk_exe Adobe Premiere Pro.exe") ;AHA, it is better to use the EXE, because if you are in a secondary monitor window, then the CLASS is not active even though the EXE still is, mildly interesssstting.
{
;IDK if I need to set a coordmode here?
; coordmode, pixel, Window
; coordmode, mouse, Window
; coordmode, Caret, Window
if (whichMonitor = "source")
{
x := "1800"
y := "500"
;;tooltip, source here
;coordinates that are very likely to be within my Source Monitor's usual area
}
else
{
x := "3300"
y := "500"
;;tooltip, program here
whichMonitor = "program" ;just in case it was not defined properly, it becomes "program" by default.
;coordinates that are very likely to be within my Program Monitor's usual area
}
; tooltip, x y is %x% %y%
; sleep, 500
;testing some sheeit
x := "1800"
y := "500"
ActiveHwnd := WinExist("A")
windowWidth := CoordGetControl(x,y, ActiveHwnd)
; tooltip, ActiveHwnd is %ActiveHwnd%
; sleep, 500
; tooltip, windowWidth is %windowWidth%
; sleep, 500
if (windowWidth < 2000) ;this means that the monitor is NOT maximized
{
; tooltip, we in here now
; sleep 500
if (whichMonitor = "source"){
prFocus("source") ;keep in mind, this FIRST brings focus to the Effects panel
;tooltip, u in SOURCE LAND
; sleep 500
}
else
{
prFocus("program") ;keep in mind, this FIRST brings focus to the Effects panel
;tooltip, u in program LAND
}
sleep 20
}
sleep 30 ;sometimes these shortcuts don't "take" without a bit of delay.
sendinput, %shortcut%
;so, the above would be translated to sendinput, ^+2 or something like that.
; if (shortcut = "^{numpad3}") or if (shortcut = "^+1")
; {
; sleep 30
; sendinput, %shortcut%
; ;Premiere 12.0.1 is SLOOOWWW to react to these shortcuts in particular. (Source monitor resolution to 1/4) and (program monitor res to 1/1) So I gotta WAIT AROUND and send this TWICE.
; }
; if (shortcut = "^{numpad2}")
; {
; send, {CTRL UP}
; sleep 10
; send, {CTRL DOWN}
; sleep 10
; send, {CTRL UP}
; sleep 10
; }
;THE CODE BELOW IS SUPER OPTIONAL
if (windowWidth > 2000) ;if the monitor in question IS maximized...
{
;tooltip, %shortcut% boy
;Then it's not obvious which monitor it is, and it's possible that I misremembered, and pressed the wrong button. Therefore, I will ALSO send the shortcut that corresponds to the alternative monitor.
if (shortcut = "^{numpad1}")
{
;sleep 30
;tooltip, yeah ctrl numpad 1
sendinput, ^+1
}
if (shortcut = "^{numpad2}")
{
;tooltip, seriously wtf is %shortcut%
sendinput, ^+2
}
if (shortcut = "^{numpad5}")
{
;sleep 30
;tooltip, yeah ctrl numpad 5
sendinput, ^+2
}
if (shortcut = "^{numpad3}")
sendinput, ^+3
if (shortcut = "^+1")
{
;tooltip, taran whyyy
sendinput, ^{numpad1}
}
if (shortcut = "^+2")
{
;sleep 30
sendinput, ^{numpad2}
}
if (shortcut = "^+3")
{
;sleep 30
sendinput, ^{numpad3}
}
;and now for the safe margins
if (shortcut = "^!+[")
sendinput, ^!+]
if (shortcut = "^!+]")
sendinput, ^!+[
}
;THE CODE ABOVE IS SUPER OPTIONAL
;i might have to comment this back in vvvvv
if (windowWidth < 2000) ;again, if the monitor in question is NOT already maximized...
if not (whichMonitor = "source") ;stay on the source (program?) monitor if it is active
{
prFocus("timeline")
;tooltip, this is why
}
;;; that ^^^^^
;if (useSpace = "0")
;tooltip, we are NOT NOT NOT spacing
;;optional:
if (useSpace = "1")
{
;tooltip, we are spacing
sendinput, {space} ;if playing/paused, pause/play the video.
sleep 50
sendinput, {space} ;if playing/paused, pause/play the video.
;;this allows the new playback resolution to take effect.
}
}
;if you are not in Premiere Pro, the function is skipped
; if not WinActive("ahk_exe Adobe Premiere Pro.exe")
; msgbox,,, pr is not active,1
; ; ;if you use the ahk_class, even if you have an active Premiere window on another monitor, unless it is the MAIN monitor, it doesn't count.
}
;end of monitorKeys()
prFocus(panel) ;this function allows you to have ONE spot where you define your personal shortcuts that "focus" panels in premiere.
{
;panel := """" . panel . """" ;this adds quotation marks around the parameter so that it works as a string, not a variable.
; ; ; if (panel = "effect controls")
; ; ; {
; ; ; Send ^!+5
; ; ; return
; ; ; }
Send ^!+7 ;bring focus to the effects panel, in order to "clear" the current focus on the MAIN monitor
sleep 12
Send ^!+7 ;do it AGAIN, just in case a panel was full-screened... it would only have exited full screen, and not switched to the effects panel as it should have.
sleep 7
if (panel = "effects")
goto theEnd ;Send ^!+7 ;do nothing. the shortcut has already been pressed.
else if (panel = "timeline")
Send ^!+3 ;if focus had already been on the timeline, this would have switched to the next sequence in some arbitrary order.
else if (panel = "program") ;program monitor
Send ^!+4
else if (panel = "source") ;source monitor
{
Send ^!+2
;tippy("send ^!+2")
}
else if (panel = "project") ;AKA a "bin" or "folder"
Send ^!+1
else if (panel = "effect controls")
Send ^!+5
theEnd:
}
;end of prFocus()
;<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
;THIS IS A VERY SIMPLE FUNCTION FOR JUST TYPING STUFF INTO THE SEARCH BAR
;but it doesn't apply them to the clips.
effectsPanelType(item := "lol")
{
;Keyshower(item,"effectsPanelType")
; if IsFunc("Keyshower") {
; Func := Func("Keyshower")
; RetVal := Func.Call(item,"effectsPanelType")
; }
;prFocus("effects") ;reliably brings focus to the effects panel
Send ^+!7 ;CTRL SHIFT ALT 7 -- set in premiere to "effects" panel
sleep 20
Send ^b ;CTRL B --set in premiere to "select find box." Makes a windows noise if you do it again.
sleep 20
Send +{backspace} ;shift backspace deletes any text that may be present.
Sleep, 10
Send %item%
;now this next part re-selects the field in case you want to type anything different
sleep 10
send ^!b ;ctrl alt B is ALSO select find box, but doesn't have the annoying windows sound.
}
;;;;;;;;;;FUNCTION FOR DIRECTLY APPLYING A PRESET EFFECT TO A CLIP!;;;;;;;;;;;;
; preset() is my most used, and most useful AHK function! There is no good reason why Premiere doesn't have this functionality.
;keep in mind, I use 150% UI scaling, so your pixel distances for commands like mousemove WILL be different!
;to use this script yourself, carefully go through testing the script and changing the values, ensuring that the script works, one line at a time. use message boxes to check on variables and see where the cursor is. remove those message boxes later when you have it all working!
#IfWinActive ahk_exe Adobe Premiere Pro.exe
preset(item)
{
Sendinput, ^!+k ;shuttle STOP
;Keyshower(item,"preset") ;YOU DO NOT NEED THIS LINE. -- it simply displays keystrokes on the screen for the sake of tutorials... IF the function "keyshower" has been defined.
if IsFunc("Keyshower") {
Func := Func("Keyshower")
RetVal := Func.Call(item,"preset")
}
ifWinNotActive ahk_exe Adobe Premiere Pro.exe
goto theEnding ;and this line is here just in case the function is called while not inside premiere.
sleep 10
Send ^!+k ; another shortcut for Shuttle Stop. CTRL ALT SHIFT K. Set this in Premiere's shortcuts panel.
;so if the video is playing, this will stop it. Othewise, it can mess up the script.
sleep 5
;Setting the coordinate mode is really important. This ensures that pixel distances are consistant for everything, everywhere.
coordmode, pixel, Window
coordmode, mouse, Window
coordmode, Caret, Window
;This (temporarily) blocks the mouse and keyboard from sending any information, which could interfere with the funcitoning of the script.
BlockInput, SendAndMouse
BlockInput, MouseMove
BlockInput, On
SetKeyDelay, 0 ;this ensures that any text AutoHotKey "types in," will input instantly, rather than one letter at a time.
MouseGetPos, xposP, yposP ;---stores the cursor's current coordinates at X%xposP% Y%yposP%
send, {mButton} ;this will MIDDLE CLICK to bring focus to the panel underneath the cursor (the timeline). I forget exactly why, but if you create a nest, and immediately try to apply a preset to it, it doesn't work, because the timeline wasn't in focus...?
;but i just tried that and it still didn't work...
;;DAMN IT, i forgot the { } and it was sending those as letters, I am an idiot. Need better diagnostics tools...
Send ^+!7 ;CTRL SHIFT ALT 7 --- you must set this in premiere's keyboard shortcuts menu to the "effects" panel
sleep 20 ;"sleep" means the script will wait for 20 milliseconds before the next command. This is done to give Premiere some time to load its own things.
Send ^b ;CTRL B -- set in premiere to "select find box"
sleep 20
; sleep 20
;Any text in the Effects panel's find box has now been highlighted. There is also a blinking "text insertion point" at the end of that text. This is the vertical blinking line, or "caret."
MouseMove, %A_CaretX%, %A_CaretY%, 0
sleep 15
sleep 25
sleep 15 ;sometimes, premiere takes some time to notice that the text box has been highlighted. in that case, it will not return any value for the position of the Caret. Tehrefore, you have to wait.
MouseMove, %A_CaretX%, %A_CaretY%, 0
;and fortunately, AHK knows the exact X and Y position of this caret. So therefore, we can find the effects panel find box, no matter what monitor it is on, with 100% consistency.
;tooltip, 1 - mouse should be on the karat X= %A_CaretX% Y= %A_CaretY% now
sleep 15
;msgbox, carat X Y is %A_CaretX%, %A_CaretY%
MouseGetPos, , , Window, classNN
WinGetClass, class, ahk_id %Window%
;tooltip, 2 - ahk_class = %class% `nClassNN = %classNN% `nTitle= %Window%
sleep 50
;;;I think ControlGetPos is not affected by coordmode?? Or at least, it gave me the wrong coordinates if premiere is not fullscreened... https://autohotkey.com/docs/commands/ControlGetPos.htm
ControlGetPos, XX, YY, Width, Height, %classNN%, ahk_class %class%, SubWindow, SubWindow ;-I tried to exclude subwindows but I don't think it works...?
;;my results: 59, 1229, 252, 21, Edit1, ahk_class Premiere Pro
;tooltip, classNN = %classNN%
;sleep 50
;now we have found a lot of useful informaiton about this find box. Turns out, we don't need most of it...
;we just need the X and Y coordinates of the "upper left" corner...
;comment in the following line to get a message box of your current variable values. The script will not advance until you dismiss the message box.
;MsgBox, xx=%XX% yy=%YY%
;MouseMove, XX-25, YY+10, 0 ;--------------------for 150% UI scaling, this moves the cursor onto the magnifying glass
MouseMove, XX-15, YY+10, 0 ;--------------------for 100% UI scaling, this moves the cursor onto the magnifying glass
;msgbox, should be in the center of the magnifying glass now.
;sleep 50
sleep 5
;This types in the text you wanted to search for. Like "pop in." We can do this because the entire find box text was already selected by Premiere. Otherwise, we could click the magnifying glass if we wanted to , in order to select that find box.
Send %item%
sleep 30
;MouseMove, 62, 95, 0, R ;----------------------(for 150% UI) relative to the position of the magnifying glass (established earlier,) this moves the cursor down and directly onto the preset's icon. In my case, it is inside the "presets" folder, then inside of another folder, and the written name sohuld be compeltely unique so that it is the first and only item.
MouseMove, 41, 63, 0, R ;----------------------(for 100% UI)
;msgbox, The cursor should be directly on top of the preset's icon. `n If not, the script needs modification.
sleep 5
MouseGetPos, iconX, iconY, Window, classNN ;---now we have to figure out the ahk_class of the current panel we are on. It used to be DroverLord - Window Class14, but the number changes anytime you move panels around... so i must always obtain the information anew.
sleep 5
WinGetClass, class, ahk_id %Window% ;----------"ahk_id %Window%" is important for SOME REASON. if you delete it, this doesnt work.
;tooltip, ahk_class = %class% `nClassNN = %classNN% `nTitle= %Window%
;sleep 50
ControlGetPos, xxx, yyy, www, hhh, %classNN%, ahk_class %class%, SubWindow, SubWindow ;-I tried to exclude subwindows but I don't think it works...?
MouseMove, www/4, hhh/2, 0, R ;-----------------clicks in about the CENTER of the Effects panel. This clears the displayed presets from any duplication errors. VERY important. without this, the script fails 20% of the time.
sleep 5
MouseClick, left, , , 1 ;-----------------------the actual click
sleep 10
MouseMove, iconX, iconY, 0 ;--------------------moves cursor BACK onto the effect's icon
;tooltip, should be back on the effect's icon
;sleep 50
sleep 35
MouseClickDrag, Left, , , %xposP%, %yposP%, 0 ;---clicks the left button down, drags this effect to the cursor's pervious coordinates and releases the left mouse button, which should be above a clip, on the TIMELINE panel.
sleep 10
MouseClick, middle, , , 1 ;this returns focus to the panel the cursor is hovering above, WITHOUT selecting anything. great!
blockinput, MouseMoveOff ;returning mouse movement ability
BlockInput, off ;do not comment out or delete this line -- or you won't regain control of the keyboard!! However, CTRL+ALT+DEL will still work if you get stuck!! Cool.
;remove the following thingy if it makes no sense to you
IfInString, item, CROP
{
if IsFunc("cropClick") {
Func := Func("cropClick")
sleep 160
RetVal := Func.Call()
}
; sleep 160
; cropClick()
; ;msgbox, that had "CROP" in it.
}
;remove the above thingy if it makes no sense to you
theEnding:
}
;END of preset()
savepreset(presetname){
SendInput, {Shift Down}{Shift Up}{Ctrl Down}{c Down}
sleep 20
SendInput, {c up}{Ctrl up}
sleep 20
msgbox, text in clipboard = %clipboard%
presetname = %clipboard%
msgbox, presetname = %presetname%
return presetname
}
#IfWinActive ahk_exe Adobe Premiere Pro.exe
insertSFX(leSound)
{
ifWinNotActive ahk_exe Adobe Premiere Pro.exe
goto sfxEnding
;keyShower(leSound, "insertSFX")
if IsFunc("Keyshower") {
Func := Func("Keyshower")
RetVal := Func.Call(leSound, "insertSFX")
}
CoordMode, mouse, Screen
CoordMode, pixel, Screen
coordmode, Caret, screen
BlockInput, mouse
blockinput, MouseMove
BlockInput, On
SetKeyDelay, 0 ;for instant writing of text
MouseGetPos, xpos, ypos
send ^+x ;ctrl shift x -- shortcut in premiere for "remove in/out points.
sleep 10
send ^+9 ;ctrl shift 6 - source assignment preset 4. (sets it to A3.)
sleep 10
; Send ^!+1 ;premiere shortcut to open the "project" panel, which is actually a bin. Only ONE bin is highlightable in this way.
; ;Send F11
; sleep 100
;msgbox, you in the panel now?
send ^!+1 ;CTRL ALT SHIFT 1 -- ;shortcut for application>window>project (highlights a single bin. In my case, it's on my left monitor.)
tooltip, waiting for premiere to select that bin....
;msgbox, waiting for premiere to select that bin....
sleep 20
;msgbox how about naow?
;
Send ^b ;CTRL B -- set this in premiere's shortcuts panel to "select find box." Make sure there are NO OTHER conflicting shortcuts on this key, like "create new bin," which would stop it from working.
; send +{backspace} ;to delete anything that might be written in the bin, so that the caret coordinates are always accurate.
; msgbox, okay now what
Send %leSound% ;types in the name of the sound effect you want - should do so instantaneously.
tooltip, waiting for premiere to load......
send ^+9 ;source assignment preset 4, again.
sleep 400 ;we are waiting for the search to complete....
;sleep 400 ;we are still waiting for the search to complete....
MouseMove, -6000, 250, 0 ;moves the mouse to the expected location of the bin that becomes highlighted from the "project" keyboard shortcut command in Premiere.
;msgbox, wheres de mouse?
; MouseGetPos, lol, lel
; PixelGetColor, zecolor, lol, lel, alt slow rgb
; msgbox, %zecolor%
MouseClick, left
tooltip, CLICK!!!
sleep 10
send ^+9 ;source assignment preset 4, again.
sleep 5
Send ^b ;CTRL B -- set this in premiere's shortcuts panel to "select find box."
sleep 10
Send +{backspace} ;deletes the search text so that the bin returns to normal view with all SFX visible.
sleep 10
MouseMove, %xpos%, %ypos%, 0 ;move mouse back to original coordinates.
sleep 20
tooltip, so did that work?
;msgbox, clicked, mouse should be back at original coordinates.
;send ^!+4 ;select program monitor
sleep 10
;send ^!+3 ;select timeline
sleep 10
send ^+9 ;my shortcut for "assign source assignment preset 4" in Premiere. The preset has V3 and A4 selected as sources. I may end up only using F18, since it does not use the CTRL and SHIFT keys, which can cause problems sometimes.
sleep 50
Send ^/ ;CTRL FORWARD SLASH -- SET TO "OVERWRITE" in premiere. Premiere's default shortcut for "overwrite" is a period. I use modifier keys for THIS, so that a period is never typed accidentally.
sleep 30
; Send mbutton ;this will MIDDLE CLICK to reselect whatever panel your cursor was hovering over before you engaged this function.
send ^!+7 ;highlight effects panel
sleep 30
send ^!+3 ;this is set in premiere to highlight/switch to the timeline. important so that you aren't still stuck in the bin. If this is used more than once, it will unfortunately cycle thorugh all available sequences...
tooltip,
BlockInput, off
BlockInput, MouseMoveOff
sfxEnding:
}
;;end of insertSFX()
;you can select something inside of premiere (like a group of clips, or a transition) and then, with this code, you can COPY it and SAVE that clipboard state. I use this in conjunction with my secondary keyboard.
;You need to have insideclipboard.exe installed, and all the file paths properly comfigured.
;Keep in mind that you must RESTART your computer before the clipboard states become usable. IDK why.
#ifwinactive ahk_exe Adobe Premiere Pro.exe
saveClipboard(int) {
StringReplace, int, int, +, , All ;replace + with nothing. This is just in case A_thishotkey contains + if shift was used!
StringReplace, int, int, !, , All ;replace ! with nothing. This is just in case A_thishotkey contains ! if alt was used!
StringReplace, int, int, ^, , All ;replace ^ with nothing. This is just in case A_thishotkey contains ^ if ctrl was used!
;msgbox, , , saving as %int%, 0.6
tooltip, saving as`n"clip" . %int% . ".clp"
sleep 10
SendInput, {Shift Down}{Shift Up}{Ctrl Down}{c Down}
sleep 20
ClipWait, 0.25 ; this line might not be needed.
SendInput, {c up}{Ctrl up}
sleep 20
saveToFile("clip" . int . ".clp")
sleep 1000
saveToFile("clip" . int . ".clp")
tooltip,
}
;This is the real magic. With this script, you can PASTE those previously saved clipboard states, at any time.
#ifwinactive ahk_exe Adobe Premiere Pro.exe
recallClipboard(int, transition := 0) {
;deactivate keyboard and mouse
;keyShower(int, "recallClipboard")
if IsFunc("Keyshower") {
Func := Func("Keyshower")
RetVal := Func.Call(int, "recallClipboard")
}
WinActivate, Adobe Premiere Pro
prFocus("timeline")
;Send ^!d ;this is to deselect any clips that might be selected in the timeline.
;tooltip, "now loading random text into the clipboard."
loadFromFile("clipTEXT.clp") ;to create this file, just highlight some plain text, copy it, and use insideclipboard.exe to save it as clipTEXT.clp. The clipboard MUST have some text inside; it CANNOT be completely empty. This has the effect of DELETING all the aspects of the clipboard, EXCEPT for text.
sleep 15
; ; WinActivate, Adobe Premiere Pro ;IDK if this is needed here.
; ; loadFromFile("clipTEXT.clp") ;The clipboard must be loaded twice, or it won't work about 70% of the time! I don't know why...
; ; sleep 15
;Autohotkey can now delete that string of text, so that no text is accidentlaly pasted into premiere. It doesn't seem to be able to delete EVERYTHING, so the above code is definitely necessary!
clipboard =
;The clipboard is now completely empty.
sleep 10
;tooltip, now pasting NOTHING into premiere....
WinActivate, Adobe Premiere Pro ;extremely important to ensure you are still active/focused on Premiere
SendInput, {Shift Down}{Shift Up}
sleep 10
SendInput, {Ctrl Down}{v Down} ;this is a MUCH more robust way of using the keyboard shortcuts to PASTE, rather than just using "Send ^v"
sleep 5
SendInput, {v Up}{Ctrl Up}
sleep 20
;It is necessary to PASTE this COMPLETELY BLANK clipboard into premiere, or Premiere won't "know" that the clipboard has been completely emptied.
;If you don't do this, Premiere will just use whatever thing you had previously copied inside of Premiere.
clipboard =
;the above line is another method for clearing the clipboard that must also be done to ensure a totally empty clipboard
sleep 30
;tooltip, "clip" . %int% . ".clp" ;this code doesn't work
;tooltip, now preparing to paste %int%
;msgbox, %int%
WinActivate, Adobe Premiere Pro
loadFromFile("clip" . int . ".clp") ;now we are loading the previously saved clipboard file!
sleep 15
; ; loadFromFile("clip" . int . ".clp") ;This must be done twice, or it doesn't work! I don't know why!! :D ;ADENDUM - i tried it with only 1 load and NOW it IS working??? IDK why
; ; sleep 15
WinActivate, Adobe Premiere Pro ;this is extremely important.... otherwise, it will try to paste into the command prompt or something. You must ensure the correct program is pasted into.
; ; ; if (transition = 0)
; ; ; {
; ; ; target("v1", "off", "all", 5) ;this will disable all video layers, and enable only layer 5.
; ; ; tooltip, only layer 5 was turned on should be
; ; ; sleep 150
; ; ; }
tooltip, now PASTING into premiere...
WinActivate, Adobe Premiere Pro
SendInput, {Shift Down}{Shift Up}{Ctrl Down}{v Down}
sleep 5
SendInput, {v Up}{Ctrl Up}
sleep 10
;the below code doesn't work very well.
; sleep 100
;If (transition = 1){
; ;now if we want an accurate label colorwe have to DELETE what we just did, since none of the label colors will be correct due to a premiere bug.
; ;tooltip,,,gonna delete now,1
; tooltip,gonna delete now
; WinActivate, Adobe Premiere Pro
; prFocus("timeline")
; WinActivate, Adobe Premiere Pro
; SendInput, +{delete} ;ripple delete
; sleep 100
; ;now to paste again, now that the label colors have been loaded.
; ;REDO might also work. must test that.
; WinActivate, Adobe Premiere Pro
; prFocus("timeline")
; sleep 30
; SendInput, {Shift Down}{Shift Up}{Ctrl Down}{v Down}
; ClipWait, 0.50
; SendInput, {v Up}{Ctrl Up}
; sleep 10
;}
if (transition = 0)
target("v1", "on", "all")
sleep 10
; send ^{F9} ;toggle video tracks (hopefully off)
; send ^+{F9} ;toggle audio tracks (hopefully off)
tooltip,
Send, ^!{F11} ;this is to deselect any clips that might be selected in the timeline. WAS ctrl alt D. might be unreliable.
} ;end of recall Clipboard()
#ifwinactive ;everything below this line can happen in any application!
;;target() is a script to TARGET or UNTARGET any arbitrary track.
;it doesn't work well, and I don't really use it.
Target(v1orA1, onOff, allNoneSolo := 0, numberr := 0)
{
;tooltip, now in TARGET function
; BlockInput, on
; BlockInput, MouseMove
; MouseGetPos xPosCursor, yPosCursor
prFocus("timeline") ;brings focus to the timeline.
wrenchMarkerX := 400
wrenchMarkerY := 800 ;the upper left corner for where to begin searching for the timeline WRENCH and MARKER icons -- the only unique and reliable visual i can use for coordinates.
targetdistance := 98 ;Distance from the edge of the marker Wrench to the left edge of the track targeting graphics
CoordMode Pixel ;, screen ; IDK why, but it only works like this...
CoordMode Mouse, screen
;tooltip, starting
ImageSearch, xTime, yTime, wrenchMarkerX, wrenchMarkerY, wrenchMarkerX+600, wrenchMarkerY+1000, %A_WorkingDir%\timelineUniqueLocator2.png
if ErrorLevel = 0
{
;MouseMove, xTime, yTime, 0
;tooltip, where u at son. y %ytime% and x %xtime%
;do nothing. continue on.
xTime := xTime - targetdistance
;MouseMove, xTime, yTime, 0
}
else
{
tooltip, fail
goto resetTrackTargeter
}
;tooltip, continuing...
ImageSearch, FoundX, FoundY, xTime, yTime, xTime+100, yTime+1000, %A_WorkingDir%\%v1orA1%_unlocked_targeted_alone.png
if ErrorLevel = 1
ImageSearch, FoundX, FoundY, xTime, yTime, xTime+100, yTime+1000, %A_WorkingDir%\%v1orA1%_locked_targeted_alone.png
if ErrorLevel = 2
{
tippy("TARGETED v1 not found")
goto trackIsUntargeted
}
if ErrorLevel = 3
{
tippy("Could not conduct the TARGETED v1 search!")
goto resetTrackTargeter
}
if ErrorLevel = 0
{
;MouseMove, FoundX, FoundY, 0
;tooltip, where is the cursor naow 1,,,2
;tippy("a TARGETED track 1 was found.")
if (v1orA1 = "v1")
{
send +9 ;command in premiere to "toggle ALL video track targeting."
sleep 10
if (onOff = "on")
{
;tippy("turning ON")
send +9 ; do it again to TARGET everything.
}
sleep 10
if (numberr > 0)
Send +%numberr%
}
else if (v1orA1 = "a1")
{
send !9 ;command in premiere to "toggle ALL audio track targeting."
sleep 10
if (onOff = "on")
send !9 ; do it again to TARGET everything.
sleep 10
if (numberr > 0)
Send !%numberr%
}
goto resetTrackTargeter
}
trackIsUntargeted:
;tooltip, track is untargeted,,,2
if ErrorLevel = 1
ImageSearch, FoundX, FoundY, xTime, yTime, xTime+100, yTime+1000, %A_WorkingDir%\%v1orA1%_locked_untargeted_alone.png
if ErrorLevel = 1
ImageSearch, FoundX, FoundY, xTime, yTime, xTime+100, yTime+1000, %A_WorkingDir%\%v1orA1%_unlocked_untargeted_alone.png
if ErrorLevel = 0
{
;MouseMove, FoundX, FoundY, 0
;tippy("an UNTARGETED track 1 was found.")
;tooltip, where is the cursor naow,,,2
if (v1orA1 = "v1")
{
send ^{F9};send +9 ;command in premiere to "toggle ALL video track targets." This should TARGET everything.
sleep 10
if (onOff = "off")
send +9 ; do it again to UNTARGET everything.
sleep 10
if (numberr > 0)
Send +%numberr%
}
if (v1orA1 = "a1")
{
send ^+{F9} ;command in premiere to "toggle ALL audio track targets." This should TARGET everything. ;also ALT f9 but it's dangerous.
sleep 10
if (onOff = "off")
send !9 ; do it again to UNTARGET everything.
sleep 10
if (numberr > 0)
Send !%numberr%
}
goto resetTrackTargeter
}
resetTrackTargeter:
; MouseMove, xPosCursor, yPosCursor, 0
; blockinput, off
; blockinput, MouseMoveOff
;sleep 1000
tooltip,
tooltip,,,,2
sleep 10
}
;END of Target()
#ifwinactive
saveToFile(name) {
;code below does not use any fancy variables. It's a bare string. Unfortunately, I can't find a way to make it work better...
;change this path ----| and this one --------| to your own folder locations.
; | |
; v v
RunWait, %comspec% /c C:\AHK\2nd-keyboard\insideclipboard\InsideClipboard.exe /saveclp %name%, C:\AHK\2nd-keyboard\insideclipboard\clipboards\
;just saving the below lines of code, which didn't work because %pathh% nor %Exec% variables could not be defined properly. Or something... IDK....
;RunWait, %comspec% /c %Exec% /saveclp %name%, c:\Users\TaranWORK\Downloads\Taran extra keyboards\insideclipboard\clipboards\
;RunWait, %comspec% /c %Exec% /saveclp %name%, %pathh%
}
loadFromFile(name) {
; You'll need to change these paths too!
RunWait, %comspec% /c C:\AHK\2nd-keyboard\insideclipboard\InsideClipboard.exe /loadclp %name%, C:\AHK\2nd-keyboard\insideclipboard\clipboards\
}
;i think the line below is probably useless buti am afraid to delete it
#IfWinActive ahk_exe Adobe Premiere Pro.exe
;audioMonoMaker() will open the Audio Channels box, and use the cursor to put both tracks on [left/right], turning stereo sound into mono (with the [right/right] track as the source.
audioMonoMaker(track)
{
ifWinNotActive ahk_exe Adobe Premiere Pro.exe
goto monoEnding
sleep 3
;msgbox,,, what the hell,0.6
CoordMode,Mouse,Screen
CoordMode,pixel,Screen
;SetTitleMatchMode, 2
;DetectHiddenWindows, On
BlockInput, SendAndMouse
BlockInput, On
BlockInput, MouseMove ;prevents mouse from moving
;Keyshower(track,"audioMonoMaker") ;you can delete this line, you don't need it.
if IsFunc("Keyshower") {
Func := Func("Keyshower")
RetVal := Func.Call(track,"audioMonoMaker")
}
global tToggle = 1
;msgbox, track is %track%
if (track = "right")
{
;msgbox, this is for the RIGHT audio track. As usual, your number will be smaller, since I have 150% UI scaling enabled.
addPixels = 36
}
else if (track = "left")
{
addPixels = 0
;msgbox, this is for the LEFT audio track
}
;Send ^!+a ;control alt shift a --- ; audio channels shortcut, asigned in premiere - dont use this key combo anywhere else. UPDATE: seems unreliable to send shortcuts that use modifier keys, inside a funciton that was triggered using modifier keys. switched to F3.
sendinput, {F3} ;also the audio channels shortcut.
; sleep 15
; sendinput, {F3} ;again cause sometimes it fails?
;WARNING - this was cross-talking with !+a, causing a preset("blur with edges") macro to be executed. I dont know how to avoid. maybe change order...??
;WARNING - still cross talks with RENDER AUDIO, which is CTRL SHIFT A, or CTRL ALT A.
; fun fact, if you send this keystroke AGAIN, it does NOT close the panel, which is great... that means you can press the button anytime, and it will always result in an open panel.
sleep 15
MouseGetPos, xPosAudio, yPosAudio
MouseMove, 2222, 1625, 0 ;moved the mouse onto the expected location of the "okay" box, which has a distinct white color when the cursor is over it, which will let us know the panel has appeared.
; msgbox where am i, cursor says
MouseGetPos, MouseX, MouseY
waiting = 0
;the following loop is waiting until it sees a specific color from the panel, which means that it has loaded and can then be affected.
loop
{
waiting ++
sleep 50
tooltip, waiting = %waiting%`npixel color = %thecolor%
MouseGetPos, MouseX, MouseY
PixelGetColor, thecolor, MouseX, MouseY, RGB
if (thecolor = "0xE8E8E8")
{
tooltip, COLOR WAS FOUND
;msgbox, COLOR WAS FOUND
break
}
if (waiting > 10)
{
tooltip, no color found, go to ending
goto, ending
}
}
;*/
CoordMode, Mouse, Client
CoordMode, Pixel, Client
MouseMove, 165 + addPixels, 295, 0 ;this is relative to the audio channels window itself. Again, you should reduce these numbers by like 33%...?, since i use 150% UI scaling.
;msgbox, now we should be on the first check box
sleep 50
MouseGetPos, Xkolor, Ykolor
sleep 50
PixelGetColor, kolor, %Xkolor%, %Ykolor%
;msgbox, % kolor
; INFORMATION:
; 2b2b2b or 464646 = color of empty box
; cdcdcd = color when cursor is over the box
; 9a9a9a = color when cursor NOT over the box
; note that these colors will be different depending on your UI brightness set in premiere.
; For me, the default brightness of all panels is 313131 and/or 2B2B2B
;msgbox, kolor = %kolor%
If (kolor = "0x1d1d1d" || kolor = "0x333333") ; This is the color of an EMPTY checkbox. The coordinates hsould NOT lead to a position where the grey of the checkmark would be. Also, "kolor" is the variable name rather than "color" because "color" might be already used for something else in AHK.
{
;msgbox, box is empty
; click left
;sendinput, LButton
MouseClick, left, , , 1
sleep 10
}
else if (kolor = "0xb9b9b9") ;We are now looking for CHECK MARKS. This coordinate, should be directly on top of the box, but NOT directly on top of the GRAY checkmark itself. You need to detect telltale WHITE color that means the box has been checked.
{
; Do nothing. There was a checkmark in this box already.
}
sleep 5
MouseMove, 165 + addPixels, 329, 0
sleep 30
MouseGetPos, Xkolor2, Ykolor2
sleep 10
PixelGetColor, k2, %Xkolor2%, %Ykolor2%
sleep 30
;msgbox, k2 = %k2%
If (k2 = "0x1d1d1d" || k2 = "0x333333") ;both of these are potential dark grey background panel colors
{
;msgbox, box is empty. i should click
; click left
;sendinput, LButton
MouseClick, left, , , 1
sleep 10
;msgbox, did clicking happen?
}
else if (k2 = "0xb9b9b9")
{
; Do nothing. There was a checkmark in this box already
}
;msgbox, k2 color was %k2%
sleep 5
Send {enter}
ending:
CoordMode, Mouse, screen
CoordMode, Pixel, screen
MouseMove, xPosAudio, yPosAudio, 0
BlockInput, off
BlockInput, MouseMoveOff ;return mouse control to the user.
tooltip,
monoEnding:
} ; monomaker!!!!!!!!!!!!
#ifwinactive
;;;CLICK ON THE 'CROP' TRANSFORM BUTTON IN ORDER TO SELECT THE CROP ITSELF
cropClick()
{
;need something that wil toggle ^p if effect controls are not open.
CoordMode Pixel ;, screen
CoordMode Mouse, screen
BlockInput, on
BlockInput, MouseMove
MouseGetPos xPosCursor, yPosCursor
effectControlsX = 10
effectControlsY = 200 ;the coordinates of roughly where my Effect Controls usually are located on the screen
; coordmode, pixel, Window
; coordmode, mouse, Window
; coordmode, Caret, Window
;you might need to take your own screenshot (look at mine to see what is needed) and save as .png. Mine are(were) done with default UI brightness, plus 150% UI scaling in Windows.
;ImageSearch, FoundX, FoundY, effectControlsX, effectControlsY, effectControlsX+200, effectControlsY+800, %A_WorkingDir%\CROP_transform_button_D2019.png ;
ImageSearch, FoundX, FoundY, effectControlsX, effectControlsY, effectControlsX+200, effectControlsY+800, %A_WorkingDir%\CROP_transform_button_D2019_ui100.png
if ErrorLevel = 2
{
;msgbox,,, TaranDir is `n%TaranDir%,0.7
ImageSearch, FoundX, FoundY, effectControlsX, effectControlsY, effectControlsX+400, effectControlsY+1200, %A_workingDir%\CROP_transform_button_D2019.png
ImageSearch, FoundX, FoundY, effectControlsX, effectControlsY, effectControlsX+400, effectControlsY+1200, %A_workingDir%\CROP_transform_button_D2019_ui100.png
}
if ErrorLevel = 1
{
;msgbox, we made it to try 2
tippy("NO CROP WAS FOUND")
goto resetcropper
}
if ErrorLevel = 2
{
tippy("Could not conduct the crop search!")
goto resetcropper
}
if ErrorLevel = 0
{
MouseMove, FoundX+10, FoundY+10, 0 ;this moves the cursor onto the little square thingy.
;msgbox, is the cursor in position?
sleep 5
click left
}
resetcropper:
MouseMove, xPosCursor, yPosCursor, 0
blockinput, off
blockinput, MouseMoveOff
sleep 10
;msgbox, u are in cropland
return
}
;end of CROP CLICK
reselect()
{
;alt k??